History

Clear SHF_GROUP flag when linking

SHF_GROUP flag set on a section indicates that it is part of a section group and that if the section is removed, the other sections in the same group should be removed as well [1]. Since section group are guide for the linking process, they do not have any meaning after linking has occured. TCC rightfully [2] discard such sections (by not recognizing the section type) but keeps the SHF_GROUP flag set on sections that were part of a section group which confuses binutils (objdump and gdb at least). Clearing that bit makes objdump and gdb accept binaries created by TCC. [1] https://docs.oracle.com/cd/E19683-01/816-1386/chapter7-26/index.html [2] GNU ld does the same

root committed 9 years ago

Commit ccf9ed71 parent ed99f361 file · +1 −1Browse files

Unified · Split

tccelf.c+1−1
@@ -3047,7 +3047,7 @@ ST_FUNC int tcc_load_object_file(TCCState *s1, · 3046 unmodified lines
30473047 }
30483048 }
30493049 /* not found: create new section */
3050− s = new_section(s1, sh_name, sh->sh_type, sh->sh_flags);
3050+ s = new_section(s1, sh_name, sh->sh_type, sh->sh_flags & ~SHF_GROUP);
30513051 /* take as much info as possible from the section. sh_link and
30523052 sh_info will be updated later */
30533053 s->sh_addralign = sh->sh_addralign;

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