[PATCH] PR ld/21529: Use a linker script to limit output with the test case (was: Re: PR21529, internal error in linker.c)

Maciej W. Rozycki macro@imgtec.com
Thu Jul 13 20:43:00 GMT 2017


On Thu, 13 Jul 2017, H.J. Lu wrote:

> >  At least the `rx-elf' failure is not a bug of any kind, but rather
> > resource exhaustion and the dump requested eventually completes.  The raw
> > binary produced corresponds to what would be:
> >
> > Elf file type is EXEC (Executable file)
> > Entry point 0x10000004
> > There are 2 program headers, starting at offset 52
> >
> > Program Headers:
> >   Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
> >   LOAD           0x001000 0x10000000 0x10000000 0x00008 0x00008 R E 0x1000
> >   LOAD           0x001ffc 0xbffffffc 0xbffffffc 0x00004 0x00004 RW  0x1000
> >
> >  Section to Segment mapping:
> >   Segment Sections...
> >    00     .text
> >    01     .stack
> >
> > if linked with the ELF output format.  Of course what LD produces with the
> > binary output format is a sparse file:
> >
> > $ stat tmpdir/dump
> >   File: `tmpdir/dump'
> >   Size: 2952790016      Blocks: 16         IO Block: 65536  regular file
> > [...]
> > $
> >
> 
> Why does rx-elf generate such a big file for a simple program?

 See the addresses above in the program header dump.  Unlike ELF the raw 
binary format cannot express address space gaps other than by padding.

 NB depending on the version of the software components involved this 
causes `expect' either to hang or to crash with:

Tcl_SetObjLength: negative length requested: -2147483638 (integer overflow?)
Aborted (core dumped)

on my system in the next test case, with the core file produced reaching a 
massive 4GiB size.  Of course that is a bug in TCL, however I don't think 
we need to get it triggered here.

  Maciej



More information about the Binutils mailing list