This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports 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: [RFC] gcc 4.8 vs glibc alias macros


On 31/08/2012, at 8:08 AM, Richard Henderson wrote:

> Dunno if alpha is going to be the only glibc port to encounter this, if it should be considered a gcc bug, or what.

For problems like this it is very helpful to see the post-processed source of the file with macro definitions, i.e., output from the command line with appended "-E -dD" options.

> 
> Without this patch, using mainline gcc, I get
> 
> ./../include/libc-symbols.h:485:26: error: ‘__EI___isnanf’ aliased to external symbol ‘__GI___isnanf’
>   extern __typeof (name) __EI_##name \
>                          ^
> ./../include/libc-symbols.h:489:29: note: in expansion of macro '__hidden_ver1'
> #  define hidden_def(name)  __hidden_ver1(__GI_##name, name, name);
>                             ^
> ../ports/sysdeps/alpha/fpu/s_isnan.c:48:1: note: in expansion of macro 'hidden_def'
> hidden_def (__isnanf)
> ^
> 
> We get this because I chained aliases from __isnan to __isnanf to __GI___isnanf.
> 
> The patch works around this by defining both __isnanf and __GI___isnanf in terms of the original __isnan.
> 
> This isn't 100% correct since the __GI___isnanf symbol gets defined in the object file with visibility default, but it doesn't matter in practice because the users of the symbol still see the hidden_proto and so when the symbols are merged in the linker and link map applied, it acquires hidden visibility.
> 
> I'm looking for opinions as to whether (1) this is a gcc bug and (2) whether the patch should be applied to glibc regardless.
> 
> 
> 
> r~
> <0001-alpha-Work-around-gcc-4.8-aliasing-difference-bug.patch>

> From 9b0aca04145daf0d22d607e88d6fa2df8c49f11b Mon Sep 17 00:00:00 2001
> From: Richard Henderson <rth@twiddle.net>
> Date: Thu, 30 Aug 2012 12:02:50 -0700
> Subject: [PATCH] alpha: Work around gcc 4.8 aliasing difference/bug
> 
> ---
>  ports/ChangeLog.alpha             |  5 +++++
>  ports/sysdeps/alpha/fpu/s_isnan.c | 12 +++++-------
>  2 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/ports/ChangeLog.alpha b/ports/ChangeLog.alpha
> index 19edf6f..9589dd3 100644
> --- a/ports/ChangeLog.alpha
> +++ b/ports/ChangeLog.alpha
> @@ -1,3 +1,8 @@
> +2012-08-30  Richard Henderson  <rth@redhat.com>
> +
> +	* sysdeps/alpha/fpu/s_isnan.c: Define all aliases in terms of
> +	the original __isnan symbol.
> +
>  2012-08-27  Mike Frysinger  <vapier@gentoo.org>
>  
>  	[BZ #5400]
> diff --git a/ports/sysdeps/alpha/fpu/s_isnan.c b/ports/sysdeps/alpha/fpu/s_isnan.c
> index b18c7bb..1f239ac 100644
> --- a/ports/sysdeps/alpha/fpu/s_isnan.c
> +++ b/ports/sysdeps/alpha/fpu/s_isnan.c
> @@ -28,11 +28,6 @@
>  #undef isnanf
>  #undef __GI___isnanf
>  
> -/* The hidden_proto in include/math.h was obscured by the macro hackery.  */
> -__typeof (__isnan) __isnanf;
> -hidden_proto (__isnanf)
> -
> -

This part seems to be a good thing regardless of anything else.

>  int
>  __isnan (double x)
>  {
> @@ -45,8 +40,11 @@ weak_alias (__isnan, isnan)
>  /* It turns out that the 'double' version will also always work for
>     single-precision.  */
>  strong_alias (__isnan, __isnanf)
> -hidden_def (__isnanf)
> -weak_alias (__isnanf, isnanf)
> +weak_alias (__isnan, isnanf)
> +
> +/* ??? GCC 4.8 fails to look through chains of aliases with asm names
> +   attached.  Work around this for now.  */
> +hidden_ver (__isnan, __isnanf)

Why do you need both weak_alias and hidden_ver here?  Maybe hidden_weak is what you want instead?  Again, this may be easier to understand from "-E -dD" output.

--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics


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