PATCH: Multiple sections with same name don't work

H. J. Lu hjl@lucon.org
Sat May 1 05:50:00 GMT 2004


On Fri, Apr 30, 2004 at 10:12:01PM -0700, Zack Weinberg wrote:
> Alan Modra <amodra@bigpond.net.au> writes:
> 
> > On Fri, Apr 30, 2004 at 08:43:00PM -0700, H. J. Lu wrote:
> >> On Sat, May 01, 2004 at 12:29:13PM +0930, Alan Modra wrote:
> >> > Actually, it is probably a mistake to try to support multiple sections
> >> > of the same name in gas.  For instance, if you have two .text sections,
> >> > how is gas supposed to evaluate ".long .text" ?
> >> 
> >> Will that be generated by compiler? If not, we can issue an error.
> >
> > The real question is: Do we need multiple sections of the same name
> > in assembly files?  I don't think we do.
> 
> I need them in order to generate COMDAT sections compatible with the
> HPUX linker.  gcc might emit e.g.
> 
>      .section .text 
>      # non-COMDAT code  ...
> 
>      .section .text,"G",symbol_name,comdat
>      # code for symbol_name ...
> 
>      .section .eh_frame
>      # non-COMDAT unwind info ...
> 
>      .section .eh_frame,"G",symbol_name,comdat
>      # unwind info for symbol_name ...
> 

I am testing this patch now.


H.J.
-------------- next part --------------
2004-04-30  H.J. Lu  <hongjiu.lu@intel.com>

	* symbols.c (symbol_set_bfdsym): Don't reset BFD section symbol.

--- gas/symbols.c.same	2003-12-04 10:43:25.000000000 -0800
+++ gas/symbols.c	2004-04-30 22:45:18.000000000 -0700
@@ -2260,7 +2260,8 @@ symbol_set_bfdsym (symbolS *s, asymbol *
 {
   if (LOCAL_SYMBOL_CHECK (s))
     s = local_symbol_convert ((struct local_symbol *) s);
-  s->bsym = bsym;
+  if ((s->bsym->flags & BSF_SECTION_SYM) == 0)
+    s->bsym = bsym;
 }
 
 #endif /* BFD_ASSEMBLER */


More information about the Binutils mailing list