From 9645b62a65986738e6b70d748890d73daf40508b Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Mon, 9 May 2016 23:09:55 +0200 Subject: 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). --- tccelf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tccelf.c') diff --git a/tccelf.c b/tccelf.c index 196dd65..1ef4aef 100644 --- a/tccelf.c +++ b/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; } -- cgit v1.3.1