aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2017-11-14 16:43:22 +0100
committerMichael Matz <matz@suse.de>2017-11-14 16:43:22 +0100
commit74463eb954bf7c579915ea2becdc1483359dacfc (patch)
tree2f6a9d765f9d62e9085602a76300689d9e4c25b4
parent32c9b51401c13fba9f0e2d2a4e791cdc9116143c (diff)
downloadtinycc-74463eb954bf7c579915ea2becdc1483359dacfc.tar.gz
tinycc-74463eb954bf7c579915ea2becdc1483359dacfc.tar.bz2
Revert "gen_addrpc32: absolute ptr needs *ABS* relocation"
This reverts commit 870271ea071971002fa556e09e1873db316fa1a9. The commit is broken, you can't unconditionally emit a PC-relative relocation without a symbol. And if there's a symbol the addend need to be in the relocation, not the section.
-rw-r--r--x86_64-gen.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/x86_64-gen.c b/x86_64-gen.c
index f4d86e1..4d063cb 100644
--- a/x86_64-gen.c
+++ b/x86_64-gen.c
@@ -257,7 +257,8 @@ ST_FUNC void gen_addr64(int r, Sym *sym, int64_t c)
/* output constant with relocation if 'r & VT_SYM' is true */
ST_FUNC void gen_addrpc32(int r, Sym *sym, int c)
{
- greloca(cur_text_section, sym, ind, R_X86_64_PC32, 0);
+ if (r & VT_SYM)
+ greloca(cur_text_section, sym, ind, R_X86_64_PC32, c-4), c=4;
gen_le32(c-4);
}