ELF64: PLT32, GOTPCREL, and GOTPCREL64 really need exactitude

Now when the assembler is properly generating the address that we push
down to the backend, enable requesting an exact value for these
relocations (these are pointing to a specific GOT or PLT slot; the
addend is used to adjust the computed value in the instruction, not
for offset for the symbol.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin 2008-10-17 23:32:40 -07:00
parent 7f1315070e
commit 2a282275fe

View File

@ -1100,13 +1100,13 @@ static void elf_out(int32_t segto, const void *data,
addr = 0;
} else if (wrt == elf_plt_sect + 1) {
elf_add_gsym_reloc(s, segment, addr, size,
R_X86_64_PLT32, false);
R_X86_64_PLT32, true);
addr = 0;
} else if (wrt == elf_gotpc_sect + 1 ||
wrt == elf_got_sect + 1) {
printf("addr = %ld, pcrel = %ld\n", addr, size);
elf_add_gsym_reloc(s, segment, addr, size,
R_X86_64_GOTPCREL, false);
R_X86_64_GOTPCREL, true);
addr = 0;
} else if (wrt == elf_gotoff_sect + 1 ||
wrt == elf_got_sect + 1) {
@ -1134,7 +1134,7 @@ static void elf_out(int32_t segto, const void *data,
} else if (wrt == elf_gotpc_sect + 1 ||
wrt == elf_got_sect + 1) {
elf_add_gsym_reloc(s, segment, addr, size,
R_X86_64_GOTPCREL64, false);
R_X86_64_GOTPCREL64, true);
addr = 0;
} else if (wrt == elf_gotoff_sect + 1 ||
wrt == elf_got_sect + 1) {