* [RFC] gcc 4.8 vs glibc alias macros
@ 2012-08-30 20:08 Richard Henderson
2012-09-03 17:50 ` Maxim Kuvyrkov
0 siblings, 1 reply; 2+ messages in thread
From: Richard Henderson @ 2012-08-30 20:08 UTC (permalink / raw)
To: libc-ports; +Cc: gcc
[-- Attachment #1: Type: text/plain, Size: 1274 bytes --]
Dunno if alpha is going to be the only glibc port to encounter this, if it should be considered a gcc bug, or what.
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~
[-- Attachment #2: 0001-alpha-Work-around-gcc-4.8-aliasing-difference-bug.patch --]
[-- Type: text/x-patch, Size: 1647 bytes --]
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)
-
-
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)
#ifdef NO_LONG_DOUBLE
strong_alias (__isnan, __isnanl)
--
1.7.11.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFC] gcc 4.8 vs glibc alias macros
2012-08-30 20:08 [RFC] gcc 4.8 vs glibc alias macros Richard Henderson
@ 2012-09-03 17:50 ` Maxim Kuvyrkov
0 siblings, 0 replies; 2+ messages in thread
From: Maxim Kuvyrkov @ 2012-09-03 17:50 UTC (permalink / raw)
To: Richard Henderson; +Cc: libc-ports, gcc
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-09-03 17:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-30 20:08 [RFC] gcc 4.8 vs glibc alias macros Richard Henderson
2012-09-03 17:50 ` Maxim Kuvyrkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).