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]

Re: Fix weak handling with GCC 3.4+


On Fri, Jan 03, 2003 at 02:41:23PM -0800, Richard Henderson wrote:
> On Fri, Jan 03, 2003 at 02:34:50PM -0800, Ulrich Drepper wrote:
> > __thread int foo = 0;
> > extern __typeof (foo) foo __attribute ((weak));
> > 
> > 
> > __typeof() apparently does not include the __thread information.  I'd
> > call it a gcc bug.
> 
> Why do you say that?  __thread is a storage class specifier, not a
> type specifier.  It would be just as incorrect if __typeof somehow
> copied "static" or "extern".
> 
> IMO this idiom is simply incorrect wrt __thread.
> 
> It would work if you used
> 
>   extern __thread __typeof(foo) foo __attribute((weak));
> 
> or just 
> 
>   #pragma weak foo

Then
#define __weak_extern_1(x) #symbol
#define weak_extern(symbol) _Pragma(__weak_extern_1(weak symbol)
should work.

Dunno if this is exactly what Andreas was testing, but at least
the snipped he posted was different:
#define __pragma_weak(expr) _Pragma(#expr)
#define _weak_extern(symbol) __pragma_weak("weak " #symbol)

	Jakub


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