Don't generate an additional offset for _GLOBAL_OFFSET_TABLE_ if a WRT was
specified (the NASM usage). In GAS, _GLOBAL_OFFSET_TABLE_ doesn't have a WRT
but instead has special handling.
This isn't quite *exactly* the right fix; a better fix would be to recognize
the _GLOBAL_OFFSET_TABLE_ case in the GAS parser and adjust the value
appropriately there. However, this fix seems to do the right thing in the
meantime for both GAS and NASM cases.
svn path=/trunk/yasm/; revision=2321
elf_reloc_entry *reloc,
unsigned long offset)
{
- int is_GOT = reloc->is_GOT_sym;
-
- if (reloc->wrt) {
- const elf_machine_ssym *ssym = (elf_machine_ssym *)
- yasm_symrec_get_data(reloc->wrt, &elf_ssym_symrec_data);
- if (!ssym || reloc->valsize != ssym->size)
- yasm_internal_error(N_("Unsupported WRT"));
- if (ssym->reloc == R_386_GOTPC)
- is_GOT = 1;
- }
-
- if (is_GOT && reloc->valsize == 32 && offset != 0)
+ if (!reloc->wrt && reloc->is_GOT_sym && reloc->valsize == 32 && offset != 0)
{
yasm_intnum *off_intn = yasm_intnum_create_uint(offset);
yasm_intnum_calc(intn, YASM_EXPR_ADD, off_intn);
5b
81
c3
-05
+03
00
00
00