This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gc sections and .eh_frame


On Wed, Jun 29, 2005 at 11:31:02PM +0100, Jonathan Larmour wrote:
> I updated my sources to current binutils CVS and rebuuilt my 
> powerpc-eabi-ld. Unfortunately I now get the following when linking an 
> application that uses C++ exceptions:
> `DW.ref._ZTISt9exception' referenced in section `.rodata' of 
> /local/builds/toolchains/powerpc-eabi/tools/lib/gcc/powerpc-eabi/3.4.4/../../../../powerpc-eabi/lib/nof/libsupc++.a(vterminate.o): 
> defined in discarded section `.gnu.linkonce.s.DW.ref._ZTISt9exception' of 
> /local/builds/toolchains/powerpc-eabi/tools/lib/gcc/powerpc-eabi/3.4.4/../../../../powerpc-eabi/lib/nof/libsupc++.a(vterminate.o)collect2: 
> ld returned 1 exit status
> 
> I'll have a closer look tomorrow, although my hunch is that it's something 
> to do with being a .gnu.linkonce section specifically - possibly there are 

Yes.

> multiple instances of that section name, and only one is marked to be 
> kept, but when duplicate .gnu.linkonce sections are removed, it is the 
> other instance that is kept, and later when GC happens, even that one is 
> removed.

No, GC isn't removing too many sections.  The problem is that .eh_frame,
.gcc_exception_table, debug sections, and other sections on some targets
are not split per-function.  When linkonce sections are removed, you are
left with references from these sections to the removed sections.  The
linker knows this happens for certain section names, so doesn't warn,
but powerpc has been using .rodata instead of .gcc_exception_table..
A workaround is to link with --noinhibit-exec.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]