Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 10 Feb 2013 19:31:58 -0500
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: [PATCH 2/3] Have different definitions of
 __pthread_tsd_main agree in size

On Sun, Feb 10, 2013 at 11:32:47PM +0100, Jens Gustedt wrote:
> When switching optimization to higher levels (-O3) and enable link time
> optimization (-flto) gcc finds two instances of the __pthread_tsd_main
> variable that are declared with different sizes.
> 
> The real size that is needed is known in both source files. Just use
> equivalent definitions.
> 
> 1	1	src/thread/pthread_self.c
> 
> diff --git a/src/thread/pthread_self.c b/src/thread/pthread_self.c
> index 23dbaa5..32a6e5d 100644
> --- a/src/thread/pthread_self.c
> +++ b/src/thread/pthread_self.c
> @@ -3,7 +3,7 @@
>  static struct pthread *main_thread = &(struct pthread){0};
>  
>  /* pthread_key_create.c overrides this */
> -static const void *dummy[1] = { 0 };
> +static const void *dummy[PTHREAD_KEYS_MAX] = { 0 };
>  weak_alias(dummy, __pthread_tsd_main);

Nope, that defeats the whole purpose, which is to avoid wasting space
when it's not needed. This warning is bogus. There's no reason a weak
symbol can't have different size than a strong one that optionally
replaces it.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.