[PATCH] Fix PR41529

Dave Korn dave.korn.cygwin@googlemail.com
Sat Jan 2 14:23:00 GMT 2010


Richard Guenther wrote:
> On Sat, 2 Jan 2010, Dave Korn wrote:

>>   I'll see if there's a nice way to extend the capabilities of libelf.
> 
> In fact the initial object code won't contain any ELF sections.  The
> LTO sections are simply passed through the assembler by cc1 like
> 
> .section .gnu_lto_XXX
> .ascii '....
> 
> Which of course libelf can't parse either.

  Yes, I think I understand; elf format data content in non-elf data sections.

  I've tried some experiments: objcopying everything into elf32-i386 format
almost-but-not-quite works:

> $ /gnu/gcc/obj3/gcc/xgcc -B/gnu/gcc/obj3/gcc/ ctlo-only-0.o ctlo-only-1.o  -O3
> -fwhopr conly-0.o conly-1.o  -o test1
> conly-0.o: In function `_main':
> (.text+0x28): undefined reference to `_exit'
> collect2: ld returned 1 exit status

  What I did there was extract all the LTO sections into one set of .o files,
and all the non-LTO sections into another set of .o files, converting on the
fly to elf format.  For some reason if I just try to convert the two input .o
files wholesale, I get an ICE in lto1 from a buffer error handling a
compressed stream.  That's also the result if I try feeding lto1 any native
object files, which makes more sense in that case; I don't see why it would
arise in the wholesale conversion case.

    cheers,
      DaveK



More information about the Gcc-patches mailing list