This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Fix build with compiler defining __i686 (bug 411)
On Thu, 2 Feb 2012, Roland McGrath wrote:
> Third, conditionalize GET_PC_THUNK{,_STR} for GCC>=4.7.
This patch does that.
2012-02-05 Joseph Myers <joseph@codesourcery.com>
* sysdeps/i386/sysdep.h: Include <features.h>.
(GET_PC_THUNK, GET_PC_THUNK_STR): Define conditionally on compiler
version.
diff --git a/sysdeps/i386/sysdep.h b/sysdeps/i386/sysdep.h
index 2c0aafa..1dbb8e1 100644
--- a/sysdeps/i386/sysdep.h
+++ b/sysdeps/i386/sysdep.h
@@ -20,10 +20,23 @@
#include <sysdeps/generic/sysdep.h>
-#ifdef __ASSEMBLER__
-# define GET_PC_THUNK(reg) __i686.get_pc_thunk.reg
+#include <features.h> /* For __GNUC_PREREQ. */
+
+/* It is desirable that the names of PIC thunks match those used by
+ GCC so that multiple copies are eliminated by the linker. */
+
+#ifdef __ASSEMBLER__
+# if __GNUC_PREREQ (4, 7)
+# define GET_PC_THUNK(reg) __x86.get_pc_thunk.reg
+# else
+# define GET_PC_THUNK(reg) __i686.get_pc_thunk.reg
+# endif
#else
-# define GET_PC_THUNK_STR(reg) "__i686.get_pc_thunk." #reg
+# if __GNUC_PREREQ (4, 7)
+# define GET_PC_THUNK_STR(reg) "__x86.get_pc_thunk." #reg
+# else
+# define GET_PC_THUNK_STR(reg) "__i686.get_pc_thunk." #reg
+# endif
#endif
#ifdef __ASSEMBLER__
--
Joseph S. Myers
joseph@codesourcery.com