Strip broke for me in 2.15...

David Daney ddaney@avtrex.com
Thu May 20 01:37:00 GMT 2004
I am running on mipsel-linux w/ glibc-2.2.5.

I am a bit fuzzy on the terminology, but I am calling the things listed 
under Program Headers from readelf -e "Program Headers" I apologize if 
there is a better term.

I have a program that was compiled and linked with 
gcc-3.3.1/binutils-2.14.  It runs fine.  I recently upgraded to binutils 
2.15 to correct problems in the linker unrelated to stripping.

My problem is that stripping the executable with strip-2.15 creates an 
unrunnable image.  But strip-2.14 create a good image.

I am theorizing that the problem is that strip-2.15 that the LOAD 
program headers are aligned to the alignment specified for the first 
section in the header rather than the alignment specified in the 
header.  This causes ld.so to map that header incorrectly.

I see two possibilities:

1) ld-2.2.5.so is bug free and strip-2.15 is generating an illegally 
formed executable image.

2) There are no particular alignment requirements for Program headers 
within an executable image, and ld-2.2.5.so does not handle some cases 
properly.

Q: Which is it?


Here is the output from readelf -e from the same program stripped with 
strip-2.14 and then strip-2.15.  Note that the section sizes are all the 
same and the program header sizes are the same.  The only difference is 
that the file offsets are aligned differently.



[daney@dl smallroot]$ mipsel-linux-readelf -e xilleon_remote
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:                           MIPS R3000
  Version:                           0x1
  Entry point address:               0x4234c0
  Start of program headers:          52 (bytes into file)
  Start of section headers:          1790576 (bytes into file)
  Flags:                             0x50000007, noreorder, pic, cpic, 
mips32
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         8
  Size of section headers:           40 (bytes)
  Number of section headers:         31
  Section header string table index: 30
 
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        00400134 000134 00000d 00   A  
0   0  1
  [ 2] .note.ABI-tag     NOTE            00400150 000150 000020 00   A  
0   0 16
  [ 3] .reginfo          MIPS_REGINFO    00400170 000170 000018 18   A  
0   0  4
  [ 4] .dynamic          DYNAMIC         00400188 000188 000150 08   A  
7   0  4
  [ 5] .hash             HASH            004002d8 0002d8 0050fc 04   A  
6   0  4
  [ 6] .dynsym           DYNSYM          004053d4 0053d4 00c380 10   A  
7   1  4
  [ 7] .dynstr           STRTAB          00411754 011754 00ff63 00   A  
0   0  1
  [ 8] .gnu.version      VERSYM          004216b8 0216b8 001870 02   A  
6   0  2
  [ 9] .gnu.version_r    VERNEED         00422f28 022f28 0000c0 00   A  
7   4  4
  [10] .init             PROGBITS        00423410 023410 0000a4 00  AX  
0   0  4
  [11] .text             PROGBITS        004234c0 0234c0 124320 00  AX  
0   0 16
  [12] .fini             PROGBITS        005477e0 1477e0 000058 00  AX  
0   0  4
  [13] .rodata           PROGBITS        00547840 147840 02d080 00   A  
0   0 16
  [14] .eh_frame_hdr     PROGBITS        005748c0 1748c0 002cc4 00   A  
0   0  4
  [15] .data             PROGBITS        10000000 178000 009d20 00  WA  
0   0 16
  [16] .rld_map          PROGBITS        10009d20 181d20 000004 00  WA  
0   0  4
  [17] .eh_frame         PROGBITS        10009d24 181d24 00dff8 00   A  
0   0  4
  [18] .gcc_except_table PROGBITS        10017d1c 18fd1c 0048d7 00   A  
0   0  4
  [19] .ctors            PROGBITS        1001c5f4 1945f4 000010 00  WA  
0   0  4
  [20] .dtors            PROGBITS        1001c604 194604 000008 00  WA  
0   0  4
  [21] .jcr              PROGBITS        1001c60c 19460c 000004 00  WA  
0   0  4
  [22] .got              PROGBITS        1001c610 194610 003108 04 WAp  
0   0 16
  [23] .sbss             NOBITS          1001f718 197718 000000 00 WAp  
0   0  1
  [24] .bss              NOBITS          1001f720 197720 001740 00  WA  
0   0 16
  [25] .comment          PROGBITS        00000000 197720 00068a 00      
0   0  1
  [26] .pdr              PROGBITS        00000000 197dac 01d380 00      
0   0  4
  [27] .note             NOTE            00000000 1b512c 00003c 00      
0   0  1
  [28] .rel.dyn          REL             00422fe8 022fe8 000428 08   A  
6   0  4
  [29] .mdebug.abi32     PROGBITS        00000000 1b5168 000000 00      
0   0  1
  [30] .shstrtab         STRTAB          00000000 1b5168 000106 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 0x00400034 0x00400034 0x00100 0x00100 R E 0x4
  INTERP         0x000134 0x00400134 0x00400134 0x0000d 0x0000d R   0x1
      [Requesting program interpreter: /lib/ld.so.1]
  REGINFO        0x000170 0x00400170 0x00400170 0x00018 0x00018 R   0x4
  LOAD           0x000000 0x00400000 0x00400000 0x177584 0x177584 R E 0x1000
  LOAD           0x178000 0x10000000 0x10000000 0x1f718 0x20e60 RW  0x1000
  DYNAMIC        0x000188 0x00400188 0x00400188 0x2152f 0x2152f RWE 0x4
  NOTE           0x000150 0x00400150 0x00400150 0x00020 0x00020 R   0x10
  GNU_EH_FRAME   0x1748c0 0x005748c0 0x005748c0 0x02cc4 0x02cc4 R   0x4
 
 Section to Segment mapping:
  Segment Sections...
   00
   01     .interp
   02     .reginfo
   03     .interp .note.ABI-tag .reginfo .dynamic .hash .dynsym .dynstr 
.gnu.version .gnu.version_r .init .text .fini .rodata .eh_frame_hdr .rel.dyn
   04     .data .rld_map .eh_frame .gcc_except_table .ctors .dtors .jcr 
.got .bss
   05     .dynamic .hash .dynsym .dynstr
   06     .note.ABI-tag
   07     .eh_frame_hdr


[root@dl smallroot]# mipsel-linux-readelf -e root/avtrex/demo/xilleon_remote
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:                           MIPS R3000
  Version:                           0x1
  Entry point address:               0x4234c0
  Start of program headers:          52 (bytes into file)
  Start of section headers:          1787904 (bytes into file)
  Flags:                             0x50000007, noreorder, pic, cpic, 
mips32
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         8
  Size of section headers:           40 (bytes)
  Number of section headers:         31
  Section header string table index: 30
 
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        00400134 000134 00000d 00   A  
0   0  1
  [ 2] .note.ABI-tag     NOTE            00400150 000150 000020 00   A  
0   0 16
  [ 3] .reginfo          MIPS_REGINFO    00400170 000170 000018 18   A  
0   0  4
  [ 4] .dynamic          DYNAMIC         00400188 000188 000150 08   A  
7   0  4
  [ 5] .hash             HASH            004002d8 0002d8 0050fc 04   A  
6   0  4
  [ 6] .dynsym           DYNSYM          004053d4 0053d4 00c380 10   A  
7   1  4
  [ 7] .dynstr           STRTAB          00411754 011754 00ff63 00   A  
0   0  1
  [ 8] .gnu.version      VERSYM          004216b8 0216b8 001870 02   A  
6   0  2
  [ 9] .gnu.version_r    VERNEED         00422f28 022f28 0000c0 00   A  
7   4  4
  [10] .init             PROGBITS        00423410 023410 0000a4 00  AX  
0   0  4
  [11] .text             PROGBITS        004234c0 0234c0 124320 00  AX  
0   0 16
  [12] .fini             PROGBITS        005477e0 1477e0 000058 00  AX  
0   0  4
  [13] .rodata           PROGBITS        00547840 147840 02d080 00   A  
0   0 16
  [14] .eh_frame_hdr     PROGBITS        005748c0 1748c0 002cc4 00   A  
0   0  4
  [15] .data             PROGBITS        10000000 177590 009d20 00  WA  
0   0 16
  [16] .rld_map          PROGBITS        10009d20 1812b0 000004 00  WA  
0   0  4
  [17] .eh_frame         PROGBITS        10009d24 1812b4 00dff8 00   A  
0   0  4
  [18] .gcc_except_table PROGBITS        10017d1c 18f2ac 0048d7 00   A  
0   0  4
  [19] .ctors            PROGBITS        1001c5f4 193b84 000010 00  WA  
0   0  4
  [20] .dtors            PROGBITS        1001c604 193b94 000008 00  WA  
0   0  4
  [21] .jcr              PROGBITS        1001c60c 193b9c 000004 00  WA  
0   0  4
  [22] .got              PROGBITS        1001c610 193ba0 003108 04 WAp  
0   0 16
  [23] .sbss             NOBITS          1001f718 196ca8 000000 00 WAp  
0   0  1
  [24] .bss              NOBITS          1001f720 196cb0 001740 00  WA  
0   0 16
  [25] .comment          PROGBITS        00000000 196cb0 00068a 00      
0   0  1
  [26] .pdr              PROGBITS        00000000 19733c 01d380 00      
0   0  4
  [27] .note             NOTE            00000000 1b46bc 00003c 00      
0   0  1
  [28] .rel.dyn          REL             00422fe8 022fe8 000428 08   A  
6   0  4
  [29] .mdebug.abi32     PROGBITS        00000000 1b46f8 000000 00      
0   0  1
  [30] .shstrtab         STRTAB          00000000 1b46f8 000106 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 0x00400034 0x00400034 0x00100 0x00100 R E 0x4
  INTERP         0x000134 0x00400134 0x00400134 0x0000d 0x0000d R   0x1
      [Requesting program interpreter: /lib/ld.so.1]
  REGINFO        0x000170 0x00400170 0x00400170 0x00018 0x00018 R   0x4
  LOAD           0x000000 0x00400000 0x00400000 0x177584 0x177584 R E 0x10
  LOAD           0x177590 0x10000000 0x10000000 0x1f718 0x20e60 RW  0x10
  DYNAMIC        0x000188 0x00400188 0x00400188 0x2152f 0x2152f RWE 0x4
  NOTE           0x000150 0x00400150 0x00400150 0x00020 0x00020 R   0x10
  GNU_EH_FRAME   0x1748c0 0x005748c0 0x005748c0 0x02cc4 0x02cc4 R   0x4
 
 Section to Segment mapping:
  Segment Sections...
   00
   01     .interp
   02     .reginfo
   03     .interp .note.ABI-tag .reginfo .dynamic .hash .dynsym .dynstr 
.gnu.version .gnu.version_r .init .text .fini .rodata .eh_frame_hdr .rel.dyn
   04     .data .rld_map .eh_frame .gcc_except_table .ctors .dtors .jcr 
.got .bss
   05     .dynamic .hash .dynsym .dynstr
   06     .note.ABI-tag
   07     .eh_frame_hdr




More information about the Binutils mailing list