I created this binary with gold 2.25/1.11: http://mail.aegee.org/dpa/bz18288/strip/opendkim-gold2.25-unstripped unstripped size is 475 880 bytes. When I strip it, the size increases to 2 560 600 bytes (http://mail.aegee.org/dpa/bz18288/strip/opendkim-gold2.25-stripped) . I use strip 2.25 . This is a bug, as strip without parameters increases the file size. The diff of readelf --all of both files is: # diff stripped unstripped --- stripped 2015-04-23 13:22:32.692277302 +0000 +++ unstripped 2015-04-23 13:22:00.942278193 +0000 @@ -10,7 +10,7 @@ Version: 0x1 Entry point address: 0x40c0d4 Start of program headers: 64 (bytes into file) - Start of section headers: 2558744 (bytes into file) + Start of section headers: 474024 (bytes into file) Flags: 0x0 Size of this header: 64 (bytes) Size of program headers: 56 (bytes) @@ -56,29 +56,29 @@ 000000000000a0a4 0000000000000000 A 0 0 8 [16] .eh_frame_hdr PROGBITS 000000000046f4e4 0006f4e4 00000000000016d4 0000000000000000 A 0 0 4 - [17] .ctors PROGBITS 0000000000471c80 0026ebf0 + [17] .ctors PROGBITS 0000000000471c80 00071c80 0000000000000010 0000000000000000 WA 0 0 8 - [18] .dtors PROGBITS 0000000000471c90 0026ec00 + [18] .dtors PROGBITS 0000000000471c90 00071c90 0000000000000010 0000000000000000 WA 0 0 8 - [19] .jcr PROGBITS 0000000000471ca0 0026ec10 + [19] .jcr PROGBITS 0000000000471ca0 00071ca0 0000000000000008 0000000000000000 WA 0 0 8 - [20] .dynamic DYNAMIC 0000000000471ca8 0026ec18 + [20] .dynamic DYNAMIC 0000000000471ca8 00071ca8 0000000000000330 0000000000000010 WA 4 0 8 - [21] .got PROGBITS 0000000000471fd8 0026ef48 + [21] .got PROGBITS 0000000000471fd8 00071fd8 0000000000000010 0000000000000000 WA 0 0 8 - [22] .got.plt PROGBITS 0000000000471fe8 0026ef58 + [22] .got.plt PROGBITS 0000000000471fe8 00071fe8 0000000000000ac8 0000000000000000 WA 0 0 8 - [23] .data PROGBITS 0000000000472ac0 0026fa30 + [23] .data PROGBITS 0000000000472ac0 00072ac0 0000000000000f9c 0000000000000000 WA 0 0 64 - [24] .tm_clone_table PROGBITS 0000000000473a60 002709d0 + [24] .tm_clone_table PROGBITS 0000000000473a60 00073a60 0000000000000000 0000000000000000 WA 0 0 8 - [25] .bss NOBITS 0000000000474a60 002709d0 - 0000000000013b48 0000000000000000 WA 0 0 4194304 - [26] .comment PROGBITS 0000000000000000 002709d0 + [25] .bss NOBITS 0000000000474a60 00074a60 + 0000000000013b48 0000000000000000 WA 0 0 2109584 + [26] .comment PROGBITS 0000000000000000 00073a60 0000000000000023 0000000000000001 MS 0 0 1 - [27] .note.gnu.gold-ve NOTE 0000000000000000 002709f4 + [27] .note.gnu.gold-ve NOTE 0000000000000000 00073a84 000000000000001c 0000000000000000 0 0 4 - [28] .shstrtab STRTAB 0000000000000000 00270a10 + [28] .shstrtab STRTAB 0000000000000000 00073aa0 0000000000000102 0000000000000000 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings), l (large) @@ -97,9 +97,9 @@ [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] LOAD 0x0000000000000000 0x0000000000400000 0x0000000000400000 0x0000000000070bb8 0x0000000000070bb8 R E 1000 - LOAD 0x000000000026ebf0 0x0000000000471c80 0x0000000000471c80 + LOAD 0x0000000000071c80 0x0000000000471c80 0x0000000000471c80 0x0000000000001de0 0x0000000000016928 RW 203090 - DYNAMIC 0x000000000026ec18 0x0000000000471ca8 0x0000000000471ca8 + DYNAMIC 0x0000000000071ca8 0x0000000000471ca8 0x0000000000471ca8 0x0000000000000330 0x0000000000000330 RW 8 NOTE 0x0000000000000254 0x0000000000400254 0x0000000000400254 0x0000000000000020 0x0000000000000020 R 4 @@ -107,7 +107,7 @@ 0x00000000000016d4 0x00000000000016d4 R 4 GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 RW 0 - GNU_RELRO 0x000000000026ebf0 0x0000000000471c80 0x0000000000471c80 + GNU_RELRO 0x0000000000071c80 0x0000000000471c80 0x0000000000471c80 0x0000000000000380 0x0000000000000380 RW 8 Section to Segment mapping: @@ -122,7 +122,7 @@ 07 08 .ctors .dtors .jcr .dynamic .got -Dynamic section at offset 0x26ec18 contains 46 entries: +Dynamic section at offset 0x71ca8 contains 46 entries: Tag Type Name/Value 0x0000000000000003 (PLTGOT) 0x471fe8 0x0000000000000002 (PLTRELSZ) 8208 (bytes) @@ -1019,7 +1019,7 @@ GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag) OS: Linux, ABI: 3.2.6 -Displaying notes found at file offset 0x002709f4 with length 0x0000001c: +Displaying notes found at file offset 0x00073a84 with length 0x0000001c: Owner Data size Description GNU 0x00000009 NT_GNU_GOLD_VERSION (gold version) Version: gold 1.11
[hjl@gnu-6 pr18308]$ readelf -lW opendkim-gold2.25-unstripped Elf file type is EXEC (Executable file) Entry point 0x40c0d4 There are 9 program headers, starting at offset 64 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align PHDR 0x000040 0x0000000000400040 0x0000000000400040 0x0001f8 0x0001f8 R 0x8 INTERP 0x000238 0x0000000000400238 0x0000000000400238 0x00001c 0x00001c R 0x1 [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] LOAD 0x000000 0x0000000000400000 0x0000000000400000 0x070bb8 0x070bb8 R E 0x1000 LOAD 0x071c80 0x0000000000471c80 0x0000000000471c80 0x001de0 0x016928 RW 0x203090 0x203090 is a very strange alignment. I think it is a gold bug. DYNAMIC 0x071ca8 0x0000000000471ca8 0x0000000000471ca8 0x000330 0x000330 RW 0x8 NOTE 0x000254 0x0000000000400254 0x0000000000400254 0x000020 0x000020 R 0x4 GNU_EH_FRAME 0x06f4e4 0x000000000046f4e4 0x000000000046f4e4 0x0016d4 0x0016d4 R 0x4 GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0 GNU_RELRO 0x071c80 0x0000000000471c80 0x0000000000471c80 0x000380 0x000380 RW 0x8 Section to Segment mapping: Segment Sections... 00 01 .interp 02 .interp .note.ABI-tag .dynsym .dynstr .gnu.hash .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame .eh_frame_hdr 03 .ctors .dtors .jcr .dynamic .got .got.plt .data .bss 04 .dynamic 05 .note.ABI-tag 06 .eh_frame_hdr 07 08 .ctors .dtors .jcr .dynamic .got [hjl@gnu-6 pr18308]$
Gold generates [25] .bss NOBITS 0000000000474a60 074a60 013b48 00 WA 0 0 2109584 Where does 2109584 byte alignment come from?
The uploaded binary is produced as described in PR18288, but using the gold linker. At http://mail.aegee.org/dpa/bz18288/strip/ I uploaded the binary linked with gold-master, unstripped the binary linked with gold-master, stripped with strip-2.25 the binary linked wiht gold-master, stripped with strip-master the binary linked with gold-2.25, unstripped the binary linked with gold-2.25, stripped with strip-2.25 the binary linked with gold-2.25, stripped with strip-master No two files are identical. 2 109 584bytes come from gold-2.25, unstripped.
(In reply to dilyan.palauzov@aegee.org from comment #3) > > 2 109 584bytes come from gold-2.25, unstripped. This is a gold bug. Gold generate strange alignment on .bss section: [26] .bss NOBITS 0000000000474a60 074a60 013b48 00 WA 0 0 2109584 vs ld [26] .bss NOBITS 0000000000672a80 072a5c 010aa8 00 WA 0 0 64
http://mail.aegee.org/dpa/bz18288/strip/opendkim-gold2.25-unstripped gives "404 Not Found". Waiting for a reproducer.
The right URL is http://mail.aegee.org/dpa/bz18288/strip/opendkim-gold-2.25-unstripped .
*** This bug has been marked as a duplicate of bug 18288 ***