https://sourceware.org/bugzilla/show_bug.cgi?id=19162
Bug ID: 19162 Summary: Huge binary after linking sections with "a" and "wa" flags Product: binutils Version: 2.26 (HEAD) Status: NEW Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: iverbin at gmail dot com Target Milestone: --- The testcase: $ cat t1.s .section ".AAA", "a" .long 0x12345678 $ cat t2.s .section ".AAA", "wa" .long 0x12345678 $ as t1.s -o t1.o $ as t2.s -o t2.o $ ld -shared t1.o t2.o $ ls -lh a.out 2.1M a.out Some strange 2MB offset is inserted into another section: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align [ 0] NULL 0000000000000000 00000000 0000000000000000 0000000000000000 0 0 0 [ 1] .hash HASH 00000000000000b0 000000b0 0000000000000028 0000000000000004 A 2 0 8 [ 2] .dynsym DYNSYM 00000000000000d8 000000d8 0000000000000078 0000000000000018 A 3 2 8 [ 3] .dynstr STRTAB 0000000000000150 00000150 0000000000000019 0000000000000000 A 0 0 1 [ 4] .AAA PROGBITS 0000000000000169 00000169 0000000000000008 0000000000000000 WA 0 0 1 [ 5] .eh_frame PROGBITS 0000000000000178 00000178 0000000000000000 0000000000000000 A 0 0 8 [ 6] .dynamic DYNAMIC 0000000000200178 00200178 <-- ??? 00000000000000b0 0000000000000010 WA 3 0 8 It seems that something goes wrong during section-to-segment mapping, because when both .AAA have "wa" flags, we got small binary with 2 LOAD segments: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flags Align LOAD 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x00000000000001a8 0x00000000000001a8 R 200000 LOAD 0x00000000000001a8 0x00000000002001a8 0x00000000002001a8 0x00000000000000b8 0x00000000000000b8 RW 200000 But when one .AAA has "a" flag, and another .AAA has "wa" flag, we got huge binary with only one big LOAD segment: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flags Align LOAD 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000200228 0x0000000000200228 RW 200000 -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils