summaryrefslogtreecommitdiff
path: root/sysdeps/s390/multiarch/ifunc-resolve.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/s390/multiarch/ifunc-resolve.h')
-rw-r--r--sysdeps/s390/multiarch/ifunc-resolve.h86
1 files changed, 41 insertions, 45 deletions
diff --git a/sysdeps/s390/multiarch/ifunc-resolve.h b/sysdeps/s390/multiarch/ifunc-resolve.h
index 744a0d8d6d..b42ed922fd 100644
--- a/sysdeps/s390/multiarch/ifunc-resolve.h
+++ b/sysdeps/s390/multiarch/ifunc-resolve.h
@@ -1,6 +1,6 @@
/* IFUNC resolver function for CPU specific functions.
32/64 bit S/390 version.
- Copyright (C) 2015-2016 Free Software Foundation, Inc.
+ Copyright (C) 2015-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -40,55 +40,51 @@
".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" \
- ".globl __GI_" #FUNC "\n\t" \
- ".set __GI_" #FUNC "," #FUNC "\n"); \
- \
+#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_ifunc_redirected(TYPE_FUNC, FUNC) \
+ s390_vx_libc_ifunc2_redirected(TYPE_FUNC, FUNC, FUNC)
-#define s390_vx_libc_ifunc2(RESOLVERFUNC, 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);
+
+#define s390_libc_ifunc_expr_init()
+#define s390_libc_ifunc_expr(TYPE_FUNC, FUNC, EXPR) \
+ __ifunc (TYPE_FUNC, FUNC, EXPR, unsigned long int hwcap, \
+ s390_libc_ifunc_expr_init);