gc sections and .eh_frame

Jonathan Larmour jifl@eCosCentric.com
Thu Jun 9 10:33:00 GMT 2005


Richard Henderson wrote:
> On Wed, Jun 08, 2005 at 10:36:11PM +0100, Jonathan Larmour wrote:
>>Are the powerpc-eabi tools the only ones behaving correctly (putting it in 
>>.rodata) and all the others wrong?
> 
> *shrug* I'm not sure why ppc-eabi is the only one different.
> Probably just an oversight somewhere in the rs6000 port.

Or could be an ABI thing. I don't know. But I don't think that's relevant 
as that clearly is the way it has worked for a long time (probably 
forever), and the elflink.c change in question breaks it. Also as I 
mentioned (but I don't care as much about personally as I'm now 
unaffected), the change breaks existing linker scripts much more widely 
than powerpc-eabi.

So far, no-one has given any rationalisation for the change. It wasn't 
posted to this list, so there's no reason given there. To my eye, the 
change doesn't seem right - if a section is a dependency of .eh_frame, it 
needs to be kept. Needing to forcibly KEEP() all .gcc_except_table 
sections should not have been necessary in the first place.

There may well be a very good reason for the change that I'm not aware of 
or am too dumb to see. That's entirely fair enough if so. As soon as I 
know the reason I'm happy to try and fix things to accomodate that reason 
and maintain existing behaviour.

Until then, I'm attaching a patch against current CVS to revert it. I 
have checkin access to /cvs/src if that helps.

Jifl

2005-06-09  Jonathan Larmour  <jifl@eCosCentric.com>

	* elflink.c (bfd_elf_gc_sections): Revert change of 2004-04-21 to
	not mark dependencies of .eh_frame. There is nowhere else such
	marking would happen so they need to be kept.

Index: elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.167
diff -u -5 -p -r1.167 elflink.c
--- elflink.c	9 Jun 2005 02:02:17 -0000	1.167
+++ elflink.c	9 Jun 2005 10:25:00 -0000
@@ -9124,16 +9124,11 @@ bfd_elf_gc_sections (bfd *abfd, struct b

        for (o = sub->sections; o != NULL; o = o->next)
  	{
  	  if (o->flags & SEC_KEEP)
  	    {
-	      /* _bfd_elf_discard_section_eh_frame knows how to discard
-		 orphaned FDEs so don't mark sections referenced by the
-		 EH frame section.  */
-	      if (strcmp (o->name, ".eh_frame") == 0)
-		o->gc_mark = 1;
-	      else if (!_bfd_elf_gc_mark (info, o, gc_mark_hook))
+	      if (!_bfd_elf_gc_mark (info, o, gc_mark_hook))
  		return FALSE;
  	    }
  	}
      }


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