PATCH: Multiple sections with same name don't work

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


On Fri, Apr 30, 2004 at 04:01:29PM -0700, H. J. Lu wrote:
> On Fri, Apr 30, 2004 at 03:12:44PM -0700, H. J. Lu wrote:
> > The current assembler still doesn't support multiple section with
> > the same section name:
> > 
> > [hjl@gnu comdat-1]$ cat foo.s
> >         .text
> > .L1:
> >         .align 4
> > .L2:
> > .L3:
> >         .section        .data,"",@progbits
> >         .long   .L3-.L1
> >         .section        .text,"axG",@progbits,foo,comdat
> > [hjl@gnu comdat-1]$ gcc -c foo.s
> > foo.s: Assembler messages:
> > foo.s:7: Error: can't resolve `.text' {.text section} - `.L1' {.text section}
> > 
> > 
> 
> This patch seems to work for me. I don't quite understand why we call
> symbol_set_bfdsym here if we only want to add the symbol to the
> symbol table.
> 
> 

It is not enough. Now I got

[hjl@gnu-psc comdat-2]$ gcc -c bar.s
bar.s: Assembler messages:
bar.s:14: Error: can't resolve `.text' {.text section} - `.LFB359' {.text
section}
[hjl@gnu-psc comdat-2]$ cat bar.s
        .section        .text,"axG",@progbits,foo,comdat
.LFB359:
.L46:
        jbe     .L46
.LFE359:
        .section        .text,"axG",@progbits,bar,comdat
.LFB401:
.L514:
        jmp     .L514
.LFE401:
        .section        .eh_frame,"a",@progbits
.Lframe1:
.LSCIE1:
        .long   .LFE359-.LFB359
.LASFDE101:
        .long   .LFE401-.LFB401
.LEFDE101:
        .section        .data,"awG",@progbits,foobar,comdat


H.J.



More information about the Binutils mailing list