This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: glibc2.1 [offtopic]


> 
> 
>   In message <m10EkjF-000390C@ocean.lucon.org>you write:
>   > #if SUPPORT_WEAK
>   > extern void foo (void) __attribute__ ((weak));
>   > #endif
>   > 
>   > That means we need to match foo's prototype in 2 places. We can do
>   > 
>   > #if SUPPORT_WEAK
>   > extern void foo (void) __attribute__ ((weak));
>   > #else
>   > extern void foo (void);
>   > #endif
> Define an ATTRIBUTE_WEAK then write
> extern void foo (void) ATTRIBUTE_WEAK;
> 
> This is how we deal with this problem elsewhere.  I see no reason for this
> code to behave any differently.

Have you really looked at how egcs deals with weak symbols for targets?
I did

# cd gcc
# grep ATTRIBUTE_WEAK *
# grep "pragma[ \t]+weak" *
gthr-dce.h:#pragma weak pthread_once
gthr-dce.h:#pragma weak pthread_once_init
gthr-dce.h:#pragma weak pthread_key_create
gthr-dce.h:#pragma weak pthread_key_delete
gthr-dce.h:#pragma weak pthread_getspecific
gthr-dce.h:#pragma weak pthread_setspecific
gthr-dce.h:#pragma weak pthread_create
gthr-dce.h:#pragma weak pthread_mutex_lock
gthr-dce.h:#pragma weak pthread_mutex_trylock
gthr-dce.h:#pragma weak pthread_mutex_unlock
gthr-posix.h:#pragma weak pthread_once
gthr-posix.h:#pragma weak pthread_key_create
gthr-posix.h:#pragma weak pthread_key_delete
gthr-posix.h:#pragma weak pthread_getspecific
gthr-posix.h:#pragma weak pthread_setspecific
gthr-posix.h:#pragma weak pthread_create
gthr-posix.h:#pragma weak pthread_mutex_lock 
gthr-posix.h:#pragma weak pthread_mutex_trylock 
gthr-posix.h:#pragma weak pthread_mutex_unlock 
gthr-solaris.h:#pragma weak thr_keycreate
gthr-solaris.h:#pragma weak thr_getspecific
gthr-solaris.h:#pragma weak thr_setspecific
gthr-solaris.h:#pragma weak thr_create
gthr-solaris.h:#pragma weak mutex_lock
gthr-solaris.h:#pragma weak mutex_trylock
gthr-solaris.h:#pragma weak mutex_unlock

> 
> 
>   > But I don't like it. "#prama weak" is the standard for SVR4 and
>   > is cleaner than __attribute__ for this case.
> But the GNU standard is to use attributes, not pragmas.
> 
> Use an attribute please.
> 

It looks to me that "#prama weak" is much more consistent than
attribute in egcs 1.1.2. Those gthr-*h files are not old codes. They
were added after we started egcs. I just copied what we had. Why now
suddenly do you want something different? I hate to see we do things
one way in one place and another way in a different place.


-- 
H.J. Lu (hjl@gnu.org)


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