https://sourceware.org/bugzilla/show_bug.cgi?id=32961
H.J. Lu <hjl.tools at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Last reconfirmed| |2025-05-13 Assignee|unassigned at sourceware dot org |hjl.tools at gmail dot com Status|UNCONFIRMED |WAITING --- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> --- Created attachment 16082 --> https://sourceware.org/bugzilla/attachment.cgi?id=16082&action=edit A patch to add --unique-pushsection Please try this. I got [hjl@gnu-tgl-3 pr32961]$ make gcc -B./ -Wa,--unique-pushsection -O2 -ffunction-sections -c -o x.o x.c ./ld -e entry_func --gc-sections -o x x.o readelf -sW x Symbol table '.symtab' contains 6 entries: Num: Value Size Type Bind Vis Ndx Name 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND 1: 0000000000000000 0 FILE LOCAL DEFAULT ABS x.c 2: 0000000000400160 6 FUNC GLOBAL DEFAULT 1 entry_func 3: 0000000000402000 0 NOTYPE GLOBAL DEFAULT 4 __bss_start 4: 0000000000402000 0 NOTYPE GLOBAL DEFAULT 4 _edata 5: 0000000000402000 0 NOTYPE GLOBAL DEFAULT 4 _end [hjl@gnu-tgl-3 pr32961]$ readelf -SW x.o There are 25 section headers, starting at offset 0x480: Section Headers: [Nr] Name Type Address Off Size ES Flg Lk Inf Al [ 0] NULL 0000000000000000 000000 000000 00 0 0 0 [ 1] .text PROGBITS 0000000000000000 000040 000000 00 AX 0 0 1 [ 2] .data PROGBITS 0000000000000000 000040 000000 00 WA 0 0 1 [ 3] .bss NOBITS 0000000000000000 000040 000000 00 WA 0 0 1 [ 4] .text.foo1 PROGBITS 0000000000000000 000040 000001 00 AX 0 0 16 [ 5] .text.foo2 PROGBITS 0000000000000000 000048 000006 00 AX 0 0 16 [ 6] .rela.text.foo2 RELA 0000000000000000 000298 000018 18 I 22 5 8 [ 7] .alt_section.text.foo1 PROGBITS 0000000000000000 00004e 000005 00 AX 0 0 1 [ 8] .rela.alt_section.text.foo1 RELA 0000000000000000 0002b0 000018 18 I 22 7 8 [ 9] .text.foo3 PROGBITS 0000000000000000 000058 000006 00 AX 0 0 16 [10] .rela.text.foo3 RELA 0000000000000000 0002c8 000018 18 I 22 9 8 [11] .alt_section.text.foo2 PROGBITS 0000000000000000 00005e 000005 00 AX 0 0 1 [12] .rela.alt_section.text.foo2 RELA 0000000000000000 0002e0 000018 18 I 22 11 8 [13] .text.entry_func PROGBITS 0000000000000000 000068 000006 00 AX 0 0 16 [14] .rela.text.entry_func RELA 0000000000000000 0002f8 000018 18 I 22 13 8 [15] .alt_section.text.foo3 PROGBITS 0000000000000000 00006e 000005 00 AX 0 0 1 [16] .rela.alt_section.text.foo3 RELA 0000000000000000 000310 000018 18 I 22 15 8 [17] .comment PROGBITS 0000000000000000 000073 00002f 01 MS 0 0 1 [18] .note.GNU-stack PROGBITS 0000000000000000 0000a2 000000 00 0 0 1 [19] .note.gnu.property NOTE 0000000000000000 0000a8 000030 00 A 0 0 8 [20] .eh_frame PROGBITS 0000000000000000 0000d8 000068 00 A 0 0 8 [21] .rela.eh_frame RELA 0000000000000000 000328 000060 18 I 22 20 8 [22] .symtab SYMTAB 0000000000000000 000140 000138 18 23 9 8 [23] .strtab STRTAB 0000000000000000 000278 00001f 00 0 0 1 [24] .shstrtab STRTAB 0000000000000000 000388 0000f1 00 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings), I (info), L (link order), O (extra OS processing required), G (group), T (TLS), C (compressed), x (unknown), o (OS specific), E (exclude), D (mbind), l (large), p (processor specific) [hjl@gnu-tgl-3 pr32961]$ -- You are receiving this mail because: You are on the CC list for the bug.