Bug 23388 - [2.31 Regression] produces large 64-bit multilib libraries on i386
Summary: [2.31 Regression] produces large 64-bit multilib libraries on i386
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.31
: P2 normal
Target Milestone: 2.31
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-09 10:32 UTC by Matthias Klose
Modified: 2018-07-09 16:53 UTC (History)
2 users (show)

See Also:
Host: i686-linux-gnu
Target: x86_64-linux-gnu, x86_64-linux-gnux32
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2018-07-09 10:32:01 UTC
[ forwarded from https://bugs.debian.org/903376 ]

This is seen at least when building x86_64 and x86_64-gnux32 libraries on i686-linux-gnu:

> Package: libc6-amd64
> Version: 2.27-4
> Severity: important
>
> On i386, libc6-amd64 and libc6-x32 install more than one gigabyte each:
>
> ,----
> | $ apt-cache show libc6-amd64 libc6-x32 | grep Installed-Size
> | Installed-Size: 1143839
> | Installed-Size: 1143407
> `----
>
> Looking at /lib64, all the .so files from libc6-amd64 are over four
> megs, although file(1) reports them as stripped.

Looks like that is a binutils bug, I see the same problem when building
the ncurses multilib packages.  Apparently this started when I upgraded
binutils from 2.30-22 to 2.30.90.20180627-1.

These libraries have a large number of null bytes in them, their
occupied space is reduced considerably in a sparse copy:
Comment 1 Nick Clifton 2018-07-09 12:30:47 UTC
Hi Matthias,

  Is this because -z separate-code-page is now enabled by default ?  (For
  Linux binaries).  

  If so, I am not sure if this should be considered a real problem, since
  it:
    a) helps improve security
    b) can be disabled from the linker command line
    c) the default can be changed when the linker is configured
    d) on sparse filesystems the extra nul bytes do not occupy any real space.

Cheers
  Nick
Comment 2 Matthias Klose 2018-07-09 12:45:57 UTC
I'm wondering why this is only seen for the non-default multilibs on i686-linux-gnu.
Comment 3 H.J. Lu 2018-07-09 12:55:34 UTC
I can't reproduce it.  With glibc 2.28, I got

[hjl@gnu-skx-1 tools-build]$ du -sh glibc/release glibc-x32/release glibc-32bit/release
141M	glibc/release
120M	glibc-x32/release
114M	glibc-32bit/release
[hjl@gnu-skx-1 tools-build]$ 

with debug info.  Please show the output of "readelf -lW" on x86-64 libc.so.
Comment 4 H.J. Lu 2018-07-09 13:35:33 UTC
I am working on a fix.
Comment 5 Matthias Klose 2018-07-09 13:38:35 UTC
on x86_64-linux-gnu:

$ ls -l /lib/x86_64-linux-gnu/libc-2.27.so 
-rwxr-xr-x 1 root root 1808440 Jul  7 16:34 /lib/x86_64-linux-gnu/libc-2.27.so

on i686-linux-gnu (x86_64-linux-gnu multilib)
$ ls -l /lib64/libc-2.27.so
-rwxr-xr-x 1 root root 4528184 Jul  7 16:34 /lib64/libc-2.27.so

$ readelf -lW /lib/x86_64-linux-gnu/libc-2.27.so 

Elf file type is DYN (Shared object file)
Entry point 0x22c30
There are 12 program headers, starting at offset 64

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
  PHDR           0x000040 0x0000000000000040 0x0000000000000040 0x0002a0 0x0002a0 R   0x8
  INTERP         0x189170 0x0000000000189170 0x0000000000189170 0x00001c 0x00001c R   0x10
      [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
  LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x021038 0x021038 R   0x1000
  LOAD           0x022000 0x0000000000022000 0x0000000000022000 0x1451c2 0x1451c2 R E 0x1000
  LOAD           0x168000 0x0000000000168000 0x0000000000168000 0x04a2b0 0x04a2b0 R   0x1000
  LOAD           0x1b2618 0x00000000001b3618 0x00000000001b3618 0x005248 0x0094c8 RW  0x1000
  DYNAMIC        0x1b5b80 0x00000000001b6b80 0x00000000001b6b80 0x0001e0 0x0001e0 RW  0x8
  NOTE           0x0002e0 0x00000000000002e0 0x00000000000002e0 0x000044 0x000044 R   0x4
  TLS            0x1b2618 0x00000000001b3618 0x00000000001b3618 0x000010 0x000090 R   0x8
  GNU_EH_FRAME   0x18918c 0x000000000018918c 0x000000000018918c 0x005ed4 0x005ed4 R   0x4
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW  0x10
  GNU_RELRO      0x1b2618 0x00000000001b3618 0x00000000001b3618 0x0039e8 0x0039e8 R   0x1

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .note.gnu.build-id .note.ABI-tag .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_d .gnu.version_r .rela.dyn .rela.plt 
   03     .plt .plt.got .text __libc_freeres_fn __libc_thread_freeres_fn 
   04     .rodata .interp .eh_frame_hdr .eh_frame .gcc_except_table .hash 
   05     .tdata .init_array __libc_subfreeres __libc_atexit __libc_thread_subfreeres __libc_IO_vtables .data.rel.ro .dynamic .got .got.plt .data .bss 
   06     .dynamic 
   07     .note.gnu.build-id .note.ABI-tag 
   08     .tdata .tbss 
   09     .eh_frame_hdr 
   10     
   11     .tdata .init_array __libc_subfreeres __libc_atexit __libc_thread_subfreeres __libc_IO_vtables .data.rel.ro .dynamic .got 

$ readelf -lW /lib64/libc-2.27.so 

Elf file type is DYN (Shared object file)
Entry point 0x200c30
There are 12 program headers, starting at offset 64

Program Headers:
  Type           Offset   VirtAddr           PhysAddr           FileSiz  MemSiz   Flg Align
  PHDR           0x000040 0x0000000000000040 0x0000000000000040 0x0002a0 0x0002a0 R   0x8
  INTERP         0x421160 0x0000000000421160 0x0000000000421160 0x00001c 0x00001c R   0x10
      [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
  LOAD           0x000000 0x0000000000000000 0x0000000000000000 0x021038 0x021038 R   0x200000
  LOAD           0x200000 0x0000000000200000 0x0000000000200000 0x1451b2 0x1451b2 R E 0x200000
  LOAD           0x400000 0x0000000000400000 0x0000000000400000 0x04a2a0 0x04a2a0 R   0x200000
  LOAD           0x44a618 0x000000000064a618 0x000000000064a618 0x005248 0x0094c8 RW  0x200000
  DYNAMIC        0x44db80 0x000000000064db80 0x000000000064db80 0x0001e0 0x0001e0 RW  0x8
  NOTE           0x0002e0 0x00000000000002e0 0x00000000000002e0 0x000044 0x000044 R   0x4
  TLS            0x44a618 0x000000000064a618 0x000000000064a618 0x000010 0x000090 R   0x8
  GNU_EH_FRAME   0x42117c 0x000000000042117c 0x000000000042117c 0x005ed4 0x005ed4 R   0x4
  GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW  0x10
  GNU_RELRO      0x44a618 0x000000000064a618 0x000000000064a618 0x0039e8 0x0039e8 R   0x1

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .note.gnu.build-id .note.ABI-tag .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_d .gnu.version_r .rela.dyn .rela.plt 
   03     .plt .plt.got .text __libc_freeres_fn __libc_thread_freeres_fn 
   04     .rodata .interp .eh_frame_hdr .eh_frame .gcc_except_table .hash 
   05     .tdata .init_array __libc_subfreeres __libc_atexit __libc_thread_subfreeres __libc_IO_vtables .data.rel.ro .dynamic .got .got.plt .data .bss 
   06     .dynamic 
   07     .note.gnu.build-id .note.ABI-tag 
   08     .tdata .tbss 
   09     .eh_frame_hdr 
   10     
   11     .tdata .init_array __libc_subfreeres __libc_atexit __libc_thread_subfreeres __libc_IO_vtables .data.rel.ro .dynamic .got
Comment 6 Sourceware Commits 2018-07-09 13:54:22 UTC
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=872899f1efeda1e93ed569d322c6b2ee85ce885c

commit 872899f1efeda1e93ed569d322c6b2ee85ce885c
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Jul 9 06:51:17 2018 -0700

    bfd: Use changequote for "i[3-7]86-*-linux-*"
    
    Use changequote to match "i[3-7]86-*-linux-*", instead of
    "i3-786-*-linux-*".
    
    	PR ld/23388
    	* configure.ac: Use changequote for "i[3-7]86-*-linux-*".
    	* configure: Regenerated.
Comment 7 Sourceware Commits 2018-07-09 16:20:58 UTC
The binutils-2_31-branch branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fa1b3193c52c319469f688b863d90274d3db4ccf

commit fa1b3193c52c319469f688b863d90274d3db4ccf
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Jul 9 06:51:17 2018 -0700

    bfd: Use changequote for "i[3-7]86-*-linux-*"
    
    Use changequote to match "i[3-7]86-*-linux-*", instead of
    "i3-786-*-linux-*".
    
    	PR ld/23388
    	* configure.ac: Use changequote for "i[3-7]86-*-linux-*".
    	* configure: Regenerated.
    
    (cherry picked from commit 872899f1efeda1e93ed569d322c6b2ee85ce885c)
Comment 8 H.J. Lu 2018-07-09 16:50:16 UTC
Fixed for 2.31.