Binutils objcopy bug (was Re: rebase segfault)

marco atzeri marco.atzeri@gmail.com
Fri Jan 25 12:34:00 GMT 2013


On 1/24/2013 11:00 AM, Corinna Vinschen wrote:

> I already explained why:  The SEGV happens during relocation.
> The file header has been changed already.  If you call the
> same rebase, it will try to rebase the file to the same new
> address.  If current file base address == requested file base
> address, rebase will return without performing any action.
>

Hi Corinna,
I would like your opinion on this .reloc strange issue of
dict_snowball, as I have the impression I found the root cause.

The relocation table looks the same for the the build, strip and
with debug link dll's

$ objdump -p dict_snowball-strip.dll |grep Virtual |wc -l
130

$ objdump -p dict_snowball-build.dll |grep Virtual |wc -l
130

$ objdump -p dict_snowball-debug.dll |grep Virtual |wc -l
130

but some some sections does not exist anymore after the strip,
so the .reloc table should be smaller after strip.

$ objdump -p dict_snowball-build.dll |grep Virtual
Virtual Address: 00001000 Chunk size 72 (0x48) Number of fixups 32

   [cut]

Virtual Address: 0002e000 Chunk size 340 (0x154) Number of fixups 166

   [this area points to the .debug_* sections,
   starting with .debug_info, up to .debug_loc]

Virtual Address: 0003b000 Chunk size 96 (0x60) Number of fixups 44
Virtual Address: 0003f000 Chunk size 12 (0xc) Number of fixups 2
   ....
Virtual Address: 00098000 Chunk size 20 (0x14) Number of fixups 6
Virtual Address: 0009a000 Chunk size 12 (0xc) Number of fixups 2


$ objdump -h dict_snowball-build.dll

dict_snowball-build.dll:     file format pei-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
   0 .text         00016808  67ec1000  67ec1000  00000400  2**4
                   CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA
   1 .data         00017180  67ed8000  67ed8000  00016e00  2**5
                   CONTENTS, ALLOC, LOAD, DATA
   2 .bss          000000f8  67ef0000  67ef0000  00000000  2**5
                   ALLOC
   3 .edata        00000fe0  67ef1000  67ef1000  0002e000  2**2
                   CONTENTS, ALLOC, LOAD, READONLY, DATA
   4 .idata        000003e0  67ef2000  67ef2000  0002f000  2**2
                   CONTENTS, ALLOC, LOAD, DATA
   5 .reloc        0000765c  67ef3000  67ef3000  0002f400  2**2
                   CONTENTS, ALLOC, LOAD, READONLY, DATA
   6 .debug_aranges 00000560  67efb000  67efb000  00036c00  2**0
                   CONTENTS, READONLY, DEBUGGING
   7 .debug_pubnames 00001112  67efc000  67efc000  00037200  2**0
                   CONTENTS, READONLY, DEBUGGING
   8 .debug_pubtypes 00000f49  67efe000  67efe000  00038400  2**0
                   CONTENTS, READONLY, DEBUGGING
   9 .debug_info   00048851  67eff000  67eff000  00039400  2**0
                   CONTENTS, READONLY, DEBUGGING
  10 .debug_abbrev 000050a3  67f48000  67f48000  00081e00  2**0
                   CONTENTS, READONLY, DEBUGGING
  11 .debug_line   000078a3  67f4e000  67f4e000  00087000  2**0
                   CONTENTS, READONLY, DEBUGGING
  12 .debug_frame  00002114  67f56000  67f56000  0008ea00  2**2
                   CONTENTS, READONLY, DEBUGGING
  13 .debug_str    00000664  67f59000  67f59000  00090c00  2**0
                   CONTENTS, READONLY, DEBUGGING
  14 .debug_loc    000170a4  67f5a000  67f5a000  00091400  2**0
                   CONTENTS, READONLY, DEBUGGING
  15 .debug_ranges 0000f3a0  67f72000  67f72000  000a8600  2**0
                   CONTENTS, READONLY, DEBUGGING

$ objdump -h dict_snowball-strip.dll

dict_snowball-strip.dll:     file format pei-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
   0 .text         00016808  67ec1000  67ec1000  00000400  2**4
                   CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA
   1 .data         00017180  67ed8000  67ed8000  00016e00  2**5
                   CONTENTS, ALLOC, LOAD, DATA
   2 .bss          000000f8  67ef0000  67ef0000  00000000  2**5
                   ALLOC
   3 .edata        00000fe0  67ef1000  67ef1000  0002e000  2**2
                   CONTENTS, ALLOC, LOAD, READONLY, DATA
   4 .idata        000003e0  67ef2000  67ef2000  0002f000  2**2
                   CONTENTS, ALLOC, LOAD, DATA
   5 .reloc        0000765c  67ef3000  67ef3000  0002f400  2**2
                   CONTENTS, ALLOC, LOAD, READONLY, DATA


Questions:
- Is it anomalous to have a .reloc portion addressing the
debug_* sections (so the original build file is broken)
- or should strip recognize and remove reloc portion not
anymore relevant ?

rebase is choking on this portion of the .reloc table

>
> Corinna
>

Thansk in advance
Marco

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list