aboutsummaryrefslogtreecommitdiff
path: root/tccelf.c
diff options
context:
space:
mode:
authorThomas Preud'homme <robotux@celest.fr>2014-03-26 22:13:20 +0800
committerThomas Preud'homme <robotux@celest.fr>2014-03-29 14:46:26 +0800
commitb018bac9c8e1e47fbcb42565ddcdf2a2965b3fcf (patch)
tree3939cd55f3ce51cc350c423a5ab3e91afd50d552 /tccelf.c
parentb125743323f92b3492634cd875be820c890d5f29 (diff)
downloadtinycc-b018bac9c8e1e47fbcb42565ddcdf2a2965b3fcf.tar.gz
tinycc-b018bac9c8e1e47fbcb42565ddcdf2a2965b3fcf.tar.bz2
Fix again GOT32 + PLT32 reloc commit
Fix commit aa561d70119accb59a17f10f9ba69076fb0ab516 by setting has_plt_entry once the plt has been created, not before.
Diffstat (limited to 'tccelf.c')
-rw-r--r--tccelf.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/tccelf.c b/tccelf.c
index f5f9eed..932cf03 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -1031,7 +1031,7 @@ static void put_got_entry(TCCState *s1,
/* if a got entry already exists for that symbol, no need to add one */
if (sym_index < s1->nb_sym_attrs &&
s1->sym_attrs[sym_index].got_offset) {
- if (!need_plt_entry)
+ if (!need_plt_entry || s1->sym_attrs[sym_index].has_plt_entry)
return;
else
got_entry_present = 1;
@@ -1042,9 +1042,6 @@ static void put_got_entry(TCCState *s1,
if (s1->dynsym) {
sym = &((ElfW(Sym) *)symtab_section->data)[sym_index];
name = (char *) symtab_section->link->data + sym->st_name;
- if (s1->sym_attrs[sym_index].has_plt_entry)
- return;
- s1->sym_attrs[sym_index].has_plt_entry = 1;
offset = sym->st_value;
#if defined(TCC_TARGET_I386) || defined(TCC_TARGET_X86_64)
if (need_plt_entry) {
@@ -1090,6 +1087,7 @@ static void put_got_entry(TCCState *s1,
if (s1->output_type == TCC_OUTPUT_EXE)
#endif
offset = plt->data_offset - 16;
+ s1->sym_attrs[sym_index].has_plt_entry = 1;
}
#elif defined(TCC_TARGET_ARM)
if (need_plt_entry) {
@@ -1127,6 +1125,7 @@ static void put_got_entry(TCCState *s1,
the PLT */
if (s1->output_type == TCC_OUTPUT_EXE)
offset = plt->data_offset - 16;
+ s1->sym_attrs[sym_index].has_plt_entry = 1;
}
#elif defined(TCC_TARGET_C67)
tcc_error("C67 got not implemented");