gc sections and .eh_frame

Jonathan Larmour jifl@eCosCentric.com
Wed Jun 29 22:31:00 GMT 2005
Alan Modra wrote:
> On Wed, Jun 29, 2005 at 10:54:01AM +0930, Alan Modra wrote:
> 
>>I think we can do without it by marking sections
>>referenced from .eh_frame specially, and keeping them iff the associated
>>.text section is marked.
> 
> 
> Committing mainline.
> 
> bfd/
> 	* elflink.c (_bfd_elf_gc_mark): Mark sections referenced by
> 	.eh_frame specially..
> 	(bfd_elf_gc_sections): ..rather than totally ignoring .eh_frame.
> 	Don't recheck sections we have already marked.
> 	(elf_gc_sweep): Keep non-code sections referenced from .eh_frame.
> 	* section.c (struct bfd_section): Add gc_mark_from_eh.
> 	(STD_SECTION): Adjust.
> 	* ecoff.c (bfd_debug_section): Adjust.
> 	* bfd-in2.h: Regenerate.
> 
> ld/
> 	* scripttempl/elf.sc (.gcc_except_table): Don't KEEP.

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 
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.

Jifl
-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine



More information about the Binutils mailing list