This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
[RFC] gcc 4.8 vs glibc alias macros
- From: Richard Henderson <rth at twiddle dot net>
- To: libc-ports at sourceware dot org
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Thu, 30 Aug 2012 13:08:09 -0700
- Subject: [RFC] gcc 4.8 vs glibc alias macros
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~
>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