x86_64: Use addend on relocs
Traditional behaviour on x86-64 is to encode the relocation addend in r_addend, not in the relocated field (after all, that's the reason to use RELA relocs to begin with). Our linker can deal with both, other linkers as well. But using e.g. the GNU assembler one can detect differences (equivalent code in the end, but still a difference). Now there's only a trivial difference in tests/asmtest.S (having to do with ordering of prefixes).
This commit is contained in:
2
tccelf.c
2
tccelf.c
@ -927,7 +927,7 @@ ST_FUNC void relocate_section(TCCState *s1, Section *s)
|
||||
qrel->r_offset = rel->r_offset;
|
||||
qrel->r_info = ELFW(R_INFO)(esym_index, R_X86_64_PC32);
|
||||
/* Use sign extension! */
|
||||
qrel->r_addend = (int)read32le(ptr);
|
||||
qrel->r_addend = (int)read32le(ptr) + rel->r_addend;
|
||||
qrel++;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user