History

tccelf.c: Reset sym after call to build_got.

The call to build_got can cause symtab_section->data to be reallocated (build_got -> add_elf_sym -> put_elf_sym -> section_ptr_add -> section_realloc -> tcc_realloc). This is not obvious on a cursory inspection, but fortunately Valgrind spotted it immediately. Are there other, similar bugs that Valgrind did not detect?

Edmund Grimley Evans committed 11 years ago

Commit f0b75661 parent 743684f1 file · +3 −1Browse files

Unified · Split

tccelf.c+3−1
@@ -1446,8 +1446,10 @@ ST_FUNC void build_got_entries(TCCState *s1) · 1445 unmodified lines
1446 break;1446 break;
1447 }1447 }
1448 1448
1449 if (!s1->got)1449 if (!s1->got) {
1450 build_got(s1);1450 build_got(s1);
1451 sym = &((ElfW(Sym) *)symtab_section->data)[sym_index];
1452 }
1451 if (type == R_X86_64_GOT32 || type == R_X86_64_GOTPCREL ||1453 if (type == R_X86_64_GOT32 || type == R_X86_64_GOTPCREL ||
1452 type == R_X86_64_PLT32) {1454 type == R_X86_64_PLT32) {
1453 unsigned long ofs;1455 unsigned long ofs;

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