Subject: Re: Re: Re: Re: -2.0.1 makes bad binaries ?
To: Quentin Garnier <cube@cubidou.net>
From: Joel CARNAT <joel@carnat.net>
List: netbsd-users
Date: 01/25/2005 23:10:48
--3V7upXqbjpZ4EhLz
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: inline

On Tue, Jan 25 2005 - 22:53, Quentin Garnier wrote:
> On Tue, Jan 25, 2005 at 10:43:06PM +0100, Joel CARNAT wrote:
> > 
> >  anything bad in this process maybe ?
> 
> Not that I can see.
> 

 good news :)

> >  what's really weird is that it afects bash&pkgfind but not xmms, imapfilter, mutt, firefox-gtk2 and
> >  a lot of other things I rebuild after the 2.0 -> 2.0_BETA|2.0.1 update...
> 
> What does 'readelf -e /usr/pkg/bin/bash' say?  And 'readelf -d' for the
> same binary?
> 

 I've attached the results (hope they pass through the ML filters ?) as they are quite long.
 4 files :
faulty_readelf-d.txt	< 'readelf -d' on bash build 'PKG_OPTIONS.bash=multibyte static'
faulty_readelf-e.txt	< 'readelf -e' on bash build 'PKG_OPTIONS.bash=multibyte static'
working_readelf-d.txt	< 'readelf -d' on bash build 'PKG_OPTIONS.bash=multibyte'
working_readelf-e.txt	< 'readelf -e' on bash build 'PKG_OPTIONS.bash=multibyte'

the static version bugs, the dynamic version is ok.
there are no such options for pkgfind so I can't compare.
$ readelf -d /usr/pkg/bin/pkgfind
$ readelf -e /usr/pkg/bin/pkgfind
ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              REL (Relocatable file)
  Machine:                           Intel 80386
... need more for this one too ?

-- 
,- This mail runs ------.
`--------- NetBSD/i386 -'


--3V7upXqbjpZ4EhLz
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: attachment; filename="faulty_readelf-d.txt"

ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Intel 80386
  Version:                           0x1
  Entry point address:               0x8048858
  Start of program headers:          52 (bytes into file)
  Start of section headers:          883136 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         6
  Size of section headers:           40 (bytes)
  Number of section headers:         24
  Section header string table index: 23

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .interp           PROGBITS        080480f4 0000f4 000013 00   A  0   0  1
  [ 2] .note.netbsd.iden NOTE            08048108 000108 000018 00   A  0   0  4
  [ 3] .hash             HASH            08048120 000120 000158 04   A  4   0  4
  [ 4] .dynsym           DYNSYM          08048278 000278 0002f0 10   A  5   1  4
  [ 5] .dynstr           STRTAB          08048568 000568 0001af 00   A  0   0  1
  [ 6] .rel.dyn          REL             08048718 000718 000040 08   A  4   0  4
  [ 7] .rel.plt          REL             08048758 000758 000040 08   A  4   9  4
  [ 8] .init             PROGBITS        080487a0 0007a0 000026 00  AX  0   0 16
  [ 9] .plt              PROGBITS        080487c8 0007c8 000090 04  AX  0   0  4
  [10] .text             PROGBITS        08048858 000858 0a77dc 00  AX  0   0  4
  [11] .fini             PROGBITS        080f0040 0a8040 000026 00  AX  0   0 16
  [12] .rodata           PROGBITS        080f0080 0a8080 01ff6c 00   A  0   0 32
  [13] .data             PROGBITS        08110000 0c8000 0073e8 00  WA  0   0 32
  [14] .eh_frame         PROGBITS        081173e8 0cf3e8 000098 00  WA  0   0  4
  [15] .dynamic          DYNAMIC         08117480 0cf480 0000b8 08  WA  5   0  4
  [16] .ctors            PROGBITS        08117538 0cf538 000008 00  WA  0   0  4
  [17] .dtors            PROGBITS        08117540 0cf540 000008 00  WA  0   0  4
  [18] .jcr              PROGBITS        08117548 0cf548 000004 00  WA  0   0  4
  [19] .got              PROGBITS        0811754c 0cf54c 00004c 04  WA  0   0  4
  [20] .bss              NOBITS          081175a0 0cf5a0 00971c 00  WA  0   0 32
  [21] .comment          PROGBITS        00000000 0cf5a0 004380 00      0   0  1
  [22] .ident            PROGBITS        00000000 0d3920 003ff8 00      0   0  1
  [23] .shstrtab         STRTAB          00000000 0d7918 0000a7 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x08048034 0x08048034 0x000c0 0x000c0 R E 0x4
  INTERP         0x0000f4 0x080480f4 0x080480f4 0x00013 0x00013 R   0x1
      [Requesting program interpreter: /usr/lib/libc.so.1]
  LOAD           0x000000 0x08048000 0x08048000 0xc7fec 0xc7fec R E 0x1000
  LOAD           0x0c8000 0x08110000 0x08110000 0x07598 0x10cbc RW  0x1000
  DYNAMIC        0x0cf480 0x08117480 0x08117480 0x000b8 0x000b8 RW  0x4
  NOTE           0x000108 0x08048108 0x08048108 0x00018 0x00018 R   0x4

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .note.netbsd.ident .hash .dynsym .dynstr .rel.dyn .rel.plt .init .plt .text .fini .rodata 
   03     .data .eh_frame .dynamic .ctors .dtors .jcr .got .bss 
   04     .dynamic 
   05     .note.netbsd.ident 

--3V7upXqbjpZ4EhLz
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: attachment; filename="faulty_readelf-e.txt"


Dynamic segment at offset 0xcf480 contains 18 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libintl.so.0]
 0x0000000f (RPATH)                      Library rpath: [/usr/pkg/lib]
 0x0000000c (INIT)                       0x80487a0
 0x0000000d (FINI)                       0x80f0040
 0x00000004 (HASH)                       0x8048120
 0x00000005 (STRTAB)                     0x8048568
 0x00000006 (SYMTAB)                     0x8048278
 0x0000000a (STRSZ)                      431 (bytes)
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000015 (DEBUG)                      0x0
 0x00000003 (PLTGOT)                     0x811754c
 0x00000002 (PLTRELSZ)                   64 (bytes)
 0x00000014 (PLTREL)                     REL
 0x00000017 (JMPREL)                     0x8048758
 0x00000011 (REL)                        0x8048718
 0x00000012 (RELSZ)                      64 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x00000000 (NULL)                       0x0

--3V7upXqbjpZ4EhLz
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: attachment; filename="working_readelf-d.txt"


Dynamic segment at offset 0x8515c contains 20 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libintl.so.0]
 0x00000001 (NEEDED)                     Shared library: [libtermcap.so.0]
 0x00000001 (NEEDED)                     Shared library: [libc.so.12]
 0x0000000f (RPATH)                      Library rpath: [/usr/pkg/lib]
 0x0000000c (INIT)                       0x804a0a0
 0x0000000d (FINI)                       0x80b0060
 0x00000004 (HASH)                       0x8048124
 0x00000005 (STRTAB)                     0x8049430
 0x00000006 (SYMTAB)                     0x8048770
 0x0000000a (STRSZ)                      1689 (bytes)
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000015 (DEBUG)                      0x0
 0x00000003 (PLTGOT)                     0x80ce238
 0x00000002 (PLTRELSZ)                   1384 (bytes)
 0x00000014 (PLTREL)                     REL
 0x00000017 (JMPREL)                     0x8049b34
 0x00000011 (REL)                        0x8049acc
 0x00000012 (RELSZ)                      104 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x00000000 (NULL)                       0x0

--3V7upXqbjpZ4EhLz
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: attachment; filename="working_readelf-e.txt"

ELF Header:
  Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF32
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Intel 80386
  Version:                           0x1
  Entry point address:               0x804aba8
  Start of program headers:          52 (bytes into file)
  Start of section headers:          552504 (bytes into file)
  Flags:                             0x0
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         6
  Size of section headers:           40 (bytes)
  Number of section headers:         24
  Section header string table index: 23

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
  [ 1] .interp           PROGBITS        080480f4 0000f4 000017 00   A  0   0  1
  [ 2] .note.netbsd.iden NOTE            0804810c 00010c 000018 00   A  0   0  4
  [ 3] .hash             HASH            08048124 000124 00064c 04   A  4   0  4
  [ 4] .dynsym           DYNSYM          08048770 000770 000cc0 10   A  5   1  4
  [ 5] .dynstr           STRTAB          08049430 001430 000699 00   A  0   0  1
  [ 6] .rel.dyn          REL             08049acc 001acc 000068 08   A  4   0  4
  [ 7] .rel.plt          REL             08049b34 001b34 000568 08   A  4   9  4
  [ 8] .init             PROGBITS        0804a0a0 0020a0 000026 00  AX  0   0 16
  [ 9] .plt              PROGBITS        0804a0c8 0020c8 000ae0 04  AX  0   0  4
  [10] .text             PROGBITS        0804aba8 002ba8 0654b8 00  AX  0   0  4
  [11] .fini             PROGBITS        080b0060 068060 000026 00  AX  0   0 16
  [12] .rodata           PROGBITS        080b00a0 0680a0 017930 00   A  0   0 32
  [13] .data             PROGBITS        080c89e0 07f9e0 0056e4 00  WA  0   0 32
  [14] .eh_frame         PROGBITS        080ce0c4 0850c4 000098 00  WA  0   0  4
  [15] .dynamic          DYNAMIC         080ce15c 08515c 0000c8 08  WA  5   0  4
  [16] .ctors            PROGBITS        080ce224 085224 000008 00  WA  0   0  4
  [17] .dtors            PROGBITS        080ce22c 08522c 000008 00  WA  0   0  4
  [18] .jcr              PROGBITS        080ce234 085234 000004 00  WA  0   0  4
  [19] .got              PROGBITS        080ce238 085238 0002e0 04  WA  0   0  4
  [20] .bss              NOBITS          080ce520 085520 0028c4 00  WA  0   0 32
  [21] .comment          PROGBITS        00000000 085520 001838 00      0   0  1
  [22] .ident            PROGBITS        00000000 086d58 000036 00      0   0  1
  [23] .shstrtab         STRTAB          00000000 086d8e 0000a7 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x08048034 0x08048034 0x000c0 0x000c0 R E 0x4
  INTERP         0x0000f4 0x080480f4 0x080480f4 0x00017 0x00017 R   0x1
      [Requesting program interpreter: /usr/libexec/ld.elf_so]
  LOAD           0x000000 0x08048000 0x08048000 0x7f9d0 0x7f9d0 R E 0x1000
  LOAD           0x07f9e0 0x080c89e0 0x080c89e0 0x05b38 0x08404 RW  0x1000
  DYNAMIC        0x08515c 0x080ce15c 0x080ce15c 0x000c8 0x000c8 RW  0x4
  NOTE           0x00010c 0x0804810c 0x0804810c 0x00018 0x00018 R   0x4

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .note.netbsd.ident .hash .dynsym .dynstr .rel.dyn .rel.plt .init .plt .text .fini .rodata 
   03     .data .eh_frame .dynamic .ctors .dtors .jcr .got .bss 
   04     .dynamic 
   05     .note.netbsd.ident 

--3V7upXqbjpZ4EhLz--