public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 2/9] Use gcc attribute ifunc in libc_ifunc macro instead of inline assembly due to false debuginfo.
  2016-08-08 14:40 [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Stefan Liebler
  2016-08-08 14:40 ` [PATCH v2 6/9] Use libc_ifunc macro for clock_* symbols in librt Stefan Liebler
  2016-08-08 14:40 ` [PATCH v2 3/9] s390: Refactor ifunc resolvers due to false debuginfo Stefan Liebler
@ 2016-08-08 14:40 ` Stefan Liebler
  2016-08-08 14:40 ` [PATCH v2 8/9] Use libc_ifunc macro for vfork in libpthread Stefan Liebler
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Stefan Liebler @ 2016-08-08 14:40 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, fweimer, murphyp, schwab, joseph_myers

The current s390 ifunc resolver for vector optimized functions and the common
libc_ifunc macro in include/libc-symbols.h uses something like that:
extern void *__resolve___strlen(unsigned long int dl_hwcap) asm (strlen);
asm (".type strlen, %gnu_indirect_function");

This leads to false debug information:
objdump --dwarf=info libc.so:
...
<1><1e6424>: Abbrev Number: 43 (DW_TAG_subprogram)
    <1e6425>   DW_AT_external    : 1
    <1e6425>   DW_AT_name        : (indirect string, offset: 0x1146e): __resolve___strlen
    <1e6429>   DW_AT_decl_file   : 1
    <1e642a>   DW_AT_decl_line   : 23
    <1e642b>   DW_AT_linkage_name: (indirect string, offset: 0x1147a): strlen
    <1e642f>   DW_AT_prototyped  : 1
    <1e642f>   DW_AT_type        : <0x1e4ccd>
    <1e6433>   DW_AT_low_pc      : 0x998e0
    <1e643b>   DW_AT_high_pc     : 0x16
    <1e6443>   DW_AT_frame_base  : 1 byte block: 9c     (DW_OP_call_frame_cfa)
    <1e6445>   DW_AT_GNU_all_call_sites: 1
    <1e6445>   DW_AT_sibling     : <0x1e6459>
 <2><1e6449>: Abbrev Number: 44 (DW_TAG_formal_parameter)
    <1e644a>   DW_AT_name        : (indirect string, offset: 0x1845): dl_hwcap
    <1e644e>   DW_AT_decl_file   : 1
    <1e644f>   DW_AT_decl_line   : 23
    <1e6450>   DW_AT_type        : <0x1e4c8d>
    <1e6454>   DW_AT_location    : 0x122115 (location list)
...

The debuginfo for the ifunc-resolver function contains the DW_AT_linkage_name
field, which names the real function name "strlen". If you perform an inferior
function call to strlen in lldb, then it fails due to something like that:
"error: no matching function for call to 'strlen'
candidate function not viable: no known conversion from 'const char [6]'
to 'unsigned long' for 1st argument"

The unsigned long is the dl_hwcap argument of the resolver function.
The strlen function itself has no debufinfo.

The s390 ifunc resolver for memset & co uses something like that:
asm (".globl FUNC"
     ".type FUNC, @gnu_indirect_function"
     ".set FUNC, __resolve_FUNC");

This way the debuginfo for the ifunc-resolver function does not conain the
DW_AT_linkage_name field and the real function has no debuginfo, too.

Using this strategy for the vector optimized functions leads to some troubles
for functions like strnlen. Here we have __strnlen and a weak alias strnlen.
The __strnlen function is the ifunc function, which is realized with the asm-
statement above. The weak_alias-macro can't be used here due to undefined symbol:
gcc ../sysdeps/s390/multiarch/strnlen.c -c ...
In file included from <command-line>:0:0:
../sysdeps/s390/multiarch/strnlen.c:28:24: error: ‘strnlen’ aliased to undefined symbol ‘__strnlen’
 weak_alias (__strnlen, strnlen)
                        ^
./../include/libc-symbols.h:111:26: note: in definition of macro ‘_weak_alias’
   extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
                          ^
../sysdeps/s390/multiarch/strnlen.c:28:1: note: in expansion of macro ‘weak_alias’
 weak_alias (__strnlen, strnlen)
 ^
make[2]: *** [build/string/strnlen.o] Error 1

As the __strnlen function is defined with asm-statements the function name
__strnlen isn't known by gcc. But the weak alias can also be done with an
asm statement to resolve this issue:
__asm__ (".weak  strnlen\n\t"
         ".set   strnlen,__strnlen\n");

In order to use the weak_alias macro, gcc needs to know the ifunc function. The
minimum gcc to build glibc is currently 4.7, which supports attribute((ifunc)).
See https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Function-Attributes.html.
It is only supported if gcc is configured with --enable-gnu-indirect-function
or gcc supports it by default for at least intel and s390x architecture.
Usage is something like that:
__typeof (FUNC) FUNC __attribute__ ((ifunc ("__resolve_FUNC")));

Then gcc produces the same .globl, .type, .set assembler instructions like above.
And the debuginfo does not contain the DW_AT_linkage_name field and there is no
debuginfo for the real function, too.

But in order to get it work, there is also some extra work to do.
Currently, the glibc internal symbol on s390x e.g. __GI___strnlen is not the
ifunc symbol, but the fallback __strnlen_c symbol. Thus I have to omit the
libc_hidden_def macro in strnlen.c (here is the ifunc function __strnlen)
because it is already handled in strnlen-c.c (here is __strnlen_c).

Due to libc_hidden_proto (__strnlen) in string.h, compiling fails:
gcc ../sysdeps/s390/multiarch/strnlen.c -c ...
In file included from <command-line>:0:0:
../sysdeps/s390/multiarch/strnlen.c:53:24: error: ‘strnlen’ aliased to undefined symbol ‘__strnlen’
 weak_alias (__strnlen, strnlen)
                        ^
./../include/libc-symbols.h:111:26: note: in definition of macro ‘_weak_alias’
   extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
                          ^
../sysdeps/s390/multiarch/strnlen.c:53:1: note: in expansion of macro ‘weak_alias’
 weak_alias (__strnlen, strnlen)
 ^
make[2]: *** [build/string/strnlen.os] Error 1

I have to redirect the prototypes for __strnlen in string.h and create a copy
of the prototype for using as ifunc function:
__typeof (__redirect___strnlen) __strnlen __attribute__ ((ifunc ("__resolve_strnlen")));
weak_alias (__strnlen, strnlen)

This way there is no trouble with the internal __GI_* symbols.
Glibc builds fine with this construct and the debuginfo is "correct".
For functions without a __GI_* symbol like memccpy or if the __GI_* symbol
targets to the ifunc symbol, this redirection is not needed.

This patch adjusts the common libc_ifunc and libm_ifunc macro to use gcc
attribute ifunc. Due to this change, the macro users where the __GI_* symbol
does not target the ifunc symbol have to be prepared with the redirection
construct.

This patch also prepares the libc_ifunc macro to be useable in s390-ifunc-macro.
The s390 ifunc-resolver-functions do have an hwcaps parameter and not all
resolvers need the same initialization code. The next patch in this series
changes the s390 ifunc macros to use this common one.

Tested the whole patchset by building glibc and running the testsuite on s390,
intel, power for 32/64bit. The __GI_* symbols targets the same functions as
before.

ChangeLog:

	* include/libc-symbols.h (__ifunc): New macro uses gcc attribute ifunc.
	(libc_ifunc, libm_ifunc): Use __ifunc as base macro.
	(libc_ifunc_redirected, libm_ifunc_init): New define.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c:
	Redirect ifunced function in header for using as type for ifunc function.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/memcmp.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/memcpy.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/memmove.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/memset.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/rawmemchr.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strchr.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strlen.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strncmp.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/strnlen.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c: Likewise.
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/memcmp.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/mempcpy.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/rawmemchr.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/stpncpy.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcat.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strchr.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcmp.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strcpy.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncmp.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strncpy.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strnlen.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strrchr.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/strstr.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/wcschr.c: Likewise.
	* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf.c:
	Add libc_hidden_def().
	* sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c: Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/stpcpy.c: Likewise.
---
 include/libc-symbols.h                             | 33 ++++++++++++----------
 .../powerpc32/power4/fpu/multiarch/s_finite.c      | 16 +++++++----
 .../powerpc32/power4/fpu/multiarch/s_finitef.c     | 10 ++++---
 .../powerpc32/power4/fpu/multiarch/s_isinf.c       | 16 +++++++----
 .../powerpc32/power4/fpu/multiarch/s_isinff.c      | 10 ++++---
 .../powerpc32/power4/fpu/multiarch/s_isnan.c       | 24 ++++++++++------
 .../powerpc32/power4/fpu/multiarch/s_isnanf.c      |  1 +
 .../powerpc/powerpc32/power4/multiarch/memcmp.c    | 10 ++++---
 .../powerpc/powerpc32/power4/multiarch/memcpy.c    | 23 ++++++++-------
 .../powerpc/powerpc32/power4/multiarch/memmove.c   | 10 ++++---
 .../powerpc/powerpc32/power4/multiarch/mempcpy.c   | 15 ++++++----
 .../powerpc/powerpc32/power4/multiarch/memset.c    | 14 +++++----
 .../powerpc/powerpc32/power4/multiarch/rawmemchr.c | 11 ++++----
 .../powerpc/powerpc32/power4/multiarch/strchr.c    | 12 +++++---
 .../powerpc/powerpc32/power4/multiarch/strlen.c    | 10 ++++---
 .../powerpc/powerpc32/power4/multiarch/strncmp.c   | 12 +++++---
 .../powerpc/powerpc32/power4/multiarch/strnlen.c   | 13 +++++----
 sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c | 20 ++++++++-----
 .../powerpc/powerpc64/fpu/multiarch/s_finitef.c    | 14 +++++----
 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c  | 20 ++++++++-----
 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c | 14 +++++----
 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c  | 32 ++++++++++++---------
 sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c |  1 +
 sysdeps/powerpc/powerpc64/multiarch/memcmp.c       | 14 +++++----
 sysdeps/powerpc/powerpc64/multiarch/mempcpy.c      | 15 ++++++----
 sysdeps/powerpc/powerpc64/multiarch/rawmemchr.c    | 10 ++++---
 sysdeps/powerpc/powerpc64/multiarch/stpcpy.c       |  1 +
 sysdeps/powerpc/powerpc64/multiarch/stpncpy.c      | 17 ++++++-----
 sysdeps/powerpc/powerpc64/multiarch/strcat.c       | 14 +++++----
 sysdeps/powerpc/powerpc64/multiarch/strchr.c       | 12 +++++---
 sysdeps/powerpc/powerpc64/multiarch/strcmp.c       | 16 +++++++----
 sysdeps/powerpc/powerpc64/multiarch/strcpy.c       | 14 +++++----
 sysdeps/powerpc/powerpc64/multiarch/strncmp.c      | 20 +++++++------
 sysdeps/powerpc/powerpc64/multiarch/strncpy.c      | 16 +++++++----
 sysdeps/powerpc/powerpc64/multiarch/strnlen.c      | 14 +++++----
 sysdeps/powerpc/powerpc64/multiarch/strrchr.c      | 10 ++++---
 sysdeps/powerpc/powerpc64/multiarch/strstr.c       | 10 ++++---
 sysdeps/powerpc/powerpc64/multiarch/wcschr.c       | 17 ++++++-----
 38 files changed, 330 insertions(+), 211 deletions(-)

diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 4548e09..b95a0f9 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -714,26 +714,29 @@ for linking")
 #endif
 
 /* Marker used for indirection function symbols.  */
-#define libc_ifunc(name, expr)						\
-  extern void *name##_ifunc (void) __asm__ (#name);			\
-  void *name##_ifunc (void)						\
+#define __ifunc(type_name, name, expr, arg, init)			\
+  extern __typeof (type_name) name __attribute__			\
+			      ((ifunc (#name "_ifunc")));		\
+  static void *name##_ifunc (arg)					\
   {									\
-    INIT_ARCH ();							\
-    __typeof (name) *res = expr;					\
+    init ();								\
+    __typeof (type_name) *res = expr;					\
     return res;								\
-  }									\
-  __asm__ (".type " #name ", %gnu_indirect_function");
+  }
+
+#define libc_ifunc(name, expr) __ifunc (name, name, expr, void, INIT_ARCH)
+/* Use libc_ifunc_redirected if your ifunc'ed function has an internal symbol
+   which should be a dedicated fallback function instead of ifunc'ed.
+   You have to redirect the function in the header file and use it as
+   redirected_name.  */
+#define libc_ifunc_redirected(redirected_name, name, expr)	\
+  __ifunc (redirected_name, name, expr, void, INIT_ARCH)
+
 
 /* The body of the function is supposed to use __get_cpu_features
    which will, if necessary, initialize the data first.  */
-#define libm_ifunc(name, expr)						\
-  extern void *name##_ifunc (void) __asm__ (#name);			\
-  void *name##_ifunc (void)						\
-  {									\
-    __typeof (name) *res = expr;					\
-    return res;								\
-  }									\
-  __asm__ (".type " #name ", %gnu_indirect_function");
+#define libm_ifunc_init()
+#define libm_ifunc(name, expr) __ifunc (name, name, expr, void, libm_ifunc_init)
 
 #ifdef HAVE_ASM_SET_DIRECTIVE
 # define libc_ifunc_hidden_def1(local, name)				\
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c
index c860a1b..0c0d128 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c
@@ -16,6 +16,9 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define __finite __redirect___finite
+#define __finitef __redirect___finitef
+#define __finitel __redirect___finitel
 #include <math.h>
 #include <math_ldbl_opt.h>
 #include <shlib-compat.h>
@@ -23,11 +26,14 @@
 
 extern __typeof (__finite) __finite_ppc32 attribute_hidden;
 extern __typeof (__finite) __finite_power7 attribute_hidden;
-
-libc_ifunc (__finite,
-	    (hwcap & PPC_FEATURE_ARCH_2_06)
-	    ? __finite_power7
-            : __finite_ppc32);
+#undef __finite
+#undef __finitef
+#undef __finitel
+
+libc_ifunc_redirected (__redirect___finite,  __finite,
+		       (hwcap & PPC_FEATURE_ARCH_2_06)
+		       ? __finite_power7
+		       : __finite_ppc32);
 
 weak_alias (__finite, finite)
 
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef.c
index 831c94f..683477a 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef.c
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finitef.c
@@ -16,6 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define __finitef __redirect___finitef
 #include <math.h>
 #include <shlib-compat.h>
 #include "init-arch.h"
@@ -23,10 +24,11 @@
 extern __typeof (__finitef) __finitef_ppc32 attribute_hidden;
 /* The power7 finite(double) works for float.  */
 extern __typeof (__finitef) __finite_power7 attribute_hidden;
+#undef __finitef
 
-libc_ifunc (__finitef,
-	    (hwcap & PPC_FEATURE_ARCH_2_06)
-	    ? __finite_power7
-            : __finitef_ppc32);
+libc_ifunc_redirected  (__redirect___finitef, __finitef,
+			(hwcap & PPC_FEATURE_ARCH_2_06)
+			? __finite_power7
+			: __finitef_ppc32);
 
 weak_alias (__finitef, finitef)
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf.c
index 506c111..fe6c912 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf.c
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinf.c
@@ -16,6 +16,9 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define __isinf __redirect___isinf
+#define __isinff __redirect___isinff
+#define __isinfl __redirect___isinfl
 #include <math.h>
 #include <math_ldbl_opt.h>
 #include <shlib-compat.h>
@@ -23,11 +26,14 @@
 
 extern __typeof (__isinf) __isinf_ppc32 attribute_hidden;
 extern __typeof (__isinf) __isinf_power7 attribute_hidden;
-
-libc_ifunc (__isinf,
-	    (hwcap & PPC_FEATURE_ARCH_2_06)
-	    ? __isinf_power7
-            : __isinf_ppc32);
+#undef __isinf
+#undef __isinff
+#undef __isinfl
+
+libc_ifunc_redirected (__redirect___isinf,  __isinf,
+		       (hwcap & PPC_FEATURE_ARCH_2_06)
+		       ? __isinf_power7
+		       : __isinf_ppc32);
 
 weak_alias (__isinf, isinf)
 
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff.c
index 2ab83ee..1706092 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff.c
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isinff.c
@@ -16,6 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define __isinff __redirect___isinff
 #include <math.h>
 #include <math_ldbl_opt.h>
 #include <shlib-compat.h>
@@ -24,10 +25,11 @@
 extern __typeof (__isinff) __isinff_ppc32 attribute_hidden;
 /* The power7 isinf(double) works for float.  */
 extern __typeof (__isinff) __isinf_power7 attribute_hidden;
+#undef __isinff
 
-libc_ifunc (__isinff,
-	    (hwcap & PPC_FEATURE_ARCH_2_06)
-	    ? __isinf_power7
-            : __isinff_ppc32);
+libc_ifunc_redirected (__redirect___isinff,  __isinff,
+		       (hwcap & PPC_FEATURE_ARCH_2_06)
+		       ? __isinf_power7
+		       : __isinff_ppc32);
 
 weak_alias (__isinff, isinff)
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan.c
index 8f848d7..3655b81 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan.c
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnan.c
@@ -16,6 +16,9 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define __isnan __redirect___isnan
+#define __isnanf __redirect___isnanf
+#define __isnanl __redirect___isnanl
 #include <math.h>
 #include <math_ldbl_opt.h>
 #include <shlib-compat.h>
@@ -25,15 +28,18 @@ extern __typeof (__isnan) __isnan_ppc32 attribute_hidden;
 extern __typeof (__isnan) __isnan_power5 attribute_hidden;
 extern __typeof (__isnan) __isnan_power6 attribute_hidden;
 extern __typeof (__isnan) __isnan_power7 attribute_hidden;
-
-libc_ifunc (__isnan,
-	    (hwcap & PPC_FEATURE_ARCH_2_06)
-	    ? __isnan_power7 :
-	      (hwcap & PPC_FEATURE_ARCH_2_05)
-	      ? __isnan_power6 :
-		(hwcap & PPC_FEATURE_POWER5)
-		? __isnan_power5
-            : __isnan_ppc32);
+#undef __isnan
+#undef __isnanf
+#undef __isnanl
+
+libc_ifunc_redirected (__redirect___isnan, __isnan,
+		       (hwcap & PPC_FEATURE_ARCH_2_06)
+		       ? __isnan_power7
+		       : (hwcap & PPC_FEATURE_ARCH_2_05)
+			 ? __isnan_power6
+			 : (hwcap & PPC_FEATURE_POWER5)
+			   ? __isnan_power5
+			   : __isnan_ppc32);
 
 weak_alias (__isnan, isnan)
 
diff --git a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf.c b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf.c
index c43c0f3..304b2a7 100644
--- a/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf.c
+++ b/sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_isnanf.c
@@ -35,4 +35,5 @@ libc_ifunc (__isnanf,
 		? __isnanf_power5
             : __isnan_ppc32);
 
+hidden_def (__isnanf)
 weak_alias (__isnanf, isnanf)
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/memcmp.c b/sysdeps/powerpc/powerpc32/power4/multiarch/memcmp.c
index c08519c..49d424f 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/memcmp.c
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/memcmp.c
@@ -18,17 +18,19 @@
 
 /* Define multiple versions only for definition in libc.  */
 #if IS_IN (libc)
+# define memcmp __redirect_memcmp
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
 
 extern __typeof (memcmp) __memcmp_ppc attribute_hidden;
 extern __typeof (memcmp) __memcmp_power7 attribute_hidden;
+# undef memcmp
 
 /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
    ifunc symbol properly.  */
-libc_ifunc (memcmp,
-            (hwcap & PPC_FEATURE_HAS_VSX)
-            ? __memcmp_power7
-            : __memcmp_ppc);
+libc_ifunc_redirected (__redirect_memcmp, memcmp,
+		       (hwcap & PPC_FEATURE_HAS_VSX)
+		       ? __memcmp_power7
+		       : __memcmp_ppc);
 #endif
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/memcpy.c b/sysdeps/powerpc/powerpc32/power4/multiarch/memcpy.c
index f379e47..1a5da21 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/memcpy.c
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/memcpy.c
@@ -20,6 +20,8 @@
    DSO.  In static binaries we need memcpy before the initialization
    happened.  */
 #if defined SHARED && IS_IN (libc)
+# undef memcpy
+# define memcpy __redirect_memcpy
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
@@ -29,17 +31,18 @@ extern __typeof (memcpy) __memcpy_cell attribute_hidden;
 extern __typeof (memcpy) __memcpy_power6 attribute_hidden;
 extern __typeof (memcpy) __memcpy_a2 attribute_hidden;
 extern __typeof (memcpy) __memcpy_power7 attribute_hidden;
+# undef memcpy
 
 /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
    ifunc symbol properly.  */
-libc_ifunc (memcpy,
-            (hwcap & PPC_FEATURE_HAS_VSX)
-            ? __memcpy_power7 :
-	      (hwcap & PPC_FEATURE_ARCH_2_06)
-	      ? __memcpy_a2 :
-		(hwcap & PPC_FEATURE_ARCH_2_05)
-		? __memcpy_power6 :
-		  (hwcap & PPC_FEATURE_CELL_BE)
-		  ? __memcpy_cell
-            : __memcpy_ppc);
+libc_ifunc_redirected (__redirect_memcpy, memcpy,
+		       (hwcap & PPC_FEATURE_HAS_VSX)
+		       ? __memcpy_power7
+		       : (hwcap & PPC_FEATURE_ARCH_2_06)
+			 ? __memcpy_a2
+			 : (hwcap & PPC_FEATURE_ARCH_2_05)
+			   ? __memcpy_power6
+			   : (hwcap & PPC_FEATURE_CELL_BE)
+			     ? __memcpy_cell
+			     : __memcpy_ppc);
 #endif
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/memmove.c b/sysdeps/powerpc/powerpc32/power4/multiarch/memmove.c
index 4173184..1dfb5be 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/memmove.c
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/memmove.c
@@ -19,16 +19,18 @@
 #if defined SHARED && IS_IN (libc)
 /* Redefine memmove so that the compiler won't complain about the type
    mismatch with the IFUNC selector in strong_alias, below.  */
+# define memmove __redirect_memmove
 # include <string.h>
 # include "init-arch.h"
 
 extern __typeof (memmove) __memmove_ppc attribute_hidden;
 extern __typeof (memmove) __memmove_power7 attribute_hidden;
+# undef memmove
 
-libc_ifunc (memmove,
-            (hwcap & PPC_FEATURE_HAS_VSX)
-            ? __memmove_power7
-            : __memmove_ppc);
+libc_ifunc_redirected (__redirect_memmove, memmove,
+		       (hwcap & PPC_FEATURE_HAS_VSX)
+		       ? __memmove_power7
+		       : __memmove_ppc);
 #else
 # include <string/memmove.c>
 #endif
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy.c b/sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy.c
index 3c77b5f..3c7c644 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy.c
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy.c
@@ -17,23 +17,28 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if IS_IN (libc)
+# define mempcpy __redirect_mempcpy
+# define __mempcpy __redirect___mempcpy
 # define NO_MEMPCPY_STPCPY_REDIRECT
+/* Omit the mempcpy inline definitions because it would redefine mempcpy.  */
+# define _HAVE_STRING_ARCH_mempcpy 1
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
 
 extern __typeof (__mempcpy) __mempcpy_ppc attribute_hidden;
 extern __typeof (__mempcpy) __mempcpy_power7 attribute_hidden;
+# undef mempcpy
+# undef __mempcpy
 
 /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
    ifunc symbol properly.  */
-libc_ifunc (__mempcpy,
-	    (hwcap & PPC_FEATURE_HAS_VSX)
-            ? __mempcpy_power7
-            : __mempcpy_ppc);
+libc_ifunc_redirected (__redirect___mempcpy,  __mempcpy,
+		       (hwcap & PPC_FEATURE_HAS_VSX)
+		       ? __mempcpy_power7
+		       : __mempcpy_ppc);
 
 weak_alias (__mempcpy, mempcpy)
-libc_hidden_def (mempcpy)
 #else
 # include <string/mempcpy.c>
 #endif
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/memset.c b/sysdeps/powerpc/powerpc32/power4/multiarch/memset.c
index 1d7fc7f..a5c0142 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/memset.c
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/memset.c
@@ -18,6 +18,7 @@
 
 /* Define multiple versions only for definition in libc.  */
 #if defined SHARED && IS_IN (libc)
+# define memset __redirect_memset
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
@@ -25,13 +26,14 @@
 extern __typeof (memset) __memset_ppc attribute_hidden;
 extern __typeof (memset) __memset_power6 attribute_hidden;
 extern __typeof (memset) __memset_power7 attribute_hidden;
+# undef memset
 
 /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
    ifunc symbol properly.  */
-libc_ifunc (memset,
-            (hwcap & PPC_FEATURE_HAS_VSX)
-            ? __memset_power7 :
-	      (hwcap & PPC_FEATURE_ARCH_2_05)
-		? __memset_power6
-            : __memset_ppc);
+libc_ifunc_redirected (__redirect_memset, memset,
+		       (hwcap & PPC_FEATURE_HAS_VSX)
+		       ? __memset_power7
+		       : (hwcap & PPC_FEATURE_ARCH_2_05)
+			 ? __memset_power6
+			 : __memset_ppc);
 #endif
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/rawmemchr.c b/sysdeps/powerpc/powerpc32/power4/multiarch/rawmemchr.c
index f06030e..d72b5df 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/rawmemchr.c
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/rawmemchr.c
@@ -17,20 +17,21 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if IS_IN (libc)
+# define __rawmemchr __redirect___rawmemchr
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
 
 extern __typeof (__rawmemchr) __rawmemchr_ppc attribute_hidden;
 extern __typeof (__rawmemchr) __rawmemchr_power7 attribute_hidden;
+# undef __rawmemchr
 
 /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
    ifunc symbol properly.  */
-libc_ifunc (__rawmemchr,
-	    (hwcap & PPC_FEATURE_HAS_VSX)
-            ? __rawmemchr_power7
-            : __rawmemchr_ppc);
-
+libc_ifunc_redirected (__redirect___rawmemchr, __rawmemchr,
+		       (hwcap & PPC_FEATURE_HAS_VSX)
+		       ? __rawmemchr_power7
+		       : __rawmemchr_ppc);
 weak_alias (__rawmemchr, rawmemchr)
 #else
 #include <string/rawmemchr.c>
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/strchr.c b/sysdeps/powerpc/powerpc32/power4/multiarch/strchr.c
index 2cfde63..c23384f 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/strchr.c
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/strchr.c
@@ -18,18 +18,22 @@
 
 /* Define multiple versions only for definition in libc.  */
 #if defined SHARED && IS_IN (libc)
+# define strchr __redirect_strchr
+/* Omit the strchr inline definitions because it would redefine strchr.  */
+# define __NO_STRING_INLINES
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
 
 extern __typeof (strchr) __strchr_ppc attribute_hidden;
 extern __typeof (strchr) __strchr_power7 attribute_hidden;
+# undef strchr
 
 /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
    ifunc symbol properly.  */
-libc_ifunc (strchr,
-	    (hwcap & PPC_FEATURE_HAS_VSX)
-            ? __strchr_power7
-            : __strchr_ppc);
+libc_ifunc_redirected (__redirect_strchr,  strchr,
+		       (hwcap & PPC_FEATURE_HAS_VSX)
+		       ? __strchr_power7
+		       : __strchr_ppc);
 weak_alias (strchr, index)
 #endif
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/strlen.c b/sysdeps/powerpc/powerpc32/power4/multiarch/strlen.c
index af5921a..b676b26 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/strlen.c
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/strlen.c
@@ -17,15 +17,17 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined SHARED && IS_IN (libc)
+# define strlen __redirect_strlen
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
 
 extern __typeof (strlen) __strlen_ppc attribute_hidden;
 extern __typeof (strlen) __strlen_power7 attribute_hidden;
+# undef strlen
 
-libc_ifunc (strlen,
-            (hwcap & PPC_FEATURE_HAS_VSX)
-            ? __strlen_power7
-            : __strlen_ppc);
+libc_ifunc_redirected (__redirect_strlen, strlen,
+		       (hwcap & PPC_FEATURE_HAS_VSX)
+		       ? __strlen_power7
+		       : __strlen_ppc);
 #endif
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/strncmp.c b/sysdeps/powerpc/powerpc32/power4/multiarch/strncmp.c
index 7cc7628..c384b4c 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/strncmp.c
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/strncmp.c
@@ -18,6 +18,9 @@
 
 /* Define multiple versions only for definition in libc.  */
 #if defined SHARED && IS_IN (libc)
+# define strncmp __redirect_strncmp
+/* Omit the strncmp inline definitions because it would redefine strncmp.  */
+# define __NO_STRING_INLINES
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
@@ -25,11 +28,12 @@
 extern __typeof (strncmp) __strncmp_ppc attribute_hidden;
 extern __typeof (strncmp) __strncmp_power4 attribute_hidden;
 extern __typeof (strncmp) __strncmp_power7 attribute_hidden;
+# undef strncmp
 
 /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
    ifunc symbol properly.  */
-libc_ifunc (strncmp,
-            (hwcap & PPC_FEATURE_HAS_VSX)
-            ? __strncmp_power7
-            : __strncmp_ppc);
+libc_ifunc_redirected (__redirect_strncmp, strncmp,
+		       (hwcap & PPC_FEATURE_HAS_VSX)
+		       ? __strncmp_power7
+		       : __strncmp_ppc);
 #endif
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/strnlen.c b/sysdeps/powerpc/powerpc32/power4/multiarch/strnlen.c
index 8f1e7c9..c3681be 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/strnlen.c
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/strnlen.c
@@ -17,17 +17,20 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if IS_IN (libc)
+# define strnlen __redirect_strnlen
+# define __strnlen __redirect___strnlen
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
 
 extern __typeof (__strnlen) __strnlen_ppc attribute_hidden;
 extern __typeof (__strnlen) __strnlen_power7 attribute_hidden;
+# undef strnlen
+# undef __strnlen
 
-libc_ifunc (__strnlen,
-            (hwcap & PPC_FEATURE_HAS_VSX)
-            ? __strnlen_power7
-            : __strnlen_ppc);
+libc_ifunc_redirected (__redirect___strnlen, __strnlen,
+		       (hwcap & PPC_FEATURE_HAS_VSX)
+		       ? __strnlen_power7
+		       : __strnlen_ppc);
 weak_alias (__strnlen, strnlen)
-libc_hidden_def (strnlen)
 #endif
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c
index 067edc2..c7d67f1 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c
@@ -16,6 +16,9 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define __finite __redirect___finite
+#define __finitef __redirect___finitef
+#define __finitel __redirect___finitel
 #include <math.h>
 #include <math_ldbl_opt.h>
 #include <shlib-compat.h>
@@ -24,13 +27,16 @@
 extern __typeof (__finite) __finite_ppc64 attribute_hidden;
 extern __typeof (__finite) __finite_power7 attribute_hidden;
 extern __typeof (__finite) __finite_power8 attribute_hidden;
-
-libc_ifunc (__finite,
-	    (hwcap2 & PPC_FEATURE2_ARCH_2_07)
-	    ? __finite_power8 :
-	      (hwcap & PPC_FEATURE_ARCH_2_06)
-	      ? __finite_power7
-            : __finite_ppc64);
+#undef __finite
+#undef __finitef
+#undef __finitel
+
+libc_ifunc_redirected (__redirect___finite, __finite,
+		       (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+		       ? __finite_power8
+		       : (hwcap & PPC_FEATURE_ARCH_2_06)
+			 ? __finite_power7
+			 : __finite_ppc64);
 
 weak_alias (__finite, finite)
 
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c
index e0b4686..c9ecd0d 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finitef.c
@@ -16,6 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define __finitef __redirect___finitef
 #include <math.h>
 #include <shlib-compat.h>
 #include "init-arch.h"
@@ -24,12 +25,13 @@ extern __typeof (__finitef) __finitef_ppc64 attribute_hidden;
 /* The double-precision version also works for single-precision.  */
 extern __typeof (__finitef) __finite_power7 attribute_hidden;
 extern __typeof (__finitef) __finite_power8 attribute_hidden;
+#undef __finitef
 
-libc_ifunc (__finitef,
-	    (hwcap2 & PPC_FEATURE2_ARCH_2_07)
-	    ? __finite_power8 :
-	      (hwcap & PPC_FEATURE_ARCH_2_06)
-	      ? __finite_power7
-            : __finitef_ppc64);
+libc_ifunc_redirected (__redirect___finitef, __finitef,
+		       (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+		       ? __finite_power8
+		       : (hwcap & PPC_FEATURE_ARCH_2_06)
+			 ? __finite_power7
+			 : __finitef_ppc64);
 
 weak_alias (__finitef, finitef)
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c
index 07e159d..a13ec27 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinf.c
@@ -16,6 +16,9 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define __isinf __redirect___isinf
+#define __isinff __redirect___isinff
+#define __isinfl __redirect___isinfl
 #include <math.h>
 #include <math_ldbl_opt.h>
 #include <shlib-compat.h>
@@ -24,13 +27,16 @@
 extern __typeof (__isinf) __isinf_ppc64 attribute_hidden;
 extern __typeof (__isinf) __isinf_power7 attribute_hidden;
 extern __typeof (__isinf) __isinf_power8 attribute_hidden;
-
-libc_ifunc (__isinf,
-	    (hwcap2 & PPC_FEATURE2_ARCH_2_07)
-	    ? __isinf_power8 :
-	      (hwcap & PPC_FEATURE_ARCH_2_06)
-	      ? __isinf_power7
-            : __isinf_ppc64);
+#undef __isinf
+#undef __isinff
+#undef __isinfl
+
+libc_ifunc_redirected (__redirect___isinf, __isinf,
+		       (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+		       ? __isinf_power8
+		       : (hwcap & PPC_FEATURE_ARCH_2_06)
+			 ? __isinf_power7
+			 : __isinf_ppc64);
 
 weak_alias (__isinf, isinf)
 
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c
index 2cb161b..cafc118 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isinff.c
@@ -16,6 +16,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define __isinff __redirect___isinff
 #include <math.h>
 #include <math_ldbl_opt.h>
 #include <shlib-compat.h>
@@ -25,12 +26,13 @@ extern __typeof (__isinff) __isinff_ppc64 attribute_hidden;
 /* The double-precision version also works for single-precision.  */
 extern __typeof (__isinff) __isinf_power7 attribute_hidden;
 extern __typeof (__isinff) __isinf_power8 attribute_hidden;
+#undef __isinff
 
-libc_ifunc (__isinff,
-	    (hwcap2 & PPC_FEATURE2_ARCH_2_07)
-	    ? __isinf_power8 :
-	      (hwcap & PPC_FEATURE_ARCH_2_06)
-	      ? __isinf_power7
-            : __isinff_ppc64);
+libc_ifunc_redirected (__redirect___isinff, __isinff,
+		       (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+		       ? __isinf_power8
+		       : (hwcap & PPC_FEATURE_ARCH_2_06)
+			 ? __isinf_power7
+			 : __isinff_ppc64);
 
 weak_alias (__isinff, isinff)
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c
index a614f25..fce3c9d 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnan.c
@@ -16,6 +16,9 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define __isnan __redirect___isnan
+#define __isnanf __redirect___isnanf
+#define __isnanl __redirect___isnanl
 #include <math.h>
 #include <math_ldbl_opt.h>
 #include <shlib-compat.h>
@@ -27,19 +30,22 @@ extern __typeof (__isnan) __isnan_power6 attribute_hidden;
 extern __typeof (__isnan) __isnan_power6x attribute_hidden;
 extern __typeof (__isnan) __isnan_power7 attribute_hidden;
 extern __typeof (__isnan) __isnan_power8 attribute_hidden;
-
-libc_ifunc (__isnan,
-	    (hwcap2 & PPC_FEATURE2_ARCH_2_07)
-	    ? __isnan_power8 :
-	      (hwcap & PPC_FEATURE_ARCH_2_06)
-	      ? __isnan_power7 :
-		(hwcap & PPC_FEATURE_POWER6_EXT)
-		? __isnan_power6x :
-		  (hwcap & PPC_FEATURE_ARCH_2_05)
-		    ? __isnan_power6 :
-		    (hwcap & PPC_FEATURE_POWER5)
-		      ? __isnan_power5
-            : __isnan_ppc64);
+#undef __isnan
+#undef __isnanf
+#undef __isnanl
+
+libc_ifunc_redirected (__redirect___isnan, __isnan,
+		       (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+		       ? __isnan_power8
+		       : (hwcap & PPC_FEATURE_ARCH_2_06)
+			 ? __isnan_power7
+			 : (hwcap & PPC_FEATURE_POWER6_EXT)
+			   ? __isnan_power6x
+			   : (hwcap & PPC_FEATURE_ARCH_2_05)
+			     ? __isnan_power6
+			     : (hwcap & PPC_FEATURE_POWER5)
+			       ? __isnan_power5
+			       : __isnan_ppc64);
 
 weak_alias (__isnan, isnan)
 
diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c
index acbc131..72e9a07 100644
--- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c
+++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_isnanf.c
@@ -40,4 +40,5 @@ libc_ifunc (__isnanf,
 		      ? __isnan_power5
             : __isnan_ppc64);
 
+hidden_def (__isnanf)
 weak_alias (__isnanf, isnanf)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memcmp.c b/sysdeps/powerpc/powerpc64/multiarch/memcmp.c
index e8cf6ae..a45ebd7 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/memcmp.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/memcmp.c
@@ -18,6 +18,7 @@
 
 /* Define multiple versions only for definition in libc.  */
 #if IS_IN (libc)
+# define memcmp __redirect_memcmp
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
@@ -25,15 +26,16 @@
 extern __typeof (memcmp) __memcmp_ppc attribute_hidden;
 extern __typeof (memcmp) __memcmp_power4 attribute_hidden;
 extern __typeof (memcmp) __memcmp_power7 attribute_hidden;
+# undef memcmp
 
 /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
    ifunc symbol properly.  */
-libc_ifunc (memcmp,
-            (hwcap & PPC_FEATURE_HAS_VSX)
-            ? __memcmp_power7 :
-	      (hwcap & PPC_FEATURE_POWER4)
-		? __memcmp_power4
-            : __memcmp_ppc);
+libc_ifunc_redirected (__redirect_memcmp, memcmp,
+		       (hwcap & PPC_FEATURE_HAS_VSX)
+		       ? __memcmp_power7
+		       : (hwcap & PPC_FEATURE_POWER4)
+			 ? __memcmp_power4
+			 : __memcmp_ppc);
 #else
 #include <string/memcmp.c>
 #endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/mempcpy.c b/sysdeps/powerpc/powerpc64/multiarch/mempcpy.c
index 3c77b5f..36ec954 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/mempcpy.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/mempcpy.c
@@ -17,23 +17,28 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if IS_IN (libc)
+# define mempcpy __redirect_mempcpy
+# define __mempcpy __redirect___mempcpy
 # define NO_MEMPCPY_STPCPY_REDIRECT
+/* Omit the mempcpy inline definitions because it would redefine mempcpy.  */
+# define _HAVE_STRING_ARCH_mempcpy 1
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
 
 extern __typeof (__mempcpy) __mempcpy_ppc attribute_hidden;
 extern __typeof (__mempcpy) __mempcpy_power7 attribute_hidden;
+# undef mempcpy
+# undef __mempcpy
 
 /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
    ifunc symbol properly.  */
-libc_ifunc (__mempcpy,
-	    (hwcap & PPC_FEATURE_HAS_VSX)
-            ? __mempcpy_power7
-            : __mempcpy_ppc);
+libc_ifunc_redirected (__redirect___mempcpy, __mempcpy,
+		       (hwcap & PPC_FEATURE_HAS_VSX)
+		       ? __mempcpy_power7
+		       : __mempcpy_ppc);
 
 weak_alias (__mempcpy, mempcpy)
-libc_hidden_def (mempcpy)
 #else
 # include <string/mempcpy.c>
 #endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/rawmemchr.c b/sysdeps/powerpc/powerpc64/multiarch/rawmemchr.c
index f06030e..b53b148 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/rawmemchr.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/rawmemchr.c
@@ -17,19 +17,21 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if IS_IN (libc)
+# define __rawmemchr __redirect___rawmemchr
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
 
 extern __typeof (__rawmemchr) __rawmemchr_ppc attribute_hidden;
 extern __typeof (__rawmemchr) __rawmemchr_power7 attribute_hidden;
+# undef __rawmemchr
 
 /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
    ifunc symbol properly.  */
-libc_ifunc (__rawmemchr,
-	    (hwcap & PPC_FEATURE_HAS_VSX)
-            ? __rawmemchr_power7
-            : __rawmemchr_ppc);
+libc_ifunc_redirected (__redirect___rawmemchr, __rawmemchr,
+		       (hwcap & PPC_FEATURE_HAS_VSX)
+		       ? __rawmemchr_power7
+		       : __rawmemchr_ppc);
 
 weak_alias (__rawmemchr, rawmemchr)
 #else
diff --git a/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c b/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
index bbc1691..3867b9e 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
@@ -34,6 +34,7 @@ libc_ifunc (__stpcpy,
             : __stpcpy_ppc);
 
 weak_alias (__stpcpy, stpcpy)
+libc_hidden_def (__stpcpy)
 libc_hidden_def (stpcpy)
 #else
 # include <string/stpcpy.c>
diff --git a/sysdeps/powerpc/powerpc64/multiarch/stpncpy.c b/sysdeps/powerpc/powerpc64/multiarch/stpncpy.c
index b1484b1..fb3b529 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/stpncpy.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/stpncpy.c
@@ -17,6 +17,8 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if IS_IN (libc)
+# define stpncpy __redirect_stpncpy
+# define __stpncpy __redirect___stpncpy
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
@@ -24,13 +26,14 @@
 extern __typeof (__stpncpy) __stpncpy_ppc attribute_hidden;
 extern __typeof (__stpncpy) __stpncpy_power7 attribute_hidden;
 extern __typeof (__stpncpy) __stpncpy_power8 attribute_hidden;
+# undef stpncpy
+# undef __stpncpy
 
-libc_ifunc (__stpncpy,
-            (hwcap2 & PPC_FEATURE2_ARCH_2_07)
-            ? __stpncpy_power8 :
-              (hwcap & PPC_FEATURE_HAS_VSX)
-              ? __stpncpy_power7
-            : __stpncpy_ppc);
-
+libc_ifunc_redirected (__redirect___stpncpy, __stpncpy,
+		       (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+		       ? __stpncpy_power8
+		       : (hwcap & PPC_FEATURE_HAS_VSX)
+			 ? __stpncpy_power7
+			 : __stpncpy_ppc);
 weak_alias (__stpncpy, stpncpy)
 #endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strcat.c b/sysdeps/powerpc/powerpc64/multiarch/strcat.c
index a2894ae..5080ed1 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strcat.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/strcat.c
@@ -17,6 +17,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if IS_IN (libc)
+# define strcat __redirect_strcat
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
@@ -24,11 +25,12 @@
 extern __typeof (strcat) __strcat_ppc attribute_hidden;
 extern __typeof (strcat) __strcat_power7 attribute_hidden;
 extern __typeof (strcat) __strcat_power8 attribute_hidden;
+# undef strcat
 
-libc_ifunc (strcat,
-            (hwcap2 & PPC_FEATURE2_ARCH_2_07)
-            ? __strcat_power8 :
-              (hwcap & PPC_FEATURE_HAS_VSX)
-              ? __strcat_power7
-            : __strcat_ppc);
+libc_ifunc_redirected (__redirect_strcat, strcat,
+		       (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+		       ? __strcat_power8
+		       : (hwcap & PPC_FEATURE_HAS_VSX)
+			 ? __strcat_power7
+			 : __strcat_ppc);
 #endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strchr.c b/sysdeps/powerpc/powerpc64/multiarch/strchr.c
index 2cfde63..e24d6b3 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strchr.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/strchr.c
@@ -18,18 +18,22 @@
 
 /* Define multiple versions only for definition in libc.  */
 #if defined SHARED && IS_IN (libc)
+# define strchr __redirect_strchr
+/* Omit the strchr inline definitions because it would redefine strchr.  */
+# define __NO_STRING_INLINES
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
 
 extern __typeof (strchr) __strchr_ppc attribute_hidden;
 extern __typeof (strchr) __strchr_power7 attribute_hidden;
+# undef strchr
 
 /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
    ifunc symbol properly.  */
-libc_ifunc (strchr,
-	    (hwcap & PPC_FEATURE_HAS_VSX)
-            ? __strchr_power7
-            : __strchr_ppc);
+libc_ifunc_redirected (__redirect_strchr, strchr,
+		       (hwcap & PPC_FEATURE_HAS_VSX)
+		       ? __strchr_power7
+		       : __strchr_ppc);
 weak_alias (strchr, index)
 #endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strcmp.c b/sysdeps/powerpc/powerpc64/multiarch/strcmp.c
index aee888a..06f89cb 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strcmp.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/strcmp.c
@@ -17,6 +17,9 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined SHARED && IS_IN (libc)
+# define strcmp __redirect_strcmp
+/* Omit the strcmp inline definitions because it would redefine strcmp.  */
+# define __NO_STRING_INLINES
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
@@ -24,11 +27,12 @@
 extern __typeof (strcmp) __strcmp_ppc attribute_hidden;
 extern __typeof (strcmp) __strcmp_power7 attribute_hidden;
 extern __typeof (strcmp) __strcmp_power8 attribute_hidden;
+# undef strcmp
 
-libc_ifunc (strcmp,
-            (hwcap2 & PPC_FEATURE2_ARCH_2_07)
-              ? __strcmp_power8 :
-              (hwcap & PPC_FEATURE_HAS_VSX)
-              ? __strcmp_power7
-            : __strcmp_ppc);
+libc_ifunc_redirected (__redirect_strcmp, strcmp,
+		       (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+		       ? __strcmp_power8
+		       : (hwcap & PPC_FEATURE_HAS_VSX)
+			 ? __strcmp_power7
+			 : __strcmp_ppc);
 #endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strcpy.c b/sysdeps/powerpc/powerpc64/multiarch/strcpy.c
index d2c3858..8708fc7 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strcpy.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/strcpy.c
@@ -17,6 +17,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined SHARED && IS_IN (libc)
+# define strcpy __redirect_strcpy
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
@@ -24,11 +25,12 @@
 extern __typeof (strcpy) __strcpy_ppc attribute_hidden;
 extern __typeof (strcpy) __strcpy_power7 attribute_hidden;
 extern __typeof (strcpy) __strcpy_power8 attribute_hidden;
+#undef strcpy
 
-libc_ifunc (strcpy,
-            (hwcap2 & PPC_FEATURE2_ARCH_2_07)
-            ? __strcpy_power8 :
-              (hwcap & PPC_FEATURE_HAS_VSX)
-              ? __strcpy_power7
-            : __strcpy_ppc);
+libc_ifunc_redirected (__redirect_strcpy, strcpy,
+		       (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+		       ? __strcpy_power8
+		       : (hwcap & PPC_FEATURE_HAS_VSX)
+			 ? __strcpy_power7
+			 : __strcpy_ppc);
 #endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strncmp.c b/sysdeps/powerpc/powerpc64/multiarch/strncmp.c
index 1eb6e51..63a1aa0 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strncmp.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/strncmp.c
@@ -18,6 +18,9 @@
 
 /* Define multiple versions only for definition in libc.  */
 #if defined SHARED && IS_IN (libc)
+# define strncmp __redirect_strncmp
+/* Omit the strncmp inline definitions because it would redefine strncmp.  */
+# define __NO_STRING_INLINES
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
@@ -26,15 +29,16 @@ extern __typeof (strncmp) __strncmp_ppc attribute_hidden;
 extern __typeof (strncmp) __strncmp_power4 attribute_hidden;
 extern __typeof (strncmp) __strncmp_power7 attribute_hidden;
 extern __typeof (strncmp) __strncmp_power8 attribute_hidden;
+# undef strncmp
 
 /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
    ifunc symbol properly.  */
-libc_ifunc (strncmp,
-            (hwcap2 & PPC_FEATURE2_ARCH_2_07)
-            ? __strncmp_power8 :
-              (hwcap & PPC_FEATURE_HAS_VSX)
-              ? __strncmp_power7 :
-		(hwcap & PPC_FEATURE_POWER4)
-		? __strncmp_power4
-            : __strncmp_ppc);
+libc_ifunc_redirected (__redirect_strncmp, strncmp,
+		       (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+		       ? __strncmp_power8
+		       : (hwcap & PPC_FEATURE_HAS_VSX)
+			 ? __strncmp_power7
+			 : (hwcap & PPC_FEATURE_POWER4)
+			   ? __strncmp_power4
+			   : __strncmp_ppc);
 #endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strncpy.c b/sysdeps/powerpc/powerpc64/multiarch/strncpy.c
index 0176514..64495df 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strncpy.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/strncpy.c
@@ -18,6 +18,9 @@
 
 /* Define multiple versions only for definition in libc. */
 #if IS_IN (libc)
+# define strncpy __redirect_strncpy
+/* Omit the strncpy inline definitions because it would redefine strncpy.  */
+# define __NO_STRING_INLINES
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
@@ -25,14 +28,15 @@
 extern __typeof (strncpy) __strncpy_ppc attribute_hidden;
 extern __typeof (strncpy) __strncpy_power7 attribute_hidden;
 extern __typeof (strncpy) __strncpy_power8 attribute_hidden;
+# undef strncpy
 
 /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
  ifunc symbol properly. */
-libc_ifunc (strncpy,
-            (hwcap2 & PPC_FEATURE2_ARCH_2_07)
-            ? __strncpy_power8 :
-              (hwcap & PPC_FEATURE_HAS_VSX)
-              ? __strncpy_power7
-            : __strncpy_ppc);
+libc_ifunc_redirected (__redirect_strncpy, strncpy,
+		       (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+		       ? __strncpy_power8
+		       : (hwcap & PPC_FEATURE_HAS_VSX)
+			 ? __strncpy_power7
+			 : __strncpy_ppc);
 
 #endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strnlen.c b/sysdeps/powerpc/powerpc64/multiarch/strnlen.c
index c4907e9..71dc12d 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strnlen.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/strnlen.c
@@ -17,19 +17,21 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if IS_IN (libc)
+# define strnlen __redirect_strnlen
+# define __strnlen __redirect___strnlen
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
 
 extern __typeof (__strnlen) __strnlen_ppc attribute_hidden;
 extern __typeof (__strnlen) __strnlen_power7 attribute_hidden;
-
-libc_ifunc (__strnlen,
-            (hwcap & PPC_FEATURE_HAS_VSX)
-            ? __strnlen_power7
-            : __strnlen_ppc);
+# undef strnlen
+# undef __strnlen
+libc_ifunc_redirected (__redirect___strnlen, __strnlen,
+		       (hwcap & PPC_FEATURE_HAS_VSX)
+		       ? __strnlen_power7
+		       : __strnlen_ppc);
 weak_alias (__strnlen, strnlen)
-libc_hidden_def (strnlen)
 
 #else
 #include <string/strnlen.c>
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strrchr.c b/sysdeps/powerpc/powerpc64/multiarch/strrchr.c
index 45742bc..e485b02 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strrchr.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/strrchr.c
@@ -18,18 +18,20 @@
 
 /* Define multiple versions only for definition in libc.  */
 #if IS_IN (libc)
+# define strrchr __redirect_strrchr
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
 
 extern __typeof (strrchr) __strrchr_ppc attribute_hidden;
 extern __typeof (strrchr) __strrchr_power7 attribute_hidden;
+#undef strrchr
 
 /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
    ifunc symbol properly.  */
-libc_ifunc (strrchr,
-            (hwcap & PPC_FEATURE_HAS_VSX)
-            ? __strrchr_power7
-            : __strrchr_ppc);
+libc_ifunc_redirected (__redirect_strrchr, strrchr,
+		       (hwcap & PPC_FEATURE_HAS_VSX)
+		       ? __strrchr_power7
+		       : __strrchr_ppc);
 weak_alias (strrchr, rindex)
 #endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strstr.c b/sysdeps/powerpc/powerpc64/multiarch/strstr.c
index 7efc4b0..9a390c2 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strstr.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/strstr.c
@@ -18,17 +18,19 @@
 
 /* Define multiple versions only for definition in libc.  */
 #if IS_IN (libc)
+# define strstr __redirect_strstr
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
 
 extern __typeof (strstr) __strstr_ppc attribute_hidden;
 extern __typeof (strstr) __strstr_power7 attribute_hidden;
+# undef strstr
 
 /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
    ifunc symbol properly.  */
-libc_ifunc (strstr,
-            (hwcap & PPC_FEATURE_HAS_VSX)
-            ? __strstr_power7
-            : __strstr_ppc);
+libc_ifunc_redirected (__redirect_strstr, strstr,
+		       (hwcap & PPC_FEATURE_HAS_VSX)
+		       ? __strstr_power7
+		       : __strstr_ppc);
 #endif
diff --git a/sysdeps/powerpc/powerpc64/multiarch/wcschr.c b/sysdeps/powerpc/powerpc64/multiarch/wcschr.c
index 44c9b97..a470542 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/wcschr.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/wcschr.c
@@ -17,6 +17,8 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if IS_IN (libc)
+# define wcschr __redirect_wcschr
+# define __wcschr __redirect___wcschr
 # include <wchar.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
@@ -24,15 +26,16 @@
 extern __typeof (wcschr) __wcschr_ppc attribute_hidden;
 extern __typeof (wcschr) __wcschr_power6 attribute_hidden;
 extern __typeof (wcschr) __wcschr_power7 attribute_hidden;
+# undef wcschr
+# undef __wcschr
 
-libc_ifunc (__wcschr,
-	     (hwcap & PPC_FEATURE_HAS_VSX)
-             ? __wcschr_power7 :
-	       (hwcap & PPC_FEATURE_ARCH_2_05)
-	       ? __wcschr_power6
-             : __wcschr_ppc);
+libc_ifunc_redirected (__redirect___wcschr, __wcschr,
+		       (hwcap & PPC_FEATURE_HAS_VSX)
+		       ? __wcschr_power7
+		       : (hwcap & PPC_FEATURE_ARCH_2_05)
+			 ? __wcschr_power6
+			 : __wcschr_ppc);
 weak_alias (__wcschr, wcschr)
-libc_hidden_builtin_def (wcschr)
 #else
 #undef libc_hidden_def
 #define libc_hidden_def(a)
-- 
2.5.5

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 4/9] i386, x86: Use libc_ifunc macro for time, gettimeofday.
  2016-08-08 14:40 [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Stefan Liebler
                   ` (5 preceding siblings ...)
  2016-08-08 14:40 ` [PATCH v2 7/9] Use libc_ifunc macro for system in libpthread Stefan Liebler
@ 2016-08-08 14:40 ` Stefan Liebler
  2016-08-08 16:08 ` [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Paul E. Murphy
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Stefan Liebler @ 2016-08-08 14:40 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, fweimer, murphyp, schwab, joseph_myers

This patch uses the libc_ifunc_redirected macro to create already existing ifunc
functions time and gettimeofday on intel. This way, the libc_hidden_def macro can
be used instead of the libc_ifunc_hidden_def one which was only used here. Thus the
macro is removed from libc-symbols.h.
On i386, the __GI_* symbols do not target the ifunc symbol and thus the
redirection construct has to be applied here.

ChangeLog:

	* sysdeps/unix/sysv/linux/x86/gettimeofday.c (__gettimeofday):
	Use libc_ifunc_redirected macro. Use libc_hidden_def instead of
	libc_ifunc_hidden_def.
	* sysdeps/unix/sysv/linux/x86/time.c (time): Likewise.
	* sysdeps/unix/sysv/linux/i386/gettimeofday.c (__gettimeofday):
	Redirect ifunced function in header for using it as type of ifunc'ed
	function. Redefine libc_hidden_def to use fallback non ifunc'ed
	fallback function for __GI_* symbol.
	* sysdeps/unix/sysv/linux/i386/time.c (time): Likewise.
	* include/libc-symbols.h
	(libc_ifunc_hidden_def, libc_ifunc_hidden_def1): Delete macro.
---
 include/libc-symbols.h                      | 15 ---------------
 sysdeps/unix/sysv/linux/i386/gettimeofday.c | 14 ++++++++++----
 sysdeps/unix/sysv/linux/i386/time.c         | 14 +++++++++++---
 sysdeps/unix/sysv/linux/x86/gettimeofday.c  | 28 ++++++++++++++--------------
 sysdeps/unix/sysv/linux/x86/time.c          | 25 ++++++++++++-------------
 5 files changed, 47 insertions(+), 49 deletions(-)

diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index b95a0f9..0d515a9 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -738,21 +738,6 @@ for linking")
 #define libm_ifunc_init()
 #define libm_ifunc(name, expr) __ifunc (name, name, expr, void, libm_ifunc_init)
 
-#ifdef HAVE_ASM_SET_DIRECTIVE
-# define libc_ifunc_hidden_def1(local, name)				\
-    __asm__ (".globl " #local "\n\t"					\
-	     ".hidden " #local "\n\t"					\
-	     ".set " #local ", " #name);
-#else
-# define libc_ifunc_hidden_def1(local, name)				\
-    __asm__ (".globl " #local "\n\t"					\
-	     ".hidden " #local "\n\t"					\
-	     #local " = " #name);
-#endif
-
-#define libc_ifunc_hidden_def(name) \
-  libc_ifunc_hidden_def1 (__GI_##name, name)
-
 /* Add the compiler optimization to inhibit loop transformation to library
    calls.  This is used to avoid recursive calls in memset and memmove
    default implementations.  */
diff --git a/sysdeps/unix/sysv/linux/i386/gettimeofday.c b/sysdeps/unix/sysv/linux/i386/gettimeofday.c
index 965bb81..6ab1215 100644
--- a/sysdeps/unix/sysv/linux/i386/gettimeofday.c
+++ b/sysdeps/unix/sysv/linux/i386/gettimeofday.c
@@ -16,14 +16,20 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifdef SHARED
+# define __gettimeofday __redirect___gettimeofday
+#endif
+
 #include <sys/time.h>
 
 #ifdef SHARED
+# undef __gettimeofday
+# define __gettimeofday_type __redirect___gettimeofday
 
-# undef libc_ifunc_hidden_def
-# define libc_ifunc_hidden_def(name)  \
-  libc_ifunc_hidden_def1 (__GI_##name, __gettimeofday_syscall)
-
+# undef libc_hidden_def
+# define libc_hidden_def(name) \
+  __hidden_ver1 (__gettimeofday_syscall, __GI___gettimeofday, \
+	       __gettimeofday_syscall);
 #endif
 
 #include <sysdeps/unix/sysv/linux/x86/gettimeofday.c>
diff --git a/sysdeps/unix/sysv/linux/i386/time.c b/sysdeps/unix/sysv/linux/i386/time.c
index 62b78b2..980a118 100644
--- a/sysdeps/unix/sysv/linux/i386/time.c
+++ b/sysdeps/unix/sysv/linux/i386/time.c
@@ -17,10 +17,18 @@
    <http://www.gnu.org/licenses/>.  */
 
 #ifdef SHARED
+# define time __redirect_time
+#endif
+
+#include <time.h>
+
+#ifdef SHARED
+# undef time
+# define time_type __redirect_time
 
-# undef libc_ifunc_hidden_def
-# define libc_ifunc_hidden_def(name)  \
-  libc_ifunc_hidden_def1 (__GI_##name, __time_syscall)
+# undef libc_hidden_def
+# define libc_hidden_def(name)  \
+  __hidden_ver1 (__time_syscall, __GI_time, __time_syscall);
 #endif
 
 #include <sysdeps/unix/sysv/linux/x86/time.c>
diff --git a/sysdeps/unix/sysv/linux/x86/gettimeofday.c b/sysdeps/unix/sysv/linux/x86/gettimeofday.c
index 36f7c26..1a2f6ed 100644
--- a/sysdeps/unix/sysv/linux/x86/gettimeofday.c
+++ b/sysdeps/unix/sysv/linux/x86/gettimeofday.c
@@ -29,20 +29,20 @@ __gettimeofday_syscall (struct timeval *tv, struct timezone *tz)
   return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
 }
 
-void *gettimeofday_ifunc (void) __asm__ ("__gettimeofday");
-
-void *
-gettimeofday_ifunc (void)
-{
-  PREPARE_VERSION_KNOWN (linux26, LINUX_2_6);
-
-  /* If the vDSO is not available we fall back to syscall.  */
-  return (_dl_vdso_vsym ("__vdso_gettimeofday", &linux26)
-	  ?: (void*) (&__gettimeofday_syscall));
-}
-asm (".type __gettimeofday, %gnu_indirect_function");
-
-libc_ifunc_hidden_def(__gettimeofday)
+# ifndef __gettimeofday_type
+/* The i386 gettimeofday.c includes this file with a defined
+   __gettimeofday_type macro.  For x86_64 we have to define it to __gettimeofday
+   as the internal symbol is the ifunc'ed one.  */
+#  define __gettimeofday_type __gettimeofday
+# endif
+
+# undef INIT_ARCH
+# define INIT_ARCH() PREPARE_VERSION_KNOWN (linux26, LINUX_2_6)
+/* If the vDSO is not available we fall back to syscall.  */
+libc_ifunc_redirected (__gettimeofday_type, __gettimeofday,
+		       (_dl_vdso_vsym ("__vdso_gettimeofday", &linux26)
+			?: &__gettimeofday_syscall))
+libc_hidden_def (__gettimeofday)
 
 #else
 
diff --git a/sysdeps/unix/sysv/linux/x86/time.c b/sysdeps/unix/sysv/linux/x86/time.c
index f5f7f91..0bac3ff 100644
--- a/sysdeps/unix/sysv/linux/x86/time.c
+++ b/sysdeps/unix/sysv/linux/x86/time.c
@@ -30,20 +30,19 @@ __time_syscall (time_t *t)
   return INTERNAL_SYSCALL (time, err, 1, t);
 }
 
-void *time_ifunc (void) __asm__ ("time");
-
-void *
-time_ifunc (void)
-{
-  PREPARE_VERSION_KNOWN (linux26, LINUX_2_6);
-
+# ifndef time_type
+/* The i386 time.c includes this file with a defined time_type macro.
+   For x86_64 we have to define it to time as the internal symbol is the
+   ifunc'ed one.  */
+#  define time_type time
+# endif
+
+#undef INIT_ARCH
+#define INIT_ARCH() PREPARE_VERSION_KNOWN (linux26, LINUX_2_6);
 /* If the vDSO is not available we fall back on the syscall.  */
-  return _dl_vdso_vsym ("__vdso_time", &linux26)
-			?: (void*) &__time_syscall;
-}
-asm (".type time, %gnu_indirect_function");
-
-libc_ifunc_hidden_def(time)
+libc_ifunc_redirected (time_type, time, (_dl_vdso_vsym ("__vdso_time", &linux26)
+					 ?:  &__time_syscall))
+libc_hidden_def (time)
 
 #else
 
-- 
2.5.5

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 7/9] Use libc_ifunc macro for system in libpthread.
  2016-08-08 14:40 [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Stefan Liebler
                   ` (4 preceding siblings ...)
  2016-08-08 14:40 ` [PATCH v2 5/9] ppc: Use libc_ifunc macro for time, gettimeofday Stefan Liebler
@ 2016-08-08 14:40 ` Stefan Liebler
  2016-08-08 14:40 ` [PATCH v2 4/9] i386, x86: Use libc_ifunc macro for time, gettimeofday Stefan Liebler
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Stefan Liebler @ 2016-08-08 14:40 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, fweimer, murphyp, schwab, joseph_myers

This patch uses the libc_ifunc macro to create already existing ifunc function
system_ifunc if HAVE_IFUNC is defined.

ChangeLog:

	* nptl/pt-system.c (system_ifunc): Use libc_ifunc macro.
---
 nptl/pt-system.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/nptl/pt-system.c b/nptl/pt-system.c
index 56f2a89..cc415da 100644
--- a/nptl/pt-system.c
+++ b/nptl/pt-system.c
@@ -32,21 +32,10 @@
 
 # if HAVE_IFUNC
 
-static __typeof (system) *
-__attribute__ ((used))
-system_resolve (void)
-{
-  return &__libc_system;
-}
-
-asm (".globl system_ifunc\n"
-     ".type system_ifunc, %gnu_indirect_function");
-
-#  ifdef HAVE_ASM_SET_DIRECTIVE
-asm (".set system_ifunc, system_resolve");
-#  else
-asm ("system_ifunc = system_resolve");
-#  endif
+extern __typeof(system) system_ifunc;
+#  undef INIT_ARCH
+#  define INIT_ARCH()
+libc_ifunc (system_ifunc, &__libc_system)
 
 # else  /* !HAVE_IFUNC */
 
-- 
2.5.5

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 6/9] Use libc_ifunc macro for clock_* symbols in librt.
  2016-08-08 14:40 [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Stefan Liebler
@ 2016-08-08 14:40 ` Stefan Liebler
  2016-08-08 14:40 ` [PATCH v2 3/9] s390: Refactor ifunc resolvers due to false debuginfo Stefan Liebler
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Stefan Liebler @ 2016-08-08 14:40 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, fweimer, murphyp, schwab, joseph_myers

This patch uses the libc_ifunc macro to create already existing ifunc functions
clock_getres, clock_gettime, clock_settime, clock_getcpuclockid and
clock_nanosleep. If HAVE_IFUNC is defined, the macro COMPAT_REDIRECT uses
the libc_ifunc macro.
Furthermore some whitespace damage is cleaned.

ChangeLog:

	* rt/clock-compat.c (COMPAT_REDIRECT): Use libc_ifunc macro.
---
 rt/clock-compat.c | 34 +++++++++++++++-------------------
 1 file changed, 15 insertions(+), 19 deletions(-)

diff --git a/rt/clock-compat.c b/rt/clock-compat.c
index dc69e4a..b47781c 100644
--- a/rt/clock-compat.c
+++ b/rt/clock-compat.c
@@ -28,13 +28,9 @@
 #include <time.h>
 
 #if HAVE_IFUNC
-# define COMPAT_REDIRECT(name, proto, arglist)				      \
-  __typeof (name) *name##_ifunc (void) asm (#name);			      \
-  __typeof (name) *name##_ifunc (void)					      \
-  {									      \
-    return &__##name;							      \
-  }									      \
-  asm (".type " #name ", %gnu_indirect_function");
+# undef INIT_ARCH
+# define INIT_ARCH()
+# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name)
 #else
 # define COMPAT_REDIRECT(name, proto, arglist)				      \
   int									      \
@@ -45,21 +41,21 @@
 #endif
 
 COMPAT_REDIRECT (clock_getres,
-                 (clockid_t clock_id, struct timespec *res),
-                 (clock_id, res))
+		 (clockid_t clock_id, struct timespec *res),
+		 (clock_id, res))
 COMPAT_REDIRECT (clock_gettime,
-                 (clockid_t clock_id, struct timespec *tp),
-                 (clock_id, tp))
+		 (clockid_t clock_id, struct timespec *tp),
+		 (clock_id, tp))
 COMPAT_REDIRECT (clock_settime,
-                 (clockid_t clock_id, const struct timespec *tp),
-                 (clock_id, tp))
+		 (clockid_t clock_id, const struct timespec *tp),
+		 (clock_id, tp))
 COMPAT_REDIRECT (clock_getcpuclockid,
-                 (pid_t pid, clockid_t *clock_id),
-                 (pid, clock_id))
+		 (pid_t pid, clockid_t *clock_id),
+		 (pid, clock_id))
 COMPAT_REDIRECT (clock_nanosleep,
-                 (clockid_t clock_id, int flags,
-                  const struct timespec *req,
-                  struct timespec *rem),
-                 (clock_id, flags, req, rem))
+		 (clockid_t clock_id, int flags,
+		  const struct timespec *req,
+		  struct timespec *rem),
+		 (clock_id, flags, req, rem))
 
 #endif
-- 
2.5.5

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc.
@ 2016-08-08 14:40 Stefan Liebler
  2016-08-08 14:40 ` [PATCH v2 6/9] Use libc_ifunc macro for clock_* symbols in librt Stefan Liebler
                   ` (10 more replies)
  0 siblings, 11 replies; 21+ messages in thread
From: Stefan Liebler @ 2016-08-08 14:40 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, fweimer, murphyp, schwab, joseph_myers

This patch adds a configure check to test if gcc supports attribute ifunc.
The support can either be enabled in <gcc-src>/gcc/config.gcc for one
architecture in general by setting default_gnu_indirect_function variable to yes
or by configuring gcc with --enable-gnu-indirect-function.

The next patch rewrites libc_ifunc macro to use gcc attribute ifunc instead
of inline assembly to generate the IFUNC symbols due to false debuginfo.

If gcc does not support attribute ifunc and glibc is configured with
--enable-multi-arch then configure will abort with an error message.
If --enable-multi-arch is not given then configure will silently
disable multi-arch support.

ChangeLog:

	* configure.ac: Add check if gcc supports attribute ifunc feature.
	* configure: Regenerated.
---
 configure    | 38 +++++++++++++++++++++++++++++++++++---
 configure.ac | 32 +++++++++++++++++++++++++++++---
 2 files changed, 64 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index 17625e1..aedada3 100755
--- a/configure
+++ b/configure
@@ -3914,9 +3914,40 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ld_gnu_indirect_function" >&5
 $as_echo "$libc_cv_ld_gnu_indirect_function" >&6; }
 
-if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
+# Check if gcc supports attribute ifunc as it is used in libc_ifunc macro.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc attribute ifunc support" >&5
+$as_echo_n "checking for gcc attribute ifunc support... " >&6; }
+if ${libc_cv_gcc_indirect_function+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.c <<EOF
+extern int func (int);
+int used_func (int a)
+{
+  return a;
+}
+static void *resolver ()
+{
+  return &used_func;
+}
+extern __typeof (func) func __attribute__ ((ifunc ("resolver")));
+EOF
+libc_cv_gcc_indirect_function=no
+if ${CC-cc} -c conftest.c -o conftest.o 1>&5 \
+   2>&5 ; then
+  if $READELF -s conftest.o | grep IFUNC >/dev/null 2>&5; then
+    libc_cv_gcc_indirect_function=yes
+  fi
+fi
+rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_gcc_indirect_function" >&5
+$as_echo "$libc_cv_gcc_indirect_function" >&6; }
+
+if test x"$libc_cv_ld_gnu_indirect_function" != xyes \
+   || test x"$libc_cv_gcc_indirect_function" != xyes; then
   if test x"$multi_arch" = xyes; then
-    as_fn_error $? "--enable-multi-arch support requires assembler and linker support" "$LINENO" 5
+    as_fn_error $? "--enable-multi-arch support require gcc, assembler and linker indirect-function support" "$LINENO" 5
   else
     multi_arch=no
   fi
@@ -6499,7 +6530,8 @@ fi
 
 # A sysdeps configure fragment can reset this if IFUNC is not actually
 # usable even though the assembler knows how to generate the symbol type.
-if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
+if test x"$libc_cv_ld_gnu_indirect_function" = xyes \
+   && test x"$libc_cv_gcc_indirect_function" = xyes; then
   $as_echo "#define HAVE_IFUNC 1" >>confdefs.h
 
 fi
diff --git a/configure.ac b/configure.ac
index 33bcd62..0961151 100644
--- a/configure.ac
+++ b/configure.ac
@@ -634,9 +634,34 @@ if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
 fi
 rm -f conftest*])
 
-if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
+# Check if gcc supports attribute ifunc as it is used in libc_ifunc macro.
+AC_CACHE_CHECK([for gcc attribute ifunc support],
+	       libc_cv_gcc_indirect_function, [dnl
+cat > conftest.c <<EOF
+extern int func (int);
+int used_func (int a)
+{
+  return a;
+}
+static void *resolver ()
+{
+  return &used_func;
+}
+extern __typeof (func) func __attribute__ ((ifunc ("resolver")));
+EOF
+libc_cv_gcc_indirect_function=no
+if ${CC-cc} -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD \
+   2>&AS_MESSAGE_LOG_FD ; then
+  if $READELF -s conftest.o | grep IFUNC >/dev/null 2>&AS_MESSAGE_LOG_FD; then
+    libc_cv_gcc_indirect_function=yes
+  fi
+fi
+rm -f conftest*])
+
+if test x"$libc_cv_ld_gnu_indirect_function" != xyes \
+   || test x"$libc_cv_gcc_indirect_function" != xyes; then
   if test x"$multi_arch" = xyes; then
-    AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
+    AC_MSG_ERROR([--enable-multi-arch support require gcc, assembler and linker indirect-function support])
   else
     multi_arch=no
   fi
@@ -1766,7 +1791,8 @@ AC_SUBST(libc_cv_gcc_unwind_find_fde)
 
 # A sysdeps configure fragment can reset this if IFUNC is not actually
 # usable even though the assembler knows how to generate the symbol type.
-if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
+if test x"$libc_cv_ld_gnu_indirect_function" = xyes \
+   && test x"$libc_cv_gcc_indirect_function" = xyes; then
   AC_DEFINE(HAVE_IFUNC)
 fi
 
-- 
2.5.5

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 3/9] s390: Refactor ifunc resolvers due to false debuginfo.
  2016-08-08 14:40 [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Stefan Liebler
  2016-08-08 14:40 ` [PATCH v2 6/9] Use libc_ifunc macro for clock_* symbols in librt Stefan Liebler
@ 2016-08-08 14:40 ` Stefan Liebler
  2016-08-08 14:40 ` [PATCH v2 2/9] Use gcc attribute ifunc in libc_ifunc macro instead of inline assembly " Stefan Liebler
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Stefan Liebler @ 2016-08-08 14:40 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, fweimer, murphyp, schwab, joseph_myers

This patch adjusts the s390 specific ifunc helper macros in ifunc-resolve.h to
use the common __ifunc macro, which uses gcc attribute ifunc to get rid of the
false debuginfo. Therefore the redirection construct is applied where needed.

Perhaps in future we can switch some of the internal symbols __GI_* from the
fallback variant to the ifunc function. But this change is not
straightforward due to a segmentation fault while linking libc.so with older
binutils on s390.

ChangeLog:

	* sysdeps/s390/multiarch/ifunc-resolve.h
	(s390_vx_libc_ifunc2, s390_libc_ifunc): Use __ifunc from libc-symbols.h
	to create ifunc symbols.
	(s390_vx_libc_ifunc_init, s390_vx_libc_ifunc_redirected
	, s390_vx_libc_ifunc2_redirected, s390_libc_ifunc_init): New define.
	* sysdeps/s390/multiarch/memchr.c: Redirect ifunced function in header
	for using it as type for ifunc function.
	* sysdeps/s390/multiarch/mempcpy.c: Likewise.
	* sysdeps/s390/multiarch/rawmemchr.c: Likewise.
	* sysdeps/s390/multiarch/stpcpy.c: Likewise.
	* sysdeps/s390/multiarch/stpncpy.c: Likewise.
	* sysdeps/s390/multiarch/strcat.c: Likewise.
	* sysdeps/s390/multiarch/strchr.c: Likewise.
	* sysdeps/s390/multiarch/strcmp.c: Likewise.
	* sysdeps/s390/multiarch/strcpy.c: Likewise.
	* sysdeps/s390/multiarch/strcspn.c: Likewise.
	* sysdeps/s390/multiarch/strlen.c: Likewise.
	* sysdeps/s390/multiarch/strncmp.c: Likewise.
	* sysdeps/s390/multiarch/strncpy.c: Likewise.
	* sysdeps/s390/multiarch/strnlen.c: Likewise.
	* sysdeps/s390/multiarch/strpbrk.c: Likewise.
	* sysdeps/s390/multiarch/strrchr.c: Likewise.
	* sysdeps/s390/multiarch/strspn.c: Likewise.
	* sysdeps/s390/multiarch/wcschr.c: Likewise.
	* sysdeps/s390/multiarch/wcscmp.c: Likewise.
	* sysdeps/s390/multiarch/wcspbrk.c: Likewise.
	* sysdeps/s390/multiarch/wcsspn.c: Likewise.
	* sysdeps/s390/multiarch/wmemchr.c: Likewise.
	* sysdeps/s390/multiarch/wmemset.c: Likewise.
	* sysdeps/s390/s390-32/multiarch/memcmp.c: Likewise.
	* sysdeps/s390/s390-32/multiarch/memcpy.c: Likewise.
	* sysdeps/s390/s390-32/multiarch/memset.c: Likewise.
	* sysdeps/s390/s390-64/multiarch/memcmp.c: Likewise.
	* sysdeps/s390/s390-64/multiarch/memcpy.c: Likewise.
	* sysdeps/s390/s390-64/multiarch/memset.c: Likewise.
---
 sysdeps/s390/multiarch/ifunc-resolve.h  | 77 +++++++++++++++------------------
 sysdeps/s390/multiarch/memchr.c         |  5 ++-
 sysdeps/s390/multiarch/mempcpy.c        | 12 +++--
 sysdeps/s390/multiarch/rawmemchr.c      |  5 ++-
 sysdeps/s390/multiarch/stpcpy.c         |  9 +++-
 sysdeps/s390/multiarch/stpncpy.c        |  6 ++-
 sysdeps/s390/multiarch/strcat.c         |  4 +-
 sysdeps/s390/multiarch/strchr.c         |  6 ++-
 sysdeps/s390/multiarch/strcmp.c         |  7 ++-
 sysdeps/s390/multiarch/strcpy.c         |  5 ++-
 sysdeps/s390/multiarch/strcspn.c        |  6 ++-
 sysdeps/s390/multiarch/strlen.c         |  4 +-
 sysdeps/s390/multiarch/strncmp.c        |  9 ++--
 sysdeps/s390/multiarch/strncpy.c        |  7 ++-
 sysdeps/s390/multiarch/strnlen.c        |  7 ++-
 sysdeps/s390/multiarch/strpbrk.c        |  6 ++-
 sysdeps/s390/multiarch/strrchr.c        |  6 ++-
 sysdeps/s390/multiarch/strspn.c         |  6 ++-
 sysdeps/s390/multiarch/wcschr.c         |  7 ++-
 sysdeps/s390/multiarch/wcscmp.c         |  4 +-
 sysdeps/s390/multiarch/wcspbrk.c        |  4 +-
 sysdeps/s390/multiarch/wcsspn.c         |  4 +-
 sysdeps/s390/multiarch/wmemchr.c        |  7 ++-
 sysdeps/s390/multiarch/wmemset.c        |  7 ++-
 sysdeps/s390/s390-32/multiarch/memcmp.c |  7 ++-
 sysdeps/s390/s390-32/multiarch/memcpy.c |  5 ++-
 sysdeps/s390/s390-32/multiarch/memset.c |  5 ++-
 sysdeps/s390/s390-64/multiarch/memcmp.c |  7 ++-
 sysdeps/s390/s390-64/multiarch/memcpy.c |  5 ++-
 sysdeps/s390/s390-64/multiarch/memset.c |  5 ++-
 30 files changed, 169 insertions(+), 85 deletions(-)

diff --git a/sysdeps/s390/multiarch/ifunc-resolve.h b/sysdeps/s390/multiarch/ifunc-resolve.h
index 26e097a..768829b 100644
--- a/sysdeps/s390/multiarch/ifunc-resolve.h
+++ b/sysdeps/s390/multiarch/ifunc-resolve.h
@@ -40,53 +40,46 @@
 		       ".machine pop"         "\n"			\
 		       : "=QS" (STFLE_BITS), "+d" (reg0)		\
 		       : : "cc");
+#define s390_libc_ifunc_init()						\
+  unsigned long long stfle_bits = 0ULL;					\
+  if (__glibc_likely((dl_hwcap & HWCAP_S390_STFLE)			\
+		     && (dl_hwcap & HWCAP_S390_ZARCH)			\
+		     && (dl_hwcap & HWCAP_S390_HIGH_GPRS)))		\
+    {									\
+      S390_STORE_STFLE (stfle_bits);					\
+    }
 
-#define s390_libc_ifunc(FUNC)						\
-  __asm__ (".globl " #FUNC "\n\t"					\
-	   ".type  " #FUNC ",@gnu_indirect_function\n\t"		\
-	   ".set   " #FUNC ",__resolve_" #FUNC "\n\t");			\
-									\
+#define s390_libc_ifunc(TYPE_FUNC, RESOLVERFUNC, FUNC)			\
   /* Make the declarations of the optimized functions hidden in order
      to prevent GOT slots being generated for them. */			\
-  extern void *__##FUNC##_z196 attribute_hidden;			\
-  extern void *__##FUNC##_z10 attribute_hidden;				\
-  extern void *__##FUNC##_default attribute_hidden;			\
-									\
-  void *__resolve_##FUNC (unsigned long int dl_hwcap)			\
-  {									\
-    if ((dl_hwcap & HWCAP_S390_STFLE)					\
-	&& (dl_hwcap & HWCAP_S390_ZARCH)				\
-	&& (dl_hwcap & HWCAP_S390_HIGH_GPRS))				\
-      {									\
-	unsigned long long stfle_bits;					\
-	S390_STORE_STFLE (stfle_bits);					\
-									\
-	if (S390_IS_Z196 (stfle_bits))					\
-	  return &__##FUNC##_z196;					\
-	else if (S390_IS_Z10 (stfle_bits))				\
-	  return &__##FUNC##_z10;					\
-	else								\
-	  return &__##FUNC##_default;					\
-      }									\
-    else								\
-      return &__##FUNC##_default;					\
-  }
+  extern __typeof (TYPE_FUNC) RESOLVERFUNC##_z196 attribute_hidden;	\
+  extern __typeof (TYPE_FUNC) RESOLVERFUNC##_z10 attribute_hidden;      \
+  extern __typeof (TYPE_FUNC) RESOLVERFUNC##_default attribute_hidden;  \
+  __ifunc (TYPE_FUNC, FUNC,						\
+	   __glibc_likely (S390_IS_Z196 (stfle_bits))			\
+	   ? RESOLVERFUNC##_z196					\
+	   : __glibc_likely (S390_IS_Z10 (stfle_bits))			\
+	     ? RESOLVERFUNC##_z10					\
+	     : RESOLVERFUNC##_default,					\
+	   unsigned long int dl_hwcap, s390_libc_ifunc_init);
 
 #define s390_vx_libc_ifunc(FUNC)		\
-  s390_vx_libc_ifunc2(FUNC, FUNC)
+  s390_vx_libc_ifunc2_redirected(FUNC, FUNC, FUNC)
 
-#define s390_vx_libc_ifunc2(RESOLVERFUNC, FUNC)				\
+#define s390_vx_libc_ifunc_redirected(TYPE_FUNC, FUNC)	\
+  s390_vx_libc_ifunc2_redirected(TYPE_FUNC, FUNC, FUNC)
+
+#define s390_vx_libc_ifunc2(RESOLVERFUNC, FUNC)	\
+  s390_vx_libc_ifunc2_redirected(FUNC, RESOLVERFUNC, FUNC)
+
+#define s390_vx_libc_ifunc_init()
+#define s390_vx_libc_ifunc2_redirected(TYPE_FUNC, RESOLVERFUNC, FUNC)	\
   /* Make the declarations of the optimized functions hidden in order
      to prevent GOT slots being generated for them.  */			\
-  extern __typeof (FUNC) RESOLVERFUNC##_vx attribute_hidden;		\
-  extern __typeof (FUNC) RESOLVERFUNC##_c attribute_hidden;		\
-  extern void *__resolve_##RESOLVERFUNC (unsigned long int) __asm__ (#FUNC); \
-									\
-  void *__resolve_##RESOLVERFUNC (unsigned long int dl_hwcap)		\
-  {									\
-    if (dl_hwcap & HWCAP_S390_VX)					\
-      return &RESOLVERFUNC##_vx;					\
-    else								\
-      return &RESOLVERFUNC##_c;						\
-  }									\
- __asm__ (".type " #FUNC ", %gnu_indirect_function");
+  extern __typeof (TYPE_FUNC) RESOLVERFUNC##_vx attribute_hidden;	\
+  extern __typeof (TYPE_FUNC) RESOLVERFUNC##_c attribute_hidden;	\
+  __ifunc (TYPE_FUNC, FUNC,						\
+	   (dl_hwcap & HWCAP_S390_VX)					\
+	   ? RESOLVERFUNC##_vx						\
+	   : RESOLVERFUNC##_c,						\
+	   unsigned long int dl_hwcap, s390_vx_libc_ifunc_init);
diff --git a/sysdeps/s390/multiarch/memchr.c b/sysdeps/s390/multiarch/memchr.c
index f80de1c..891ec7a 100644
--- a/sysdeps/s390/multiarch/memchr.c
+++ b/sysdeps/s390/multiarch/memchr.c
@@ -17,8 +17,11 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define memchr __redirect_memchr
 # include <string.h>
+# undef memchr
 # include <ifunc-resolve.h>
 
-s390_vx_libc_ifunc2 (__memchr, memchr)
+s390_vx_libc_ifunc2_redirected (__redirect_memchr, __memchr, memchr)
+
 #endif
diff --git a/sysdeps/s390/multiarch/mempcpy.c b/sysdeps/s390/multiarch/mempcpy.c
index 34d8329..bee3ee4 100644
--- a/sysdeps/s390/multiarch/mempcpy.c
+++ b/sysdeps/s390/multiarch/mempcpy.c
@@ -18,9 +18,15 @@
 
 
 #if defined SHARED && IS_IN (libc)
+# define mempcpy __redirect_mempcpy
+# define __mempcpy __redirect___mempcpy
+/* Omit the mempcpy inline definitions because it would redefine mempcpy.  */
+# define _HAVE_STRING_ARCH_mempcpy 1
+# include <string.h>
+# undef mempcpy
+# undef __mempcpy
 # include <ifunc-resolve.h>
-s390_libc_ifunc (__mempcpy)
 
-__asm__ (".weak mempcpy\n\t"
-	 ".set mempcpy,__mempcpy\n\t");
+s390_libc_ifunc (__redirect___mempcpy, ____mempcpy, __mempcpy)
+weak_alias (__mempcpy, mempcpy);
 #endif
diff --git a/sysdeps/s390/multiarch/rawmemchr.c b/sysdeps/s390/multiarch/rawmemchr.c
index 7186ccd..c4afa24 100644
--- a/sysdeps/s390/multiarch/rawmemchr.c
+++ b/sysdeps/s390/multiarch/rawmemchr.c
@@ -17,10 +17,13 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define __rawmemchr __redirect___rawmemchr
 # include <string.h>
+# undef __rawmemchr
 # include <ifunc-resolve.h>
 
-s390_vx_libc_ifunc (__rawmemchr)
+s390_vx_libc_ifunc2_redirected (__redirect___rawmemchr, __rawmemchr
+				, __rawmemchr)
 weak_alias (__rawmemchr, rawmemchr)
 
 #else
diff --git a/sysdeps/s390/multiarch/stpcpy.c b/sysdeps/s390/multiarch/stpcpy.c
index dcde012..cea6c07 100644
--- a/sysdeps/s390/multiarch/stpcpy.c
+++ b/sysdeps/s390/multiarch/stpcpy.c
@@ -17,13 +17,18 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define stpcpy __redirect_stpcpy
+# define __stpcpy __redirect___stpcpy
+/* Omit the stpcpy inline definitions because it would redefine stpcpy.  */
+# define __NO_STRING_INLINES
 # define NO_MEMPCPY_STPCPY_REDIRECT
 # include <string.h>
+# undef stpcpy
+# undef __stpcpy
 # include <ifunc-resolve.h>
 
-s390_vx_libc_ifunc (__stpcpy)
+s390_vx_libc_ifunc_redirected (__redirect___stpcpy, __stpcpy);
 weak_alias (__stpcpy, stpcpy)
-libc_hidden_builtin_def (stpcpy)
 
 #else
 # include <string/stpcpy.c>
diff --git a/sysdeps/s390/multiarch/stpncpy.c b/sysdeps/s390/multiarch/stpncpy.c
index f5335b4..cbbe8ba 100644
--- a/sysdeps/s390/multiarch/stpncpy.c
+++ b/sysdeps/s390/multiarch/stpncpy.c
@@ -17,10 +17,14 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define stpncpy __redirect_stpncpy
+# define __stpncpy __redirect___stpncpy
 # include <string.h>
+# undef stpncpy
+# undef __stpncpy
 # include <ifunc-resolve.h>
 
-s390_vx_libc_ifunc (__stpncpy)
+s390_vx_libc_ifunc_redirected (__redirect___stpncpy, __stpncpy)
 weak_alias (__stpncpy, stpncpy)
 
 #else
diff --git a/sysdeps/s390/multiarch/strcat.c b/sysdeps/s390/multiarch/strcat.c
index c3b5e1c..0c74c91 100644
--- a/sysdeps/s390/multiarch/strcat.c
+++ b/sysdeps/s390/multiarch/strcat.c
@@ -17,10 +17,12 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define strcat __redirect_strcat
 # include <string.h>
+# undef strcat
 # include <ifunc-resolve.h>
 
-s390_vx_libc_ifunc2 (__strcat, strcat)
+s390_vx_libc_ifunc2_redirected (__redirect_strcat, __strcat, strcat)
 
 #else
 # include <string/strcat.c>
diff --git a/sysdeps/s390/multiarch/strchr.c b/sysdeps/s390/multiarch/strchr.c
index 3c8c7e4..3b378b9 100644
--- a/sysdeps/s390/multiarch/strchr.c
+++ b/sysdeps/s390/multiarch/strchr.c
@@ -17,10 +17,14 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define strchr __redirect_strchr
+/* Omit the strchr inline definitions because it would redefine strchr.  */
+# define __NO_STRING_INLINES
 # include <string.h>
+# undef strchr
 # include <ifunc-resolve.h>
 
-s390_vx_libc_ifunc2 (__strchr, strchr)
+s390_vx_libc_ifunc2_redirected (__redirect_strchr, __strchr, strchr)
 weak_alias (strchr, index)
 
 #else
diff --git a/sysdeps/s390/multiarch/strcmp.c b/sysdeps/s390/multiarch/strcmp.c
index c4ccd34..faeaaa5 100644
--- a/sysdeps/s390/multiarch/strcmp.c
+++ b/sysdeps/s390/multiarch/strcmp.c
@@ -17,10 +17,13 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define strcmp __redirect_strcmp
+/* Omit the strcmp inline definitions because it would redefine strcmp.  */
+# define __NO_STRING_INLINES
 # include <string.h>
 # include <ifunc-resolve.h>
+# undef strcmp
 
+s390_vx_libc_ifunc2_redirected (__redirect_strcmp, __strcmp, strcmp)
 
-# undef strcmp
-s390_vx_libc_ifunc2 (__strcmp, strcmp)
 #endif
diff --git a/sysdeps/s390/multiarch/strcpy.c b/sysdeps/s390/multiarch/strcpy.c
index f348199..9053b12 100644
--- a/sysdeps/s390/multiarch/strcpy.c
+++ b/sysdeps/s390/multiarch/strcpy.c
@@ -17,8 +17,11 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define strcpy __redirect_strcpy
 # include <string.h>
+# undef strcpy
 # include <ifunc-resolve.h>
 
-s390_vx_libc_ifunc2 (__strcpy, strcpy)
+s390_vx_libc_ifunc2_redirected (__redirect_strcpy, __strcpy, strcpy)
+
 #endif
diff --git a/sysdeps/s390/multiarch/strcspn.c b/sysdeps/s390/multiarch/strcspn.c
index c23452a..d1fe33b 100644
--- a/sysdeps/s390/multiarch/strcspn.c
+++ b/sysdeps/s390/multiarch/strcspn.c
@@ -17,10 +17,14 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define strcspn __redirect_strcspn
+/* Omit the strcspn inline definitions because it would redefine strcspn.  */
+# define __NO_STRING_INLINES
 # include <string.h>
+# undef strcspn
 # include <ifunc-resolve.h>
 
-s390_vx_libc_ifunc2 (__strcspn, strcspn)
+s390_vx_libc_ifunc2_redirected (__redirect_strcspn, __strcspn, strcspn)
 
 #else
 # include <string/strcspn.c>
diff --git a/sysdeps/s390/multiarch/strlen.c b/sysdeps/s390/multiarch/strlen.c
index 098d4e1..8329f2b 100644
--- a/sysdeps/s390/multiarch/strlen.c
+++ b/sysdeps/s390/multiarch/strlen.c
@@ -17,10 +17,12 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define strlen __redirect_strlen
 # include <string.h>
 # include <ifunc-resolve.h>
+# undef strlen
 
-s390_vx_libc_ifunc2 (__strlen, strlen)
+s390_vx_libc_ifunc2_redirected (__redirect_strlen, __strlen, strlen)
 
 #else
 # include <string/strlen.c>
diff --git a/sysdeps/s390/multiarch/strncmp.c b/sysdeps/s390/multiarch/strncmp.c
index 9a72c79..2bdf4bf 100644
--- a/sysdeps/s390/multiarch/strncmp.c
+++ b/sysdeps/s390/multiarch/strncmp.c
@@ -17,13 +17,14 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define strncmp __redirect_strncmp
+/* Omit the strncmp inline definitions because it would redefine strncmp.  */
+# define __NO_STRING_INLINES
 # include <string.h>
+# undef strncmp
 # include <ifunc-resolve.h>
 
-
-# undef strcmp
-extern __typeof (strncmp) __strncmp;
-s390_vx_libc_ifunc2 (__strncmp, strncmp)
+s390_vx_libc_ifunc2_redirected (__redirect_strncmp, __strncmp, strncmp)
 
 #else
 # include <string/strncmp.c>
diff --git a/sysdeps/s390/multiarch/strncpy.c b/sysdeps/s390/multiarch/strncpy.c
index 1464551..c4d13a9 100644
--- a/sysdeps/s390/multiarch/strncpy.c
+++ b/sysdeps/s390/multiarch/strncpy.c
@@ -17,8 +17,13 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define strncpy __redirect_strncpy
+/* Omit the strncpy inline definitions because it would redefine strncpy.  */
+# define __NO_STRING_INLINES
 # include <string.h>
+# undef strncpy
 # include <ifunc-resolve.h>
 
-s390_vx_libc_ifunc2 (__strncpy, strncpy)
+s390_vx_libc_ifunc2_redirected (__redirect_strncpy, __strncpy, strncpy);
+
 #endif
diff --git a/sysdeps/s390/multiarch/strnlen.c b/sysdeps/s390/multiarch/strnlen.c
index 48c3bb7..ecb69eb 100644
--- a/sysdeps/s390/multiarch/strnlen.c
+++ b/sysdeps/s390/multiarch/strnlen.c
@@ -17,12 +17,15 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define strnlen __redirect_strnlen
+# define __strnlen __redirect___strnlen
 # include <string.h>
+# undef strnlen
+# undef __strnlen
 # include <ifunc-resolve.h>
 
-s390_vx_libc_ifunc (__strnlen)
+s390_vx_libc_ifunc_redirected (__redirect___strnlen, __strnlen)
 weak_alias (__strnlen, strnlen)
-libc_hidden_def (strnlen)
 
 #else
 # include <string/strnlen.c>
diff --git a/sysdeps/s390/multiarch/strpbrk.c b/sysdeps/s390/multiarch/strpbrk.c
index cdc1399..09c3fff 100644
--- a/sysdeps/s390/multiarch/strpbrk.c
+++ b/sysdeps/s390/multiarch/strpbrk.c
@@ -17,10 +17,14 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define strpbrk __redirect_strpbrk
+/* Omit the strpbrk inline definitions because it would redefine strpbrk.  */
+# define __NO_STRING_INLINES
 # include <string.h>
+# undef strpbrk
 # include <ifunc-resolve.h>
 
-s390_vx_libc_ifunc2 (__strpbrk, strpbrk)
+s390_vx_libc_ifunc2_redirected (__redirect_strpbrk, __strpbrk, strpbrk)
 
 #else
 # include <string/strpbrk.c>
diff --git a/sysdeps/s390/multiarch/strrchr.c b/sysdeps/s390/multiarch/strrchr.c
index e515d6b..2da8581 100644
--- a/sysdeps/s390/multiarch/strrchr.c
+++ b/sysdeps/s390/multiarch/strrchr.c
@@ -17,11 +17,13 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define strrchr __redirect_strrchr
 # include <string.h>
+# undef strrchr
 # include <ifunc-resolve.h>
 
-s390_vx_libc_ifunc2 (__strrchr, strrchr)
-weak_alias (strrchr, rindex)
+s390_vx_libc_ifunc2_redirected (__redirect_strrchr, __strrchr, strrchr)
+weak_alias (strrchr, rindex);
 
 #else
 # include <string/strrchr.c>
diff --git a/sysdeps/s390/multiarch/strspn.c b/sysdeps/s390/multiarch/strspn.c
index 7c26af8..1d9514d 100644
--- a/sysdeps/s390/multiarch/strspn.c
+++ b/sysdeps/s390/multiarch/strspn.c
@@ -17,10 +17,14 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define strspn __redirect_strspn
+/* Omit the strspn inline definitions because it would redefine strspn.  */
+# define __NO_STRING_INLINES
 # include <string.h>
+# undef strspn
 # include <ifunc-resolve.h>
 
-s390_vx_libc_ifunc2 (__strspn, strspn)
+s390_vx_libc_ifunc2_redirected (__redirect_strspn, __strspn, strspn)
 
 #else
 # include <string/strspn.c>
diff --git a/sysdeps/s390/multiarch/wcschr.c b/sysdeps/s390/multiarch/wcschr.c
index fb51097..3e0ff8b 100644
--- a/sysdeps/s390/multiarch/wcschr.c
+++ b/sysdeps/s390/multiarch/wcschr.c
@@ -17,12 +17,15 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define wcschr __redirect_wcschr
+# define __wcschr __redirect___wcschr
 # include <wchar.h>
+# undef wcschr
+# undef __wcschr
 # include <ifunc-resolve.h>
 
-s390_vx_libc_ifunc (__wcschr)
+s390_vx_libc_ifunc_redirected (__redirect___wcschr, __wcschr)
 weak_alias (__wcschr, wcschr)
-libc_hidden_weak (wcschr)
 
 #else
 # include <wcsmbs/wcschr.c>
diff --git a/sysdeps/s390/multiarch/wcscmp.c b/sysdeps/s390/multiarch/wcscmp.c
index 705ef45..dc29b32 100644
--- a/sysdeps/s390/multiarch/wcscmp.c
+++ b/sysdeps/s390/multiarch/wcscmp.c
@@ -17,10 +17,12 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define __wcscmp __redirect___wcscmp
 # include <wchar.h>
+# undef __wcscmp
 # include <ifunc-resolve.h>
 
-s390_vx_libc_ifunc (__wcscmp)
+s390_vx_libc_ifunc_redirected (__redirect___wcscmp, __wcscmp)
 weak_alias (__wcscmp, wcscmp)
 
 #else
diff --git a/sysdeps/s390/multiarch/wcspbrk.c b/sysdeps/s390/multiarch/wcspbrk.c
index 198144d..9824bd5 100644
--- a/sysdeps/s390/multiarch/wcspbrk.c
+++ b/sysdeps/s390/multiarch/wcspbrk.c
@@ -17,10 +17,12 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define wcspbrk __redirect_wcspbrk
 # include <wchar.h>
+# undef wcspbrk
 # include <ifunc-resolve.h>
 
-s390_vx_libc_ifunc2 (__wcspbrk, wcspbrk)
+s390_vx_libc_ifunc2_redirected (__redirect_wcspbrk, __wcspbrk, wcspbrk)
 
 #else
 # include <wcsmbs/wcspbrk.c>
diff --git a/sysdeps/s390/multiarch/wcsspn.c b/sysdeps/s390/multiarch/wcsspn.c
index 167a881..d153d44 100644
--- a/sysdeps/s390/multiarch/wcsspn.c
+++ b/sysdeps/s390/multiarch/wcsspn.c
@@ -17,10 +17,12 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define wcsspn __redirect_wcsspn
 # include <wchar.h>
+# undef wcsspn
 # include <ifunc-resolve.h>
 
-s390_vx_libc_ifunc2 (__wcsspn, wcsspn)
+s390_vx_libc_ifunc2_redirected (__redirect_wcsspn, __wcsspn, wcsspn)
 
 #else
 # include <wcsmbs/wcsspn.c>
diff --git a/sysdeps/s390/multiarch/wmemchr.c b/sysdeps/s390/multiarch/wmemchr.c
index f2bfe3c..45b3441 100644
--- a/sysdeps/s390/multiarch/wmemchr.c
+++ b/sysdeps/s390/multiarch/wmemchr.c
@@ -17,12 +17,15 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define wmemchr __redirect_wmemchr
+# define __wmemchr __redirect___wmemchr
 # include <wchar.h>
+# undef wmemchr
+# undef __wmemchr
 # include <ifunc-resolve.h>
 
-s390_vx_libc_ifunc (__wmemchr)
+s390_vx_libc_ifunc_redirected (__redirect___wmemchr, __wmemchr)
 weak_alias (__wmemchr, wmemchr)
-libc_hidden_weak (wmemchr)
 
 #else
 # include <wcsmbs/wmemchr.c>
diff --git a/sysdeps/s390/multiarch/wmemset.c b/sysdeps/s390/multiarch/wmemset.c
index e9e695f..2fc57ee 100644
--- a/sysdeps/s390/multiarch/wmemset.c
+++ b/sysdeps/s390/multiarch/wmemset.c
@@ -17,12 +17,15 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if defined HAVE_S390_VX_ASM_SUPPORT && IS_IN (libc)
+# define wmemset __redirect_wmemset
+# define __wmemset __redirect___wmemset
 # include <wchar.h>
+# undef wmemset
+# undef __wmemset
 # include <ifunc-resolve.h>
 
-s390_vx_libc_ifunc (__wmemset)
+s390_vx_libc_ifunc_redirected (__redirect___wmemset, __wmemset)
 weak_alias (__wmemset, wmemset)
-libc_hidden_weak (wmemset)
 
 #else
 # include <wcsmbs/wmemset.c>
diff --git a/sysdeps/s390/s390-32/multiarch/memcmp.c b/sysdeps/s390/s390-32/multiarch/memcmp.c
index 44f72dc..453b170 100644
--- a/sysdeps/s390/s390-32/multiarch/memcmp.c
+++ b/sysdeps/s390/s390-32/multiarch/memcmp.c
@@ -17,8 +17,11 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if IS_IN (libc)
+# define memcmp __redirect_memcmp
+# include <string.h>
+# undef memcmp
 # include <ifunc-resolve.h>
 
-s390_libc_ifunc (memcmp)
-__asm__(".weak bcmp ; bcmp = memcmp");
+s390_libc_ifunc (__redirect_memcmp, __memcmp, memcmp)
+weak_alias (memcmp, bcmp);
 #endif
diff --git a/sysdeps/s390/s390-32/multiarch/memcpy.c b/sysdeps/s390/s390-32/multiarch/memcpy.c
index 2a98aa0..33e4bcd 100644
--- a/sysdeps/s390/s390-32/multiarch/memcpy.c
+++ b/sysdeps/s390/s390-32/multiarch/memcpy.c
@@ -18,7 +18,10 @@
 
 /* In the static lib memcpy is needed before the reloc is resolved.  */
 #if defined SHARED && IS_IN (libc)
+# define memcpy __redirect_memcpy
+# include <string.h>
+# undef memcpy
 # include <ifunc-resolve.h>
 
-s390_libc_ifunc (memcpy)
+s390_libc_ifunc (__redirect_memcpy, __memcpy, memcpy)
 #endif
diff --git a/sysdeps/s390/s390-32/multiarch/memset.c b/sysdeps/s390/s390-32/multiarch/memset.c
index 89b8102..84ddeda 100644
--- a/sysdeps/s390/s390-32/multiarch/memset.c
+++ b/sysdeps/s390/s390-32/multiarch/memset.c
@@ -17,7 +17,10 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if IS_IN (libc)
+# define memset __redirect_memset
+# include <string.h>
+# undef memset
 # include <ifunc-resolve.h>
 
-s390_libc_ifunc (memset)
+s390_libc_ifunc (__redirect_memset, __memset, memset)
 #endif
diff --git a/sysdeps/s390/s390-64/multiarch/memcmp.c b/sysdeps/s390/s390-64/multiarch/memcmp.c
index 44f72dc..453b170 100644
--- a/sysdeps/s390/s390-64/multiarch/memcmp.c
+++ b/sysdeps/s390/s390-64/multiarch/memcmp.c
@@ -17,8 +17,11 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if IS_IN (libc)
+# define memcmp __redirect_memcmp
+# include <string.h>
+# undef memcmp
 # include <ifunc-resolve.h>
 
-s390_libc_ifunc (memcmp)
-__asm__(".weak bcmp ; bcmp = memcmp");
+s390_libc_ifunc (__redirect_memcmp, __memcmp, memcmp)
+weak_alias (memcmp, bcmp);
 #endif
diff --git a/sysdeps/s390/s390-64/multiarch/memcpy.c b/sysdeps/s390/s390-64/multiarch/memcpy.c
index 2a98aa0..33e4bcd 100644
--- a/sysdeps/s390/s390-64/multiarch/memcpy.c
+++ b/sysdeps/s390/s390-64/multiarch/memcpy.c
@@ -18,7 +18,10 @@
 
 /* In the static lib memcpy is needed before the reloc is resolved.  */
 #if defined SHARED && IS_IN (libc)
+# define memcpy __redirect_memcpy
+# include <string.h>
+# undef memcpy
 # include <ifunc-resolve.h>
 
-s390_libc_ifunc (memcpy)
+s390_libc_ifunc (__redirect_memcpy, __memcpy, memcpy)
 #endif
diff --git a/sysdeps/s390/s390-64/multiarch/memset.c b/sysdeps/s390/s390-64/multiarch/memset.c
index 89b8102..84ddeda 100644
--- a/sysdeps/s390/s390-64/multiarch/memset.c
+++ b/sysdeps/s390/s390-64/multiarch/memset.c
@@ -17,7 +17,10 @@
    <http://www.gnu.org/licenses/>.  */
 
 #if IS_IN (libc)
+# define memset __redirect_memset
+# include <string.h>
+# undef memset
 # include <ifunc-resolve.h>
 
-s390_libc_ifunc (memset)
+s390_libc_ifunc (__redirect_memset, __memset, memset)
 #endif
-- 
2.5.5

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 5/9] ppc: Use libc_ifunc macro for time, gettimeofday.
  2016-08-08 14:40 [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Stefan Liebler
                   ` (3 preceding siblings ...)
  2016-08-08 14:40 ` [PATCH v2 8/9] Use libc_ifunc macro for vfork in libpthread Stefan Liebler
@ 2016-08-08 14:40 ` Stefan Liebler
  2016-08-08 14:40 ` [PATCH v2 7/9] Use libc_ifunc macro for system in libpthread Stefan Liebler
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Stefan Liebler @ 2016-08-08 14:40 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, fweimer, murphyp, schwab, joseph_myers

This patch uses the libc_ifunc_redirected macro to create already existing ifunc
functions time and gettimeofday on power. This way, the libc_hidden_def macro can
be used instead of inline assemblies.
On ppc32, the __GI_* symbols do not target the ifunc symbol and thus the
redirection construct has to be applied here.

ChangeLog:

	* sysdeps/unix/sysv/linux/powerpc/gettimeofday.c (__gettimeofday):
	Use libc_ifunc_redirected and libc_hidden_def macro. Redirect ifunced
	function in header for using it as type for ifunc function because
	__GI_* symbols for ppc32 do not target the ifunc symbols.
	* sysdeps/unix/sysv/linux/powerpc/time.c (time): Likewise.
---
 sysdeps/unix/sysv/linux/powerpc/gettimeofday.c | 61 +++++++++++------------
 sysdeps/unix/sysv/linux/powerpc/time.c         | 67 +++++++++++++-------------
 2 files changed, 65 insertions(+), 63 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
index 25a4e7c..b527101 100644
--- a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
+++ b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
@@ -15,6 +15,11 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#if defined SHARED && !defined __powerpc64__
+# define __gettimeofday __redirect___gettimeofday
+#else
+# define __redirect___gettimeofday __gettimeofday
+#endif
 
 #include <sys/time.h>
 
@@ -24,30 +29,14 @@
 # include <libc-vdso.h>
 # include <dl-machine.h>
 
-void *gettimeofday_ifunc (void) __asm__ ("__gettimeofday");
-
-static int
-__gettimeofday_syscall (struct timeval *tv, struct timezone *tz)
-{
-  return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
-}
+# ifndef __powerpc64__
+#  undef __gettimeofday
 
-void *
-gettimeofday_ifunc (void)
+int
+__gettimeofday_vsyscall (struct timeval *tv, struct timezone *tz)
 {
-  PREPARE_VERSION (linux2615, "LINUX_2.6.15", 123718565);
-
-  /* If the vDSO is not available we fall back syscall.  */
-  void *vdso_gettimeofday = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2615);
-  return (vdso_gettimeofday ? VDSO_IFUNC_RET (vdso_gettimeofday)
-	  : (void*)__gettimeofday_syscall);
+  return INLINE_VSYSCALL (gettimeofday, 2, tv, tz);
 }
-asm (".type __gettimeofday, %gnu_indirect_function");
-
-/* This is doing "libc_hidden_def (__gettimeofday)" but the compiler won't
-   let us do it in C because it doesn't know we're defining __gettimeofday
-   here in this file.  */
-asm (".globl __GI___gettimeofday");
 
 /* __GI___gettimeofday is defined as hidden and for ppc32 it enables the
    compiler make a local call (symbol@local) for internal GLIBC usage. It
@@ -55,16 +44,28 @@ asm (".globl __GI___gettimeofday");
    For ppc64 a call to a function in another translation unit might use a
    different toc pointer thus disallowing direct branchess and making internal
    ifuncs calls safe.  */
-#ifdef __powerpc64__
-asm ("__GI___gettimeofday = __gettimeofday");
-#else
-int
-__gettimeofday_vsyscall (struct timeval *tv, struct timezone *tz)
+#  undef libc_hidden_def
+#  define libc_hidden_def(name)					\
+  __hidden_ver1 (__gettimeofday_vsyscall, __GI___gettimeofday,	\
+	       __gettimeofday_vsyscall);
+
+# endif /* !__powerpc64__  */
+
+static int
+__gettimeofday_syscall (struct timeval *tv, struct timezone *tz)
 {
-  return INLINE_VSYSCALL (gettimeofday, 2, tv, tz);
+  return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
 }
-asm ("__GI___gettimeofday = __gettimeofday_vsyscall");
-#endif
+
+# define INIT_ARCH()							\
+  PREPARE_VERSION (linux2615, "LINUX_2.6.15", 123718565);		\
+  void *vdso_gettimeofday = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2615);
+
+/* If the vDSO is not available we fall back syscall.  */
+libc_ifunc_redirected (__redirect___gettimeofday, __gettimeofday,
+		       vdso_gettimeofday
+		       ? VDSO_IFUNC_RET (vdso_gettimeofday)
+		       : (void *) __gettimeofday_syscall);
 
 #else
 
@@ -76,8 +77,8 @@ __gettimeofday (struct timeval *tv, struct timezone *tz)
 {
   return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
 }
-libc_hidden_def (__gettimeofday)
 
 #endif
+libc_hidden_def (__gettimeofday)
 weak_alias (__gettimeofday, gettimeofday)
 libc_hidden_weak (gettimeofday)
diff --git a/sysdeps/unix/sysv/linux/powerpc/time.c b/sysdeps/unix/sysv/linux/powerpc/time.c
index 7973419..b42827a 100644
--- a/sysdeps/unix/sysv/linux/powerpc/time.c
+++ b/sysdeps/unix/sysv/linux/powerpc/time.c
@@ -17,6 +17,11 @@
    <http://www.gnu.org/licenses/>.  */
 
 #ifdef SHARED
+# ifndef __powerpc64__
+#  define time __redirect_time
+# else
+#  define __redirect_time time
+# endif
 
 # include <time.h>
 # include <sysdep.h>
@@ -24,7 +29,26 @@
 # include <libc-vdso.h>
 # include <dl-machine.h>
 
-void *time_ifunc (void) asm ("time");
+# ifndef __powerpc64__
+#  undef time
+
+time_t
+__time_vsyscall (time_t *t)
+{
+  return INLINE_VSYSCALL (time, 1, t);
+}
+
+/* __GI_time is defined as hidden and for ppc32 it enables the
+   compiler make a local call (symbol@local) for internal GLIBC usage. It
+   means the PLT won't be used and the ifunc resolver will be called directly.
+   For ppc64 a call to a function in another translation unit might use a
+   different toc pointer thus disallowing direct branchess and making internal
+   ifuncs calls safe.  */
+#  undef libc_hidden_def
+#  define libc_hidden_def(name)					\
+  __hidden_ver1 (__time_vsyscall, __GI_time, __time_vsyscall);
+
+# endif /* !__powerpc64__  */
 
 static time_t
 time_syscall (time_t *t)
@@ -42,42 +66,19 @@ time_syscall (time_t *t)
   return result;
 }
 
-void *
-time_ifunc (void)
-{
-  PREPARE_VERSION (linux2615, "LINUX_2.6.15", 123718565);
-
-  /* If the vDSO is not available we fall back to the syscall.  */
+# define INIT_ARCH()							\
+  PREPARE_VERSION (linux2615, "LINUX_2.6.15", 123718565);		\
   void *vdso_time = _dl_vdso_vsym ("__kernel_time", &linux2615);
-  return (vdso_time ? VDSO_IFUNC_RET (vdso_time)
-	  : (void*)time_syscall);
-}
-asm (".type time, %gnu_indirect_function");
 
-/* This is doing "libc_hidden_def (time)" but the compiler won't
- * let us do it in C because it doesn't know we're defining time
- * here in this file.  */
-asm (".globl __GI_time");
-
-/* __GI_time is defined as hidden and for ppc32 it enables the
-   compiler make a local call (symbol@local) for internal GLIBC usage. It
-   means the PLT won't be used and the ifunc resolver will be called directly.
-   For ppc64 a call to a function in another translation unit might use a
-   different toc pointer thus disallowing direct branchess and making internal
-   ifuncs calls safe.  */
-#ifdef __powerpc64__
-asm ("__GI_time = time");
-#else
-time_t
-__time_vsyscall (time_t *t)
-{
-  return INLINE_VSYSCALL (time, 1, t);
-}
-asm ("__GI_time = __time_vsyscall");
-#endif
+/* If the vDSO is not available we fall back to the syscall.  */
+libc_ifunc_redirected (__redirect_time, time,
+		       vdso_time
+		       ? VDSO_IFUNC_RET (vdso_time)
+		       : (void *) time_syscall);
+libc_hidden_def (time)
 
 #else
 
 #include <sysdeps/posix/time.c>
 
-#endif
+#endif /* !SHARED */
-- 
2.5.5

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 8/9] Use libc_ifunc macro for vfork in libpthread.
  2016-08-08 14:40 [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Stefan Liebler
                   ` (2 preceding siblings ...)
  2016-08-08 14:40 ` [PATCH v2 2/9] Use gcc attribute ifunc in libc_ifunc macro instead of inline assembly " Stefan Liebler
@ 2016-08-08 14:40 ` Stefan Liebler
  2016-08-08 14:40 ` [PATCH v2 5/9] ppc: Use libc_ifunc macro for time, gettimeofday Stefan Liebler
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 21+ messages in thread
From: Stefan Liebler @ 2016-08-08 14:40 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, fweimer, murphyp, schwab, joseph_myers

This patch uses the libc_ifunc macro to create already existing ifunc functions
vfork_ifunc and __vfork_ifunc if HAVE_IFUNC is defined.

ChangeLog:

	* nptl/pt-vfork.c (DEFINE_VFORK): Use libc_ifunc macro.
---
 nptl/pt-vfork.c | 22 +++++-----------------
 1 file changed, 5 insertions(+), 17 deletions(-)

diff --git a/nptl/pt-vfork.c b/nptl/pt-vfork.c
index 8f4be0c..563e3ec 100644
--- a/nptl/pt-vfork.c
+++ b/nptl/pt-vfork.c
@@ -46,32 +46,20 @@
 
 extern __typeof (vfork) __libc_vfork;   /* Defined in libc.  */
 
-static __typeof (vfork) *
-__attribute__ ((used))
-vfork_resolve (void)
-{
-  return &__libc_vfork;
-}
+# undef INIT_ARCH
+# define INIT_ARCH()
+# define DEFINE_VFORK(name) libc_ifunc (name, &__libc_vfork)
 
-# ifdef HAVE_ASM_SET_DIRECTIVE
-#  define DEFINE_VFORK(name) \
-  asm (".set " #name ", vfork_resolve\n" \
-       ".globl " #name "\n" \
-       ".type " #name ", %gnu_indirect_function");
-# else
-#  define DEFINE_VFORK(name) \
-  asm (#name " = vfork_resolve\n" \
-       ".globl " #name "\n" \
-       ".type " #name ", %gnu_indirect_function");
-# endif
 #endif
 
 #if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_20)
+extern __typeof(vfork) vfork_ifunc;
 DEFINE_VFORK (vfork_ifunc)
 compat_symbol (libpthread, vfork_ifunc, vfork, GLIBC_2_0);
 #endif
 
 #if SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_20)
+extern __typeof(vfork) __vfork_ifunc;
 DEFINE_VFORK (__vfork_ifunc)
 compat_symbol (libpthread, __vfork_ifunc, __vfork, GLIBC_2_1_2);
 #endif
-- 
2.5.5

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc.
  2016-08-08 14:40 [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Stefan Liebler
                   ` (6 preceding siblings ...)
  2016-08-08 14:40 ` [PATCH v2 4/9] i386, x86: Use libc_ifunc macro for time, gettimeofday Stefan Liebler
@ 2016-08-08 16:08 ` Paul E. Murphy
  2016-08-08 16:42   ` Joseph Myers
                     ` (2 more replies)
  2016-08-08 16:40 ` Joseph Myers
                   ` (2 subsequent siblings)
  10 siblings, 3 replies; 21+ messages in thread
From: Paul E. Murphy @ 2016-08-08 16:08 UTC (permalink / raw)
  To: Stefan Liebler, libc-alpha; +Cc: fweimer, schwab, joseph_myers



On 08/08/2016 09:38 AM, Stefan Liebler wrote:
> This patch adds a configure check to test if gcc supports attribute ifunc.
> The support can either be enabled in <gcc-src>/gcc/config.gcc for one
> architecture in general by setting default_gnu_indirect_function variable to yes
> or by configuring gcc with --enable-gnu-indirect-function.
> 
> The next patch rewrites libc_ifunc macro to use gcc attribute ifunc instead
> of inline assembly to generate the IFUNC symbols due to false debuginfo.
> 
> If gcc does not support attribute ifunc and glibc is configured with
> --enable-multi-arch then configure will abort with an error message.
> If --enable-multi-arch is not given then configure will silently
> disable multi-arch support.
> 
> ChangeLog:
> 
> 	* configure.ac: Add check if gcc supports attribute ifunc feature.
> 	* configure: Regenerated.


One more hiccup after trying out this patch.  pt-vfork.c mandates ifunc
on most (all?) targets using nptl.  It seems configure needs to mandate
this support on any target using nptl.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc.
  2016-08-08 14:40 [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Stefan Liebler
                   ` (7 preceding siblings ...)
  2016-08-08 16:08 ` [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Paul E. Murphy
@ 2016-08-08 16:40 ` Joseph Myers
  2016-08-09 11:56   ` Florian Weimer
  2016-08-08 17:58 ` [PATCH v2 9/9] Use libc_ifunc macro for siglongjmp, longjmp in libpthread Stefan Liebler
  2016-08-17 10:37 ` [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Stefan Liebler
  10 siblings, 1 reply; 21+ messages in thread
From: Joseph Myers @ 2016-08-08 16:40 UTC (permalink / raw)
  To: Stefan Liebler; +Cc: libc-alpha, fweimer, murphyp, schwab

On Mon, 8 Aug 2016, Stefan Liebler wrote:

> This patch adds a configure check to test if gcc supports attribute ifunc.
> The support can either be enabled in <gcc-src>/gcc/config.gcc for one
> architecture in general by setting default_gnu_indirect_function variable to yes
> or by configuring gcc with --enable-gnu-indirect-function.
> 
> The next patch rewrites libc_ifunc macro to use gcc attribute ifunc instead
> of inline assembly to generate the IFUNC symbols due to false debuginfo.
> 
> If gcc does not support attribute ifunc and glibc is configured with
> --enable-multi-arch then configure will abort with an error message.
> If --enable-multi-arch is not given then configure will silently
> disable multi-arch support.

I'm concerned about requiring non-default configure options.  Various 
architectures support IFUNC in binutils and may have done so for a long 
time, but without the option being enabled in GCC by default.  There 
should be a much more detailed analysis of which architectures have IFUNC 
support in binutils, when it was added, and correspondingly, whether it's 
enabled by default in GCC for those architectures and, if so, when such 
enabling was added.

In any case, new compiler requirements must be documented in install.texi 
with INSTALL regenerated.  And should have appropriate NEWS entries as 
well.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc.
  2016-08-08 16:08 ` [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Paul E. Murphy
@ 2016-08-08 16:42   ` Joseph Myers
  2016-08-08 16:52   ` Andreas Schwab
  2016-08-09 15:12   ` Stefan Liebler
  2 siblings, 0 replies; 21+ messages in thread
From: Joseph Myers @ 2016-08-08 16:42 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: Stefan Liebler, libc-alpha, fweimer, schwab

On Mon, 8 Aug 2016, Paul E. Murphy wrote:

> One more hiccup after trying out this patch.  pt-vfork.c mandates ifunc
> on most (all?) targets using nptl.  It seems configure needs to mandate
> this support on any target using nptl.

No it doesn't.  Many architectures have their own pt-vfork.S.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc.
  2016-08-08 16:08 ` [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Paul E. Murphy
  2016-08-08 16:42   ` Joseph Myers
@ 2016-08-08 16:52   ` Andreas Schwab
  2016-08-09 15:12   ` Stefan Liebler
  2 siblings, 0 replies; 21+ messages in thread
From: Andreas Schwab @ 2016-08-08 16:52 UTC (permalink / raw)
  To: Paul E. Murphy; +Cc: Stefan Liebler, libc-alpha, fweimer, joseph_myers

On Mo, Aug 08 2016, "Paul E. Murphy" <murphyp@linux.vnet.ibm.com> wrote:

> One more hiccup after trying out this patch.  pt-vfork.c mandates ifunc
> on most (all?) targets using nptl.

Only if there is no architecture override (some architecures can just
use a tail call).

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 9/9] Use libc_ifunc macro for siglongjmp, longjmp in libpthread.
  2016-08-08 14:40 [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Stefan Liebler
                   ` (8 preceding siblings ...)
  2016-08-08 16:40 ` Joseph Myers
@ 2016-08-08 17:58 ` Stefan Liebler
  2016-08-17 10:37 ` [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Stefan Liebler
  10 siblings, 0 replies; 21+ messages in thread
From: Stefan Liebler @ 2016-08-08 17:58 UTC (permalink / raw)
  To: libc-alpha; +Cc: stli, fweimer, murphyp, schwab, joseph_myers

This patch uses the libc_ifunc macro to create already existing ifunc functions
longjmp_ifunc, siglongjmp_ifunc if HAVE_IFUNC is defined.
The s390 pt-longjmp.c includes the common pt-longjmp.c and uses strong_alias
to create the longjmp, siglongjmp symbols for glibc version 2.19.

ChangeLog:

	* nptl/pt-longjmp.c (DEFINE_LONGJMP): Use libc_ifunc macro.
	* sysdeps/unix/sysv/linux/s390/pt-longjmp.c (longjmp, siglongjmp):
	Use strong_alias to create symbols for glibc verison 2.19.
---
 nptl/pt-longjmp.c                         | 24 ++++++------------------
 sysdeps/unix/sysv/linux/s390/pt-longjmp.c |  4 ++--
 2 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/nptl/pt-longjmp.c b/nptl/pt-longjmp.c
index a1cc286..a19cd59 100644
--- a/nptl/pt-longjmp.c
+++ b/nptl/pt-longjmp.c
@@ -32,24 +32,12 @@
 
 # if HAVE_IFUNC
 
-static __typeof (longjmp) *
-__attribute__ ((used))
-longjmp_resolve (void)
-{
-  return &__libc_longjmp;
-}
+#  undef INIT_ARCH
+#  define INIT_ARCH()
+#  define DEFINE_LONGJMP(name) libc_ifunc (name, &__libc_longjmp)
 
-#  ifdef HAVE_ASM_SET_DIRECTIVE
-#   define DEFINE_LONGJMP(name) \
-  asm (".set " #name ", longjmp_resolve\n" \
-       ".globl " #name "\n" \
-       ".type " #name ", %gnu_indirect_function");
-#  else
-#   define DEFINE_LONGJMP(name) \
-  asm (#name " = longjmp_resolve\n" \
-       ".globl " #name "\n" \
-       ".type " #name ", %gnu_indirect_function");
-#  endif
+extern __typeof(longjmp) longjmp_ifunc;
+extern __typeof(siglongjmp) siglongjmp_ifunc;
 
 # else  /* !HAVE_IFUNC */
 
@@ -66,7 +54,7 @@ longjmp_compat (jmp_buf env, int val)
 DEFINE_LONGJMP (longjmp_ifunc)
 compat_symbol (libpthread, longjmp_ifunc, longjmp, GLIBC_2_0);
 
-DEFINE_LONGJMP (siglongjmp_ifunc)
+strong_alias (longjmp_ifunc, siglongjmp_ifunc)
 compat_symbol (libpthread, siglongjmp_ifunc, siglongjmp, GLIBC_2_0);
 
 #endif
diff --git a/sysdeps/unix/sysv/linux/s390/pt-longjmp.c b/sysdeps/unix/sysv/linux/s390/pt-longjmp.c
index 10e825c..2abf112 100644
--- a/sysdeps/unix/sysv/linux/s390/pt-longjmp.c
+++ b/sysdeps/unix/sysv/linux/s390/pt-longjmp.c
@@ -26,8 +26,8 @@
 /* In glibc release 2.19 new versions of longjmp-functions were introduced,
    but were reverted before 2.20. Thus both versions are the same function.  */
 
-DEFINE_LONGJMP (__v2longjmp)
+strong_alias (longjmp_ifunc, __v2longjmp)
 compat_symbol (libpthread, __v2longjmp, longjmp, GLIBC_2_19);
-DEFINE_LONGJMP (__v2siglongjmp)
+strong_alias (siglongjmp_ifunc, __v2siglongjmp)
 compat_symbol (libpthread, __v2siglongjmp, siglongjmp, GLIBC_2_19);
 #endif /* SHLIB_COMPAT (libpthread, GLIBC_2_19, GLIBC_2_20))  */
-- 
2.5.5

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc.
  2016-08-08 16:40 ` Joseph Myers
@ 2016-08-09 11:56   ` Florian Weimer
  2016-08-09 15:12     ` Stefan Liebler
  2016-08-09 20:15     ` Joseph Myers
  0 siblings, 2 replies; 21+ messages in thread
From: Florian Weimer @ 2016-08-09 11:56 UTC (permalink / raw)
  To: Joseph Myers, Stefan Liebler; +Cc: libc-alpha, murphyp, schwab

On 08/08/2016 06:40 PM, Joseph Myers wrote:
> On Mon, 8 Aug 2016, Stefan Liebler wrote:
>
>> This patch adds a configure check to test if gcc supports attribute ifunc.
>> The support can either be enabled in <gcc-src>/gcc/config.gcc for one
>> architecture in general by setting default_gnu_indirect_function variable to yes
>> or by configuring gcc with --enable-gnu-indirect-function.
>>
>> The next patch rewrites libc_ifunc macro to use gcc attribute ifunc instead
>> of inline assembly to generate the IFUNC symbols due to false debuginfo.
>>
>> If gcc does not support attribute ifunc and glibc is configured with
>> --enable-multi-arch then configure will abort with an error message.
>> If --enable-multi-arch is not given then configure will silently
>> disable multi-arch support.
>
> I'm concerned about requiring non-default configure options.  Various
> architectures support IFUNC in binutils and may have done so for a long
> time, but without the option being enabled in GCC by default.  There
> should be a much more detailed analysis of which architectures have IFUNC
> support in binutils, when it was added, and correspondingly, whether it's
> enabled by default in GCC for those architectures and, if so, when such
> enabling was added.

Is this really necessary?  Can't we rely on architecture maintainers to 
do this?

Moving from assembler hacks to a cleaner, GCC-provided interface is a 
desirable cleanup.  Stefan took up this work because we ask him to, and 
now his little project went sideways *again*.  This doesn't look fair to 
me.  We should probably go back to Stefan's original approach (sorry, 
Stefan).

> In any case, new compiler requirements must be documented in install.texi
> with INSTALL regenerated.  And should have appropriate NEWS entries as
> well.

Agreed on this part.

Thanks,
Florian

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc.
  2016-08-08 16:08 ` [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Paul E. Murphy
  2016-08-08 16:42   ` Joseph Myers
  2016-08-08 16:52   ` Andreas Schwab
@ 2016-08-09 15:12   ` Stefan Liebler
  2 siblings, 0 replies; 21+ messages in thread
From: Stefan Liebler @ 2016-08-09 15:12 UTC (permalink / raw)
  To: libc-alpha

On 08/08/2016 06:08 PM, Paul E. Murphy wrote:
>
>
> On 08/08/2016 09:38 AM, Stefan Liebler wrote:
>> This patch adds a configure check to test if gcc supports attribute ifunc.
>> The support can either be enabled in <gcc-src>/gcc/config.gcc for one
>> architecture in general by setting default_gnu_indirect_function variable to yes
>> or by configuring gcc with --enable-gnu-indirect-function.
>>
>> The next patch rewrites libc_ifunc macro to use gcc attribute ifunc instead
>> of inline assembly to generate the IFUNC symbols due to false debuginfo.
>>
>> If gcc does not support attribute ifunc and glibc is configured with
>> --enable-multi-arch then configure will abort with an error message.
>> If --enable-multi-arch is not given then configure will silently
>> disable multi-arch support.
>>
>> ChangeLog:
>>
>> 	* configure.ac: Add check if gcc supports attribute ifunc feature.
>> 	* configure: Regenerated.
>
>
> One more hiccup after trying out this patch.  pt-vfork.c mandates ifunc
> on most (all?) targets using nptl.  It seems configure needs to mandate
> this support on any target using nptl.
>
>
According to the comment in nptl/pt-vfork.c:
/* Note! If the architecture doesn't support IFUNC, then we need an
    alternate target-specific mechanism to implement this.  So we just
    assume IFUNC here and require that the target override this file
    if necessary.

    If the architecture can assume all supported versions of gcc will
    produce a tail-call to __libc_vfork, consider including the version
    in sysdeps/unix/sysv/linux/aarch64/pt-vfork.c.  */


The following targets have an own version of pt-vfork.[cS]:
./sysdeps/unix/sysv/linux/sh/pt-vfork.S
./sysdeps/unix/sysv/linux/hppa/pt-vfork.S
./sysdeps/unix/sysv/linux/microblaze/pt-vfork.S
./sysdeps/unix/sysv/linux/ia64/pt-vfork.S
./sysdeps/unix/sysv/linux/aarch64/pt-vfork.c
./sysdeps/unix/sysv/linux/tile/pt-vfork.c
./sysdeps/unix/sysv/linux/mips/pt-vfork.S
./sysdeps/unix/sysv/linux/s390/pt-vfork.S
./sysdeps/unix/sysv/linux/sparc/pt-vfork.S
./sysdeps/unix/sysv/linux/m68k/pt-vfork.c
./sysdeps/unix/sysv/linux/alpha/pt-vfork.S

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc.
  2016-08-09 11:56   ` Florian Weimer
@ 2016-08-09 15:12     ` Stefan Liebler
  2016-08-09 20:15     ` Joseph Myers
  1 sibling, 0 replies; 21+ messages in thread
From: Stefan Liebler @ 2016-08-09 15:12 UTC (permalink / raw)
  To: Florian Weimer, Joseph Myers; +Cc: libc-alpha, murphyp, schwab

On 08/09/2016 01:56 PM, Florian Weimer wrote:
> On 08/08/2016 06:40 PM, Joseph Myers wrote:
>> On Mon, 8 Aug 2016, Stefan Liebler wrote:
>>
>>> This patch adds a configure check to test if gcc supports attribute
>>> ifunc.
>>> The support can either be enabled in <gcc-src>/gcc/config.gcc for one
>>> architecture in general by setting default_gnu_indirect_function
>>> variable to yes
>>> or by configuring gcc with --enable-gnu-indirect-function.
>>>
>>> The next patch rewrites libc_ifunc macro to use gcc attribute ifunc
>>> instead
>>> of inline assembly to generate the IFUNC symbols due to false debuginfo.
>>>
>>> If gcc does not support attribute ifunc and glibc is configured with
>>> --enable-multi-arch then configure will abort with an error message.
>>> If --enable-multi-arch is not given then configure will silently
>>> disable multi-arch support.
>>
>> I'm concerned about requiring non-default configure options.  Various
>> architectures support IFUNC in binutils and may have done so for a long
>> time, but without the option being enabled in GCC by default.  There
>> should be a much more detailed analysis of which architectures have IFUNC
>> support in binutils, when it was added, and correspondingly, whether it's
>> enabled by default in GCC for those architectures and, if so, when such
>> enabling was added.
Here are some information so far:
In <gcc-src>/gcc/config.gcc IFUNC-support is only enabled by default for 
intel and s390 targets. See the following commits:
-"Don't enable IFUNC by default for Android and uclibc"
2014-11-14 precedes gcc-5_1_0-release
(https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=e6cdd6b1755033e8f416efaa4334d1294c0a43c6)
Don't set default_gnu_indirect_function variable=yes for targets 
*-*-*android*|*-*-*uclibc*.

-"* config.gcc: Enable ifunc attribute by default on s390 and s390x."
2012-07-05 precedes gcc-4_8_0-release, gcc-4_9_0-release, gcc-5_1_0-release
(https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=fcddec9f2159d14c98924e4ccd2dabffa6bd4a0e)
default_gnu_indirect_function=yes for targets s390x-*-linux* and 
s390-*-linux*.

-"* config.gcc (i[34567]86-*-linux*): Set default_gnu_indirect_function 
to yes."
2011-07-22 precedes alpha-v0.1, gcc-4_7_0-release, gcc-4_8_0-release, 
gcc-4_9_0-release, gcc-5_1_0-release
(https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=2c6c4996dd9e4b6cc96639b270954405c79f648d)
default_gnu_indirect_function=yes for targets x86_64-*-linux*

-"* configure.ac: Add --enable-indirect-function option."
2010-09-29 precedes alpha-v0.1, gcc-4_6_0-release, gcc-4_7_0-release, 
gcc-4_8_0-release, gcc-4_9_0-release, gcc-5_1_0-release
(https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=1c6e0788f1a7e6b577c101d5c3ee9a8cb01ac4d5)
default_gnu_indirect_function=yes for targets i[34567]86-*-linux*
and default_gnu_indirect_function=glibc-2011 for targets x86_64-*-linux*

Each distro can activate gcc ifunc support with gcc configure option 
--enable-gnu-indirect-function.
According to the gcc.specs file from fedora 21 gcc-4.9.2-1.fc21.src.rpm 
this is done for fedora >= 21 and rhel >= 7:
%ifarch %{ix86} x86_64 ppc ppc64 ppc64le ppc64p7 s390 s390x %{arm} aarch64
%global attr_ifunc 1
%else
%global attr_ifunc 0
%endif

%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7
%if %{attr_ifunc}
	--enable-gnu-indirect-function \
%endif
%endif


The debian/ubuntu/opensuse gcc source packages rely on the default 
behaviour and don't use --enable-gnu-indirect-function.
>
> Is this really necessary?  Can't we rely on architecture maintainers to
> do this?
>
> Moving from assembler hacks to a cleaner, GCC-provided interface is a
> desirable cleanup.  Stefan took up this work because we ask him to, and
> now his little project went sideways *again*.  This doesn't look fair to
> me.  We should probably go back to Stefan's original approach (sorry,
> Stefan).
One way is to rely on the distro maintainers which picks up the glibc 
release with this patchset that they also use a gcc with ifunc support.

I think the better approach is the previous way to test gcc ifunc 
support and use it if available and provide the old behaviour as 
fallback (see the former version of the patchset). This way we don't 
break an architecture which is currently using binutils-only-ifunc support.
Afterwards we can add a NEWS entry, update the recommended gcc in 
INSTALL, send a note to the distribution maintainers.
Perhaps more gccs support ifunc in the future and we can remove the 
fallback.
>
>> In any case, new compiler requirements must be documented in install.texi
>> with INSTALL regenerated.  And should have appropriate NEWS entries as
>> well.
>
> Agreed on this part.
>
> Thanks,
> Florian
>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc.
  2016-08-09 11:56   ` Florian Weimer
  2016-08-09 15:12     ` Stefan Liebler
@ 2016-08-09 20:15     ` Joseph Myers
  1 sibling, 0 replies; 21+ messages in thread
From: Joseph Myers @ 2016-08-09 20:15 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Stefan Liebler, libc-alpha, murphyp, schwab

On Tue, 9 Aug 2016, Florian Weimer wrote:

> > I'm concerned about requiring non-default configure options.  Various
> > architectures support IFUNC in binutils and may have done so for a long
> > time, but without the option being enabled in GCC by default.  There
> > should be a much more detailed analysis of which architectures have IFUNC
> > support in binutils, when it was added, and correspondingly, whether it's
> > enabled by default in GCC for those architectures and, if so, when such
> > enabling was added.
> 
> Is this really necessary?  Can't we rely on architecture maintainers to do
> this?

If you're proposing increasing build requirements, you need to give the 
community a proper understanding of what the proposed change is.  In this 
case, the impacts depend on the architecture, as some architectures (e.g. 
AArch64, ARM, PowerPC, SPARC) have IFUNC support but do not enable it by 
default in GCC, while on some other architectures, a nondefault GCC 
configure option would be needed to disable the support.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc.
  2016-08-08 14:40 [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Stefan Liebler
                   ` (9 preceding siblings ...)
  2016-08-08 17:58 ` [PATCH v2 9/9] Use libc_ifunc macro for siglongjmp, longjmp in libpthread Stefan Liebler
@ 2016-08-17 10:37 ` Stefan Liebler
  2016-08-17 11:04   ` Florian Weimer
  2016-08-24 14:10   ` Stefan Liebler
  10 siblings, 2 replies; 21+ messages in thread
From: Stefan Liebler @ 2016-08-17 10:37 UTC (permalink / raw)
  To: libc-alpha; +Cc: fweimer, murphyp, schwab, joseph_myers

Hi,

as information: I filed the following bugzilla "Bug 20478 - libc_ifunc 
macro and similar usages leads to false debug-information." 
(https://sourceware.org/bugzilla/show_bug.cgi?id=20478)

How to proceed with this patchset?

My suggestion is to check for gcc-attribute-ifunc support while 
configuring glibc.

If it is available (currently on intel, s390 and on fedora/rhel for 
power and arm) the gcc-attribute-ifunc will be used for ifunc-macros to 
get rid of the false debug-information.

If it is not available the current approach for ifunc-macros will be 
used instead. This way the debug-information is not correct, but it does 
not break current configurations without the gcc-support.
Furthermore the "assembler hacks" for ifunc-handling are not scattered 
in multiple files but are used only indirect via ifunc-macros and can 
simply removed in libc-symbols.h in future.
If glibc is configured with --enable-multi-arch then configure will dump 
a warning that gcc does not support attribute ifunc and it can be 
enabled by configuring gcc with --enable-gnu-indirect-function.

I'll add a note in INSTALL/NEWS file that a gcc with ifunc support is 
recommended for multi-arch glibcs and how it can be enabled.

After the patchset is committed I can write a note to the Distribution 
Maintainers listed in 
https://sourceware.org/glibc/wiki/MAINTAINERS#Distribution_Maintainers 
to enable ifunc in their gccs. Furthermore I can file a bug against gcc 
to enable ifunc support in <gcc-src>/gcc/config.gcc on architectures 
which support ifunc in binutils.


If we have consensus about this approach, I'll prepare/post a further 
version of the patchset.

Bye
Stefan

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc.
  2016-08-17 10:37 ` [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Stefan Liebler
@ 2016-08-17 11:04   ` Florian Weimer
  2016-08-17 12:21     ` Joseph Myers
  2016-08-24 14:10   ` Stefan Liebler
  1 sibling, 1 reply; 21+ messages in thread
From: Florian Weimer @ 2016-08-17 11:04 UTC (permalink / raw)
  To: Stefan Liebler, libc-alpha; +Cc: murphyp, schwab, joseph_myers

On 08/17/2016 12:37 PM, Stefan Liebler wrote:
> My suggestion is to check for gcc-attribute-ifunc support while
> configuring glibc.
>
> If it is available (currently on intel, s390 and on fedora/rhel for
> power and arm) the gcc-attribute-ifunc will be used for ifunc-macros to
> get rid of the false debug-information.
>
> If it is not available the current approach for ifunc-macros will be
> used instead. This way the debug-information is not correct, but it does
> not break current configurations without the gcc-support.
> Furthermore the "assembler hacks" for ifunc-handling are not scattered
> in multiple files but are used only indirect via ifunc-macros and can
> simply removed in libc-symbols.h in future.
> If glibc is configured with --enable-multi-arch then configure will dump
> a warning that gcc does not support attribute ifunc and it can be
> enabled by configuring gcc with --enable-gnu-indirect-function.

This looks like a good plan to me.

Thanks,
Florian

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc.
  2016-08-17 11:04   ` Florian Weimer
@ 2016-08-17 12:21     ` Joseph Myers
  0 siblings, 0 replies; 21+ messages in thread
From: Joseph Myers @ 2016-08-17 12:21 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Stefan Liebler, libc-alpha, murphyp, schwab

On Wed, 17 Aug 2016, Florian Weimer wrote:

> On 08/17/2016 12:37 PM, Stefan Liebler wrote:
> > My suggestion is to check for gcc-attribute-ifunc support while
> > configuring glibc.
> > 
> > If it is available (currently on intel, s390 and on fedora/rhel for
> > power and arm) the gcc-attribute-ifunc will be used for ifunc-macros to
> > get rid of the false debug-information.
> > 
> > If it is not available the current approach for ifunc-macros will be
> > used instead. This way the debug-information is not correct, but it does
> > not break current configurations without the gcc-support.
> > Furthermore the "assembler hacks" for ifunc-handling are not scattered
> > in multiple files but are used only indirect via ifunc-macros and can
> > simply removed in libc-symbols.h in future.
> > If glibc is configured with --enable-multi-arch then configure will dump
> > a warning that gcc does not support attribute ifunc and it can be
> > enabled by configuring gcc with --enable-gnu-indirect-function.
> 
> This looks like a good plan to me.

Likewise.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc.
  2016-08-17 10:37 ` [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Stefan Liebler
  2016-08-17 11:04   ` Florian Weimer
@ 2016-08-24 14:10   ` Stefan Liebler
  1 sibling, 0 replies; 21+ messages in thread
From: Stefan Liebler @ 2016-08-24 14:10 UTC (permalink / raw)
  To: libc-alpha

On 08/17/2016 12:37 PM, Stefan Liebler wrote:
> If we have consensus about this approach, I'll prepare/post a further
> version of the patchset.
>
> Bye
> Stefan
>
After the answers from Florian and Joseph I've posted a further version 
here:
"[PATCH v3 1/9] Add configure check to test if gcc supports attribute 
ifunc."
https://www.sourceware.org/ml/libc-alpha/2016-08/msg00752.html

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2016-08-24 14:10 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-08 14:40 [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Stefan Liebler
2016-08-08 14:40 ` [PATCH v2 6/9] Use libc_ifunc macro for clock_* symbols in librt Stefan Liebler
2016-08-08 14:40 ` [PATCH v2 3/9] s390: Refactor ifunc resolvers due to false debuginfo Stefan Liebler
2016-08-08 14:40 ` [PATCH v2 2/9] Use gcc attribute ifunc in libc_ifunc macro instead of inline assembly " Stefan Liebler
2016-08-08 14:40 ` [PATCH v2 8/9] Use libc_ifunc macro for vfork in libpthread Stefan Liebler
2016-08-08 14:40 ` [PATCH v2 5/9] ppc: Use libc_ifunc macro for time, gettimeofday Stefan Liebler
2016-08-08 14:40 ` [PATCH v2 7/9] Use libc_ifunc macro for system in libpthread Stefan Liebler
2016-08-08 14:40 ` [PATCH v2 4/9] i386, x86: Use libc_ifunc macro for time, gettimeofday Stefan Liebler
2016-08-08 16:08 ` [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Paul E. Murphy
2016-08-08 16:42   ` Joseph Myers
2016-08-08 16:52   ` Andreas Schwab
2016-08-09 15:12   ` Stefan Liebler
2016-08-08 16:40 ` Joseph Myers
2016-08-09 11:56   ` Florian Weimer
2016-08-09 15:12     ` Stefan Liebler
2016-08-09 20:15     ` Joseph Myers
2016-08-08 17:58 ` [PATCH v2 9/9] Use libc_ifunc macro for siglongjmp, longjmp in libpthread Stefan Liebler
2016-08-17 10:37 ` [PATCH v2 1/9] Add configure check to test if gcc supports attribute ifunc Stefan Liebler
2016-08-17 11:04   ` Florian Weimer
2016-08-17 12:21     ` Joseph Myers
2016-08-24 14:10   ` Stefan Liebler

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).