This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc 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]

Gcc's comdat support in glibc missing (was: Re: section() handling changed (or a bug was introduced)?)


On środa 20 październik 2004 16:21, Daniel Jacobowitz wrote:
> It's not a global/local question; but it wants there to be only one
> copy.  Then your linker doesn't really support comdat; if it did, they
> would not conflict.

I do have comdat everywhere, but thanks to your hints I've finally tracked 
down what's wrong.

This is what glibc does on sparc:

#   define __make_section_unallocated(section_string)   \
        asm (".section " section_string "\n\t.previous");

__make_section_unallocated
  (".gnu.linkonce.b.__sparc32_atomic_locks, \"aw\", %nobits");

volatile unsigned char __sparc32_atomic_locks[64]
  __attribute__ ((nocommon,
        section (".gnu.linkonce.b.__sparc32_atomic_locks" "\n\t#"),
                  visibility ("hidden")));

On gcc without comdat this results with two .section entries:

    .section .gnu.linkonce.b.__sparc32_atomic_locks, "aw", %nobits

    .section    .gnu.linkonce.b.__sparc32_atomic_locks
    #,"aw",@nobits

As one can see, that's a smart move to define '%nobits' instead of 
'@nobits' (whatever that does :).

On gccs with comdat support the same code results in:

        .section .gnu.linkonce.b.__sparc32_atomic_locks, "aw", %nobits

        .section        .bss,"awG",@nobits,.__sparc32_atomic_locks
        #,comdat

This results in (a) additional definition 
of .gnu.linkonce.b.__sparc32_atomic_locks section (which is empty and kind of 
useless) and (b) commenting out comdat definition which causes conflicts when 
linking (since that definition is supposed to replace .gnu.linkonce).

A fix to just make it compile is simple - removal of "\n\t#". But what about 
that nobits hack? It's there for a reason (right? :) and it can't be 
'rehacked' in the same way since .section syntax changed.

CC: to libc-alpha (hope they accept off-list posts) and would be nice if 
someone reacted with a patch :)

-- 
In the year eighty five ten
God is gonna shake his mighty head
He'll either say,
"I'm pleased where man has been"
Or tear it down, and start again


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