Fix again GOT32 + PLT32 reloc commit

Fix commit aa561d7011 by setting
has_plt_entry once the plt has been created, not before.
master
Thomas Preud'homme 2014-03-26 22:13:20 +08:00
parent b125743323
commit b018bac9c8
1 changed files with 3 additions and 4 deletions

View File

@ -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");