bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/16056] New: armv7-unknown-linux-gnueabi-objcopy -R .gnu_de


From: mac at mcrowe dot com
Subject: [Bug binutils/16056] New: armv7-unknown-linux-gnueabi-objcopy -R .gnu_debuglink corrupts program header
Date: Wed, 16 Oct 2013 16:43:32 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=16056

            Bug ID: 16056
           Summary: armv7-unknown-linux-gnueabi-objcopy -R .gnu_debuglink
                    corrupts program header
           Product: binutils
           Version: 2.25 (HEAD)
            Status: NEW
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: mac at mcrowe dot com

Created attachment 7237
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7237&action=edit
Gzipped version of the affected object file

Runing "objcopy -R .gnu_debuglink infile
outfile" against the attached infile yields lots of scary messages and
the program header ends up corrupted.

I'm configuring binutils for armv7-unknown-linux-gnueabi. The "infile" in the
following example is attached.

$ readelf -l infile

Elf file type is DYN (Shared object file)
Entry point 0x436f0000
There are 9 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x436f0034 0x436f0034 0x00120 0x00120 R   0x4
  INTERP         0x000154 0x436f0154 0x436f0154 0x00013 0x00013 R   0x1
      [Requesting program interpreter: /lib/ld-linux.so.3]
  LOAD           0x000000 0x436f0000 0x436f0000 0xc2d0c 0xc2d0c R E 0x1000
  LOAD           0x0c3000 0x437b3000 0x437b3000 0x03954 0x03a1d RW  0x1000
  DYNAMIC        0x0c3000 0x437b3000 0x437b3000 0x00128 0x00128 RW  0x4
  NOTE           0x000168 0x436f0168 0x436f0168 0x00024 0x00024 R   0x4
  GNU_EH_FRAME   0x0c2d04 0x437b2d04 0x437b2d04 0x00008 0x00008 R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0
  EXIDX          0x0a94d8 0x437994d8 0x437994d8 0x047f0 0x047f0 R   0x4

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .note.gnu.build-id .dynsym .dynstr .gnu.hash .gnu.version
.gnu.version_d .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini
.ARM.extab .ARM.exidx .rodata .eh_frame .eh_frame_hdr 
   03     .dynamic .data .init_array .fini_array .jcr .tm_clone_table
.data.rel.ro.local .data.rel.ro .got .bss 
   04     .dynamic 
   05     .note.gnu.build-id 
   06     .eh_frame_hdr 
   07     
   08     .ARM.exidx 

$ binutils/objcopy -R .gnu_debuglink infile outfile
BFD: outfile: section `.dynamic' can't be allocated in segment 3
LOAD: .dynamic .data .init_array .fini_array .jcr .tm_clone_table
.data.rel.ro.local .data.rel.ro .got .bss
BFD: outfile: section `.data' can't be allocated in segment 3
LOAD: .dynamic .data .init_array .fini_array .jcr .tm_clone_table
.data.rel.ro.local .data.rel.ro .got .bss
BFD: outfile: section `.init_array' can't be allocated in segment 3
LOAD: .dynamic .data .init_array .fini_array .jcr .tm_clone_table
.data.rel.ro.local .data.rel.ro .got .bss
BFD: outfile: section `.fini_array' can't be allocated in segment 3
LOAD: .dynamic .data .init_array .fini_array .jcr .tm_clone_table
.data.rel.ro.local .data.rel.ro .got .bss
BFD: outfile: section `.jcr' can't be allocated in segment 3
LOAD: .dynamic .data .init_array .fini_array .jcr .tm_clone_table
.data.rel.ro.local .data.rel.ro .got .bss
BFD: outfile: section `.tm_clone_table' can't be allocated in segment 3
LOAD: .dynamic .data .init_array .fini_array .jcr .tm_clone_table
.data.rel.ro.local .data.rel.ro .got .bss
BFD: outfile: section `.data.rel.ro.local' can't be allocated in segment 3
LOAD: .dynamic .data .init_array .fini_array .jcr .tm_clone_table
.data.rel.ro.local .data.rel.ro .got .bss
BFD: outfile: section `.data.rel.ro' can't be allocated in segment 3
LOAD: .dynamic .data .init_array .fini_array .jcr .tm_clone_table
.data.rel.ro.local .data.rel.ro .got .bss
BFD: outfile: section `.got' can't be allocated in segment 3
LOAD: .dynamic .data .init_array .fini_array .jcr .tm_clone_table
.data.rel.ro.local .data.rel.ro .got .bss
BFD: outfile: section `.bss' can't be allocated in segment 3
LOAD: .dynamic .data .init_array .fini_array .jcr .tm_clone_table
.data.rel.ro.local .data.rel.ro .got .bss

$ readelf -l outfile

Elf file type is DYN (Shared object file)
Entry point 0x436f0000
There are 9 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x436f0034 0x436f0034 0x00120 0x00120 R   0x4
  INTERP         0x000154 0x436f0154 0x436f0154 0x00013 0x00013 R   0x1
      [Requesting program interpreter: /lib/ld-linux.so.3]
  LOAD           0x000000 0x436f0000 0x436f0000 0xc2d0c 0xc2d0c R E 0x1000
  LOAD           0x0c3000 0x86f66000 0x437b3000 0x03954 0x03a1d RW  0x1000
  DYNAMIC        0x0c3000 0x437b3000 0x437b3000 0x00128 0x00128 RW  0x4
  NOTE           0x000168 0x436f0168 0x436f0168 0x00024 0x00024 R   0x4
  GNU_EH_FRAME   0x0c2d04 0x437b2d04 0x437b2d04 0x00008 0x00008 R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0
  EXIDX          0x0a94d8 0x437994d8 0x437994d8 0x047f0 0x047f0 R   0x4

 Section to Segment mapping:
  Segment Sections...
   00     
   01     .interp 
   02     .interp .note.gnu.build-id .dynsym .dynstr .gnu.hash .gnu.version
.gnu.version_d .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini
.ARM.extab .ARM.exidx .rodata .eh_frame .eh_frame_hdr 
   03     
   04     .dynamic 
   05     .note.gnu.build-id 
   06     .eh_frame_hdr 
   07     
   08     .ARM.exidx 

(Notice that the VirtAddr of the fourth program header is now incorrect so the
third segment no longer has any sections associated with it.)

I can reproduce this behaviour in the current HEAD version of
binutils. Much older versions of binutils do not emit the messages nor
do they corrupt the program header. Git bisect tells me that the
corruption started happening in
https://sourceware.org/git/?p=binutils.git;a=commit;h=fe58de404e6f2d451880714526c8ca3b8d733187
.

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]