On 08/29/2016 10:16 PM, Paul E. Murphy wrote:
>
>
> On 08/24/2016 09:04 AM, Stefan Liebler wrote:
>
>>
>> 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 this redirection is not needed.
>
> Should memccpy read mempcpy? Also, is the reason why you are able to remove the
> libc_hidden_def usage later on in this patch?
>
Sorry. This comment means sysdeps/s390/multiarch/memccpy.c. There is
also a weak alias but no __GI_* symbol.
Regarding mempcpy in powerpc:
Before this patch there were two __GI_mempcpy symbols in powerpc-build:
readelf -s string/mempcpy.os | grep __GI_mempcpy
16: 0000000000000000 156 IFUNC WEAK HIDDEN 7 __GI_mempcpy
readelf -s string/mempcpy-ppc64.os | grep __GI_mempcpy
13: 0000000000000000 64 FUNC GLOBAL DEFAULT 6 __GI_mempcpy
This only works as the IFUNC-one is weak. The resulting libc.so uses the
non-IFUNC-one:
readelf -s libc.so | grep _mempcpy
4716: 00000000001d8580 64 FUNC LOCAL DEFAULT 27 __GI_mempcpy
5360: 00000000001d8580 64 FUNC LOCAL DEFAULT 27 __mempcpy_ppc
...
With the redirection I can remove the libc_hidden_def (mempcpy) in
sysdeps/powerpc/powerpc64/multiarch/mempcpy.c and
sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy.c. Now it is obvious
that the libc_hidden_def in
sysdeps/powerpc/powerpc64/multiarch/mempcpy-ppc64.c and
sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy-ppc32.c is used.
>> --- 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
> finitef and finitel don't seem to be needed here.
>
If I omit the the redirection of finitef and finitel the following error
occurs (See my further comments below):
gcc ../sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c -c ...
In file included from <command-line>:0:0:
../include/math.h:15:15: error: ‘__finitef’ undeclared here (not in a
function)
hidden_proto (__finitef)
^
./../include/libc-symbols.h:409:27: note: in definition of macro
‘__hidden_proto’
extern thread __typeof (name) name __asm__ (__hidden_asmname
(#internal)) \
^
../include/math.h:15:1: note: in expansion of macro ‘hidden_proto’
hidden_proto (__finitef)
^
../include/math.h:20:15: error: ‘__finitel’ undeclared here (not in a
function)
hidden_proto (__finitel)
^
./../include/libc-symbols.h:409:27: note: in definition of macro
‘__hidden_proto’
extern thread __typeof (name) name __asm__ (__hidden_asmname
(#internal)) \
^
../include/math.h:20:1: note: in expansion of macro ‘hidden_proto’
hidden_proto (__finitel)
^
In file included from ../sysdeps/powerpc/fpu/math_private.h:26:0,
from ../sysdeps/ieee754/ldbl-opt/math_ldbl_opt.h:40,
from
../sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c:23:
../sysdeps/generic/math_private.h:325:12: error: ‘__finitel’ redeclared
as different kind of symbol
extern int __finitel (long double);
^
In file included from <command-line>:0:0:
../include/math.h:20:15: note: previous declaration of ‘__finitel’ was here
hidden_proto (__finitel)
^
./../include/libc-symbols.h:409:33: note: in definition of macro
‘__hidden_proto’
extern thread __typeof (name) name __asm__ (__hidden_asmname
(#internal)) \
^
../include/math.h:20:1: note: in expansion of macro ‘hidden_proto’
hidden_proto (__finitel)
Due to the mechanism in math.h (see below) the redirection of __finite
leads to also redirecting the definition of __finitef, __finitel as it
is also used in those __MATHDECL_1 usages in math/bits/mathcalls.h but
not in include/math.h when using hidden_proto (__finite[fl]).
Thus I also have to redirect the float and long double versions.
This also applies to __isinf, __isnan.
include/math.h:
3: #include <math/math.h>
15: hidden_proto (__finitef)
20: hidden_proto (__finitel)
math/math.h:
96: #define __MATHDECL_1(type, function,suffix, args) \
extern type __MATH_PRECNAME(function,suffix) args __THROW
104, 125, 172: #include <bits/mathcalls.h>
(for float, double, long double math functions)
math/bits/mathcalls.h:
194:__MATHDECL_1 (int,__isinf,, (_Mdouble_ __value)) __attribute__
((__const__));
197: __MATHDECL_1 (int,__finite,, (_Mdouble_ __value)) __attribute__
((__const__));
236: __MATHDECL_1 (int,__isnan,, (_Mdouble_ __value)) __attribute__
((__const__));
>> #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
> Likewise.
>
>
>> 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
> Similarly, __isinff and __isinfl don't seem to need indirect.
>
Same reason as in comment for
sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c.
>> #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
> Likewise.
>
>
>> 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
> __isnanf and __isnanl don't appear to need overrides too.
>
Same reason as in comment for
sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c.
>> #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
> Likewise.
>
>> 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
> __finitef and __finitel redirection doesn't seem necessary here.
>
Same reason as in comment for
sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c.
>> #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
> Likewise.
>
>
>> 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
> __isinff __isinfl don't seem to need redirection here.
>
Same reason as in comment for
sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c.
>> #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
> Likewise.
>
>> 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
> Is __isnanf or __isnanl redirection necessary here?
>
Same reason as in comment for
sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_finite.c.
>> #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
> Likewise.
>
>> 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
>
>> -libc_hidden_def (mempcpy)
> These removals are allowed because of the behavior you've mentioned in changelog?
See "Regarding mempcpy in powerpc:" above.
>
>
> Otherwise, the ppc bits of this patch are OK with the removal of the extra redirections.
>
Thanks for reviewing.
Patch LGTM and a powerpc32/power7 (to actually uses ifunc) and a build/run
for powerpc64le seems ok.
I see with recent Andreas ack of 4/9 that only 3/9 (s390 bits) and
9/9 (siglongjmp, longjmp in libpthread) seems to be the impending
bits. I plan to check on 9/9, but I won't be able to proper review
3/9 since I do not have access to a s390 machine anymore.
Some comments below:
On 24/08/2016 07:04, Stefan Liebler wrote:
> diff --git a/include/libc-symbols.h b/include/libc-symbols.h
> index c2b499a..44e5253 100644
> --- a/include/libc-symbols.h
> +++ b/include/libc-symbols.h
> @@ -722,27 +722,64 @@ for linking")
> # define compat_data_section .section ".data.compat", "aw";
> #endif
>
> -/* Marker used for indirection function symbols. */
> -#define libc_ifunc(name, expr) \
> - extern void *name##_ifunc (void) __asm__ (#name); \
> - void *name##_ifunc (void) \
> +/* Helper / base macros for indirect function symbols. */
> +#define __ifunc_resolver(type_name, name, expr, arg, init, classifier) \
> + classifier void *name##_ifunc (arg) \
> { \
> - INIT_ARCH (); \
> - __typeof (name) *res = expr; \
> + init (); \
> + __typeof (type_name) *res = expr; \
> return res; \
> - } \
> - __asm__ (".type " #name ", %gnu_indirect_function");
> + }
> +
> +#ifdef HAVE_GCC_IFUNC
> +# define __ifunc(type_name, name, expr, arg, init) \
> + extern __typeof (type_name) name __attribute__ \
> + ((ifunc (#name "_ifunc"))); \
> + __ifunc_resolver (type_name, name, expr, arg, init, static)
> +
> +# define __ifunc_hidden(type_name, name, expr, arg, init) \
> + __ifunc (type_name, name, expr, arg, init)
> +#else
> +/* Gcc does not support __attribute__ ((ifunc (...))). Use the old behaviour
> + as fallback. But keep in mind that the debug information for the ifunc
> + resolver functions is not correct. It contains the ifunc'ed function as
> + DW_AT_linkage_name. E.g. lldb uses this field and an inferior function
> + call of the ifunc'ed function will fail due to "no matching function for call
Line too long.
> + to ..." because the ifunc'ed function and the resolver function have
> + different signatures. (Gcc support is disabled at least on a ppc64le
> + Ubuntu 14.04 system.) */
> +
> +# define __ifunc(type_name, name, expr, arg, init) \
> + extern __typeof (type_name) name; \
> + void *name##_ifunc (arg) __asm__ (#name); \
> + __ifunc_resolver (type_name, name, expr, arg, init,) \
> + __asm__ (".type " #name ", %gnu_indirect_function");
> +
> +# define __ifunc_hidden(type_name, name, expr, arg, init) \
> + extern __typeof (type_name) __libc_##name; \
> + __ifunc (type_name, __libc_##name, expr, arg, init) \
> + strong_alias (__libc_##name, name);
> +#endif /* !HAVE_GCC_IFUNC */
> +
> +/* Use libc_ifunc if your ifunc'ed function has no internal symbol. */
> +#define libc_ifunc(name, expr) __ifunc (name, name, expr, void, INIT_ARCH)
I think it will be valuable to add a comment like the one on same
file at line 341 with a usage example on how to use
libc_ifunc{_redirected,_hidden} and difference between each usage and
the possible requirements (such as name redirection).
> +
> +/* 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)
> +
> +/* Use libc_ifunc_hidden if your ifunc'ed function has an internal symbol
> + which should be the ifunc'ed function'. */
> +#define libc_ifunc_hidden(redirected_name, name, expr) \
> + __ifunc_hidden (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)
Line too long.
@@ -722,27 +722,64 @@ for linking")
# define compat_data_section .section ".data.compat", "aw";
#endif
-/* Marker used for indirection function symbols. */
-#define libc_ifunc(name, expr) \
- extern void *name##_ifunc (void) __asm__ (#name); \
- void *name##_ifunc (void) \
+/* Helper / base macros for indirect function symbols. */
+#define __ifunc_resolver(type_name, name, expr, arg, init, classifier) \
+ classifier void *name##_ifunc (arg) \
{ \
- INIT_ARCH (); \
- __typeof (name) *res = expr; \
+ init (); \
+ __typeof (type_name) *res = expr; \
return res; \
- } \
- __asm__ (".type " #name ", %gnu_indirect_function");
+ }
+
+#ifdef HAVE_GCC_IFUNC
+# define __ifunc(type_name, name, expr, arg, init) \
+ extern __typeof (type_name) name __attribute__ \
+ ((ifunc (#name "_ifunc"))); \
+ __ifunc_resolver (type_name, name, expr, arg, init, static)
+
+# define __ifunc_hidden(type_name, name, expr, arg, init) \
+ __ifunc (type_name, name, expr, arg, init)
+#else
+/* Gcc does not support __attribute__ ((ifunc (...))). Use the old behaviour
+ as fallback. But keep in mind that the debug information for the ifunc
+ resolver functions is not correct. It contains the ifunc'ed function as
+ DW_AT_linkage_name. E.g. lldb uses this field and an inferior function
+ call of the ifunc'ed function will fail due to "no matching function for call
+ to ..." because the ifunc'ed function and the resolver function have
+ different signatures. (Gcc support is disabled at least on a ppc64le
+ Ubuntu 14.04 system.) */
+
+# define __ifunc(type_name, name, expr, arg, init) \
+ extern __typeof (type_name) name; \
+ void *name##_ifunc (arg) __asm__ (#name); \
+ __ifunc_resolver (type_name, name, expr, arg, init,) \
+ __asm__ (".type " #name ", %gnu_indirect_function");
+
+# define __ifunc_hidden(type_name, name, expr, arg, init) \
+ extern __typeof (type_name) __libc_##name; \
+ __ifunc (type_name, __libc_##name, expr, arg, init) \
+ strong_alias (__libc_##name, name);
+#endif /* !HAVE_GCC_IFUNC */
+
+/* Use libc_ifunc if your ifunc'ed function has no internal symbol. */
+#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)
+
+/* Use libc_ifunc_hidden if your ifunc'ed function has an internal symbol
+ which should be the ifunc'ed function'. */
+#define libc_ifunc_hidden(redirected_name, name, expr) \
+ __ifunc_hidden (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) \
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -26,13 +26,14 @@ extern __typeof (__isnanf) __isnanf_power5 attribute_hidden;
extern __typeof (__isnanf) __isnanf_power6 attribute_hidden;
extern __typeof (__isnanf) __isnan_power7 attribute_hidden;
-libc_ifunc (__isnanf,
- (hwcap & PPC_FEATURE_ARCH_2_06)
- ? __isnan_power7 :
- (hwcap & PPC_FEATURE_ARCH_2_05)
- ? __isnanf_power6 :
- (hwcap & PPC_FEATURE_POWER5)
- ? __isnanf_power5
- : __isnan_ppc32);
+libc_ifunc_hidden (__isnanf, __isnanf,
+ (hwcap & PPC_FEATURE_ARCH_2_06)
+ ? __isnan_power7
+ : (hwcap & PPC_FEATURE_ARCH_2_05)
+ ? __isnanf_power6
+ : (hwcap & PPC_FEATURE_POWER5)
+ ? __isnanf_power5
+ : __isnan_ppc32);
+hidden_def (__isnanf)
weak_alias (__isnanf, isnanf)
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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>
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -27,17 +27,18 @@ extern __typeof (__isnanf) __isnan_power6x attribute_hidden;
extern __typeof (__isnanf) __isnan_power7 attribute_hidden;
extern __typeof (__isnanf) __isnan_power8 attribute_hidden;
-libc_ifunc (__isnanf,
- (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);
+libc_ifunc_hidden (__isnanf, __isnanf,
+ (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);
+hidden_def (__isnanf)
weak_alias (__isnanf, isnanf)
@@ -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
@@ -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
@@ -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
@@ -26,14 +26,15 @@ extern __typeof (__stpcpy) __stpcpy_ppc attribute_hidden;
extern __typeof (__stpcpy) __stpcpy_power7 attribute_hidden;
extern __typeof (__stpcpy) __stpcpy_power8 attribute_hidden;
-libc_ifunc (__stpcpy,
- (hwcap2 & PPC_FEATURE2_ARCH_2_07)
- ? __stpcpy_power8 :
- (hwcap & PPC_FEATURE_HAS_VSX)
- ? __stpcpy_power7
- : __stpcpy_ppc);
+libc_ifunc_hidden (__stpcpy, __stpcpy,
+ (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+ ? __stpcpy_power8
+ : (hwcap & PPC_FEATURE_HAS_VSX)
+ ? __stpcpy_power7
+ : __stpcpy_ppc);
weak_alias (__stpcpy, stpcpy)
+libc_hidden_def (__stpcpy)
libc_hidden_def (stpcpy)
#else
# include <string/stpcpy.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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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>
@@ -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
@@ -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
@@ -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)