History

Fix again GOT32 + PLT32 reloc commit

Fix commit aa561d70119accb59a17f10f9ba69076fb0ab516 by setting has_plt_entry once the plt has been created, not before.

Thomas Preud'homme committed 12 years ago

Commit b018bac1 parent b1257431 file · +3 −4Browse files

Unified · Split

tccelf.c+3−4
@@ -1031,7 +1031,7 @@ static void put_got_entry(TCCState *s1, · 1030 unmodified lines
10311031 /* if a got entry already exists for that symbol, no need to add one */
10321032 if (sym_index < s1->nb_sym_attrs &&
10331033 s1->sym_attrs[sym_index].got_offset) {
1034− if (!need_plt_entry)
1034+ if (!need_plt_entry || s1->sym_attrs[sym_index].has_plt_entry)
10351035 return;
10361036 else
10371037 got_entry_present = 1;
@@ -1042,9 +1042,6 @@ static void put_got_entry(TCCState *s1, · 4 unmodified lines
10421042 if (s1->dynsym) {
10431043 sym = &((ElfW(Sym) *)symtab_section->data)[sym_index];
10441044 name = (char *) symtab_section->link->data + sym->st_name;
1045− if (s1->sym_attrs[sym_index].has_plt_entry)
1046− return;
1047− s1->sym_attrs[sym_index].has_plt_entry = 1;
10481045 offset = sym->st_value;
10491046 #if defined(TCC_TARGET_I386) || defined(TCC_TARGET_X86_64)
10501047 if (need_plt_entry) {
@@ -1090,6 +1087,7 @@ static void put_got_entry(TCCState *s1, · 39 unmodified lines
10901087 if (s1->output_type == TCC_OUTPUT_EXE)
10911088 #endif
10921089 offset = plt->data_offset - 16;
1090+ s1->sym_attrs[sym_index].has_plt_entry = 1;
10931091 }
10941092 #elif defined(TCC_TARGET_ARM)
10951093 if (need_plt_entry) {
@@ -1127,6 +1125,7 @@ static void put_got_entry(TCCState *s1, · 31 unmodified lines
11271125 the PLT */
11281126 if (s1->output_type == TCC_OUTPUT_EXE)
11291127 offset = plt->data_offset - 16;
1128+ s1->sym_attrs[sym_index].has_plt_entry = 1;
11301129 }
11311130 #elif defined(TCC_TARGET_C67)
11321131 tcc_error("C67 got not implemented");

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t