aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2014-04-04 17:54:52 +0200
committerMichael Matz <matz@suse.de>2014-04-04 17:54:52 +0200
commit2024c445411f80b7c4b761322521d823e606418d (patch)
tree7d3b6501f2a670312885d54fa12556a2961d758e
parentf2c8491fc0ecf1870ed4db48029ef32dd3a9fd41 (diff)
downloadtinycc-2024c445411f80b7c4b761322521d823e606418d.tar.gz
tinycc-2024c445411f80b7c4b761322521d823e606418d.tar.bz2
run: Always create .got relocs
When output is memory we applied the correct GOT offset for certain relocations (e.g. _GOT32), but we forgot to actually fill the got entries with the final symbol values, so unconditionally create relocs against .got as well.
-rw-r--r--tccelf.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tccelf.c b/tccelf.c
index f92021c..568b40f 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -1173,6 +1173,13 @@ static unsigned long put_got_entry(TCCState *s1,
put_elf_reloc(s1->dynsym, s1->got,
s1->got->data_offset,
reloc_type, index);
+ } else {
+ /* Without .dynsym (i.e. static link or memory output) we
+ still need relocs against the generated got, so as to fill
+ the entries with the symbol values (determined later). */
+ put_elf_reloc(symtab_section, s1->got,
+ s1->got->data_offset,
+ reloc_type, sym_index);
}
/* And now create the GOT slot itself. */
ptr = section_ptr_add(s1->got, PTR_SIZE);