]> granicus.if.org Git - yasm/commit
Fix ELF64 relocations for common, global, and common+global symbols to match
authorPeter Johnson <peter@tortall.net>
Sun, 6 Nov 2005 20:07:15 +0000 (20:07 -0000)
committerPeter Johnson <peter@tortall.net>
Sun, 6 Nov 2005 20:07:15 +0000 (20:07 -0000)
commit36ff44b3ac13613805ac5680570bede242694d1b
treecf291d8847ec0ee63d6865fa92c7ae4604a75d5d
parentb4d65986302dcb617d7af7abd141cdf5ec93bad4
Fix ELF64 relocations for common, global, and common+global symbols to match
GAS output.  The way we were generating relocations before would make
common+global symbol usage generate a relocation against the symbol but
figure in the symbol's value into the relocation addend.

* expr.h (yasm_symrec_relocate_action): New enum, so that:
(yasm_expr_extract_symrec): can conditionalize replacing the symbol with its
value based on whether the symbol is only local (e.g. not declared global,
etc).
* expr.c (yasm_expr_extract_symrec): Update implementation.

* xdf-objfmt.c, coff-objfmt.c: Update to use new enum constants.

* elf-objfmt.c (elf_objfmt_output_expr): Only relocate against section if
symbol is only local, and change call to yasm_expr_extract_symrec to only
add in symbol value if symbol is only local.

* stabs-elf.hex, elftest.hex: Update for changes.

* elf_gas64_reloc.asm: New test.

svn path=/trunk/yasm/; revision=1311
12 files changed:
libyasm/expr.c
libyasm/expr.h
modules/dbgfmts/stabs/tests/stabs-elf.hex
modules/objfmts/coff/coff-objfmt.c
modules/objfmts/elf/elf-objfmt.c
modules/objfmts/elf/tests/Makefile.inc
modules/objfmts/elf/tests/elftest.hex
modules/objfmts/elf/tests/gas64/Makefile.inc [new file with mode: 0644]
modules/objfmts/elf/tests/gas64/elf_gas64_reloc.asm [new file with mode: 0644]
modules/objfmts/elf/tests/gas64/elf_gas64_reloc.errwarn [new file with mode: 0644]
modules/objfmts/elf/tests/gas64/elf_gas64_test.sh [new file with mode: 0755]
modules/objfmts/xdf/xdf-objfmt.c