[GHC] #10779: .so files in 64-bit Debian builds are 4% larger than they have to be

#10779: .so files in 64-bit Debian builds are 4% larger than they have to be -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: low | Milestone: Component: Build | Version: 7.10.2 System | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -------------------------------------+------------------------------------- For some reason, all .so files from the Debian builds at https://www.haskell.org/ghc/download_ghc_7_10_2#x86_64linux are larger then the equivalent files in the CentOS build, my own (Ubuntu) build, or hvr's ppa build. For example, comparing the size of `libHSfilepath-1.4.0.0 -KsGE6pHE5eZHSN90ZVax6A-ghc7.10.2.so`, after installation (i.e. after strip --strip-unneeded): ||= build =||= size (bytes) =|| || Debian || 128520 || || Centos || 124280 || || hvr ppa || 123112 || || my own || 123112 || Maybe the linker or strip utility on the Debian system where GHC releases are built should be upgraded. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10779 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10779: .so files in 64-bit Debian builds are 4% larger than they have to be -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: low | Milestone: Component: Build System | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by bgamari): I built these on an up-to-date Debian 7 container. The fact that the CentOS build is of similar size to the other builds suggests that the problem isn't one of toolchain version (as CentOS packages are as old as the hills). It would be nice to know which section(s) in the object file are the cause of this bloat. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10779#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10779: .so files in 64-bit Debian builds are 4% larger than they have to be -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: low | Milestone: Component: Build System | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by thomie): Below, filepath-ubuntu.so is from hvr's ppa build of ghc-7.10.2 (exact file mentioned above), filepath-debian.so is from the Debian download. {{{ $ size -A filepath-ubuntu.so filepath-debian.so filepath-ubuntu.so : section size addr .note.gnu.build-id 36 400 .gnu.hash 2564 440 .dynsym 8976 3008 .dynstr 26101 11984 .gnu.version 748 38086 .gnu.version_r 32 38840 .rela.dyn 12816 38872 .rela.plt 96 51688 .init 26 51784 .plt 80 51824 .text 60569 51904 .fini 9 112476 .rodata 278 112488 .eh_frame 4 112768 .init_array 8 2210792 .fini_array 8 2210800 .jcr 8 2210808 .dynamic 624 2210816 .got 400 2211440 .got.plt 56 2211840 .data 6624 2211896 .bss 8 2218520 Total 120071 filepath-debian.so : section size addr .note.gnu.build-id 36 400 .hash 2556 440 .gnu.hash 2564 3000 .dynsym 8976 5568 .dynstr 26101 14544 .gnu.version 748 40646 .gnu.version_r 32 41400 .rela.dyn 12816 41432 .rela.plt 72 54248 .init 14 54320 .plt 64 54336 .text 60596 54400 .fini 9 114996 .rodata 278 115008 .eh_frame_hdr 20 115288 .eh_frame 68 115312 .init_array 8 2215936 .fini_array 8 2215944 .jcr 8 2215952 .dynamic 640 2215960 .got 400 2216600 .got.plt 48 2217000 .data 6624 2217048 .bss 8 2223672 .comment 39 0 Total 122733 }}} filepath-debian.so contains additional `.hash`, `.eh_frame_hdr` and `.comment` sections. After removing those, the `size` utility reports a similar file size as it does for filepath-ubuntu.so: {{{ $ strip -R .hash -R .eh_frame_hdr -R .comment filepath-debian.so $ size filepath-debian.so text data bss dec hex filename 112394 7736 8 120138 1d54a filepath-debian.so }}} But the file did not get much smaller. I don't understand why not. {{{ $ wc -c filepath-debian.so 128456 filepath-debian.so }}} My system: {{{ $ ld --version # Binutils also provides `size` and `strip`. GNU ld (GNU Binutils for Ubuntu) 2.24 $ gcc --version gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10779#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10779: .so files in 64-bit Debian builds are 4% larger than they have to be -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: low | Milestone: Component: Build System | Version: 7.10.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by thomie): Note the following differences below (I don't know what any of this means): * filepath-debian.so contains the program header `GNU_EH_FRAME` instead of `GNU_RELRO`. * filepath-debian.so is missing the section to segment mapping for segment 05 (.init_array .fini_array .jcr .dynamic .got). {{{ $ readelf --program-headers filepath-ubuntu.so Elf file type is DYN (Shared object file) Entry point 0xcac0 There are 6 program headers, starting at offset 64 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flags Align LOAD 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x000000000001b884 0x000000000001b884 R E 200000 LOAD 0x000000000001bbe8 0x000000000021bbe8 0x000000000021bbe8 0x0000000000001e30 0x0000000000001e38 RW 200000 DYNAMIC 0x000000000001bc00 0x000000000021bc00 0x000000000021bc00 0x0000000000000270 0x0000000000000270 RW 8 NOTE 0x0000000000000190 0x0000000000000190 0x0000000000000190 0x0000000000000024 0x0000000000000024 R 4 GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 RW 10 GNU_RELRO 0x000000000001bbe8 0x000000000021bbe8 0x000000000021bbe8 0x0000000000000418 0x0000000000000418 R 1 Section to Segment mapping: Segment Sections... 00 .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame 01 .init_array .fini_array .jcr .dynamic .got .got.plt .data .bss 02 .dynamic 03 .note.gnu.build-id 04 05 .init_array .fini_array .jcr .dynamic .got }}} {{{ $ readelf --program-headers filepath-debian.so Elf file type is DYN (Shared object file) Entry point 0xd480 There are 6 program headers, starting at offset 64 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flags Align LOAD 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x000000000001c2b4 0x000000000001c2b4 R E 200000 LOAD 0x000000000001d000 0x000000000021d000 0x000000000021d000 0x0000000000001e38 0x0000000000001e40 RW 200000 DYNAMIC 0x000000000001d018 0x000000000021d018 0x000000000021d018 0x0000000000000280 0x0000000000000280 RW 8 NOTE 0x0000000000000190 0x0000000000000190 0x0000000000000190 0x0000000000000024 0x0000000000000024 R 4 GNU_EH_FRAME 0x000000000001c258 0x000000000001c258 0x000000000001c258 0x0000000000000014 0x0000000000000014 R 4 GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 RW 8 Section to Segment mapping: Segment Sections... 00 .note.gnu.build-id .hash .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame 01 .init_array .fini_array .jcr .dynamic .got .got.plt .data .bss 02 .dynamic 03 .note.gnu.build-id 04 .eh_frame_hdr 05 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10779#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10779: .so files in 64-bit Debian builds are 4% larger than they have to be -------------------------------------+------------------------------------- Reporter: thomie | Owner: Type: bug | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.2 (Linking) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by ezyang): * component: Build System => Compiler (Linking) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10779#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC