|
|
00db10 |
From 42e0828f582dcc4ff92d65039910ffe5fa9d881b Mon Sep 17 00:00:00 2001
|
|
|
00db10 |
From: Stefan Liebler <stli@linux.vnet.ibm.com>
|
|
|
00db10 |
Date: Thu, 27 Jul 2017 10:53:58 +0200
|
|
|
00db10 |
Subject: [PATCH 02/10] S390: Use new s390_libc_ifunc_expr macro in s390
|
|
|
00db10 |
8bit-generic.c.
|
|
|
00db10 |
|
|
|
00db10 |
upstream-commit 51213e2b8d89164527131f3bf6c5946b811c5e3e
|
|
|
00db10 |
|
|
|
00db10 |
This patch adds s390_libc_ifunc_expr macro which uses the __ifunc base macro
|
|
|
00db10 |
(upstream it is in include/libc-symbols.h; this backport implements it
|
|
|
00db10 |
in s390-header) and lets the user define a generic expression to
|
|
|
00db10 |
choose the correct ifunc variant. Furthermore as the base macro is used,
|
|
|
00db10 |
the ifunc resolver functions are now also using inhibit_stack_protector.
|
|
|
00db10 |
S390 needs its own version due to the hwcap argument of the ifunc resolver.
|
|
|
00db10 |
|
|
|
00db10 |
This new macro is now used in iconv code in 8bit-generic.c instead of using
|
|
|
00db10 |
gcc attribute ifunc directly.
|
|
|
00db10 |
|
|
|
00db10 |
ChangeLog:
|
|
|
00db10 |
|
|
|
00db10 |
* sysdeps/s390/multiarch/ifunc-resolve.h
|
|
|
00db10 |
(s390_libc_ifunc_expr_init, s390_libc_ifunc_expr, __ifunc,
|
|
|
00db10 |
__ifunc_resolver): New Define.
|
|
|
00db10 |
* sysdeps/s390/multiarch/8bit-generic.c
|
|
|
00db10 |
(__to_generic, __from_generic): Use s390_libc_ifunc_expr to
|
|
|
00db10 |
define ifunc resolvers.
|
|
|
00db10 |
---
|
|
|
00db10 |
sysdeps/s390/multiarch/8bit-generic.c | 41 ++++++++++------------------------
|
|
|
00db10 |
sysdeps/s390/multiarch/ifunc-resolve.h | 20 +++++++++++++++++
|
|
|
00db10 |
2 files changed, 32 insertions(+), 29 deletions(-)
|
|
|
00db10 |
|
|
|
00db10 |
diff --git a/sysdeps/s390/multiarch/8bit-generic.c b/sysdeps/s390/multiarch/8bit-generic.c
|
|
|
00db10 |
index 93565e1..9232240 100644
|
|
|
00db10 |
--- a/sysdeps/s390/multiarch/8bit-generic.c
|
|
|
00db10 |
+++ b/sysdeps/s390/multiarch/8bit-generic.c
|
|
|
00db10 |
@@ -40,8 +40,7 @@
|
|
|
00db10 |
to translate between multiple generic characters and "1 byte UCS4"
|
|
|
00db10 |
characters at once. The vector instructions are used to convert between
|
|
|
00db10 |
the "1 byte UCS4" and UCS4. */
|
|
|
00db10 |
-# include <unistd.h>
|
|
|
00db10 |
-# include <dl-procinfo.h>
|
|
|
00db10 |
+# include <ifunc-resolve.h>
|
|
|
00db10 |
|
|
|
00db10 |
# undef FROM_LOOP
|
|
|
00db10 |
# undef TO_LOOP
|
|
|
00db10 |
@@ -372,33 +371,17 @@
|
|
|
00db10 |
|
|
|
00db10 |
|
|
|
00db10 |
/* Generate ifunc'ed loop function. */
|
|
|
00db10 |
-__typeof(__from_generic_c)
|
|
|
00db10 |
-__attribute__ ((ifunc ("__from_generic_resolver")))
|
|
|
00db10 |
-__from_generic;
|
|
|
00db10 |
+s390_libc_ifunc_expr (__from_generic_c, __from_generic,
|
|
|
00db10 |
+ (sizeof (from_ucs4) / sizeof (from_ucs4[0]) <= 256
|
|
|
00db10 |
+ && hwcap & HWCAP_S390_VX)
|
|
|
00db10 |
+ ? __from_generic_vx
|
|
|
00db10 |
+ : __from_generic_c);
|
|
|
00db10 |
|
|
|
00db10 |
-static void *
|
|
|
00db10 |
-__from_generic_resolver (unsigned long int dl_hwcap)
|
|
|
00db10 |
-{
|
|
|
00db10 |
- if (sizeof (from_ucs4) / sizeof (from_ucs4[0]) <= 256
|
|
|
00db10 |
- && dl_hwcap & HWCAP_S390_VX)
|
|
|
00db10 |
- return &__from_generic_vx;
|
|
|
00db10 |
- else
|
|
|
00db10 |
- return &__from_generic_c;
|
|
|
00db10 |
-}
|
|
|
00db10 |
-
|
|
|
00db10 |
-__typeof(__to_generic_c)
|
|
|
00db10 |
-__attribute__ ((ifunc ("__to_generic_resolver")))
|
|
|
00db10 |
-__to_generic;
|
|
|
00db10 |
-
|
|
|
00db10 |
-static void *
|
|
|
00db10 |
-__to_generic_resolver (unsigned long int dl_hwcap)
|
|
|
00db10 |
-{
|
|
|
00db10 |
- if (sizeof (from_ucs4) / sizeof (from_ucs4[0]) <= 256
|
|
|
00db10 |
- && dl_hwcap & HWCAP_S390_VX)
|
|
|
00db10 |
- return &__to_generic_vx;
|
|
|
00db10 |
- else
|
|
|
00db10 |
- return &__to_generic_c;
|
|
|
00db10 |
-}
|
|
|
00db10 |
+s390_libc_ifunc_expr (__to_generic_c, __to_generic,
|
|
|
00db10 |
+ (sizeof (from_ucs4) / sizeof (from_ucs4[0]) <= 256
|
|
|
00db10 |
+ && hwcap & HWCAP_S390_VX)
|
|
|
00db10 |
+ ? __to_generic_vx
|
|
|
00db10 |
+ : __to_generic_c);
|
|
|
00db10 |
|
|
|
00db10 |
strong_alias (__to_generic_c_single, __to_generic_single)
|
|
|
00db10 |
|
|
|
00db10 |
@@ -410,6 +393,6 @@ strong_alias (__to_generic_c_single, __to_generic_single)
|
|
|
00db10 |
|
|
|
00db10 |
#else
|
|
|
00db10 |
/* Generate this module without ifunc if build environment lacks vector
|
|
|
00db10 |
- support. Instead the common 8bit-generic.c is used. */
|
|
|
00db10 |
+ support. Instead the common 8bit-generic.c is used. */
|
|
|
00db10 |
# include "iconvdata/8bit-generic.c"
|
|
|
00db10 |
#endif /* !defined HAVE_S390_VX_ASM_SUPPORT */
|
|
|
00db10 |
diff --git a/sysdeps/s390/multiarch/ifunc-resolve.h b/sysdeps/s390/multiarch/ifunc-resolve.h
|
|
|
00db10 |
index e9fd90e..883365b 100644
|
|
|
00db10 |
--- a/sysdeps/s390/multiarch/ifunc-resolve.h
|
|
|
00db10 |
+++ b/sysdeps/s390/multiarch/ifunc-resolve.h
|
|
|
00db10 |
@@ -92,3 +92,23 @@
|
|
|
00db10 |
return &RESOLVERFUNC##_c; \
|
|
|
00db10 |
} \
|
|
|
00db10 |
__asm__ (".type " #FUNC ", %gnu_indirect_function");
|
|
|
00db10 |
+
|
|
|
00db10 |
+/* Helper / base macros for indirect function symbols
|
|
|
00db10 |
+ (See include/libc-symbols in upstream glibc). */
|
|
|
00db10 |
+#define __ifunc_resolver(type_name, name, expr, arg, init, classifier) \
|
|
|
00db10 |
+ classifier void *name##_ifunc (arg) \
|
|
|
00db10 |
+ { \
|
|
|
00db10 |
+ init (); \
|
|
|
00db10 |
+ __typeof (type_name) *res = expr; \
|
|
|
00db10 |
+ return res; \
|
|
|
00db10 |
+ }
|
|
|
00db10 |
+
|
|
|
00db10 |
+#define __ifunc(type_name, name, expr, arg, init) \
|
|
|
00db10 |
+ extern __typeof (type_name) name __attribute__ \
|
|
|
00db10 |
+ ((ifunc (#name "_ifunc"))); \
|
|
|
00db10 |
+ __ifunc_resolver (type_name, name, expr, arg, init, static)
|
|
|
00db10 |
+
|
|
|
00db10 |
+#define s390_libc_ifunc_expr_init()
|
|
|
00db10 |
+#define s390_libc_ifunc_expr(TYPE_FUNC, FUNC, EXPR) \
|
|
|
00db10 |
+ __ifunc (TYPE_FUNC, FUNC, EXPR, unsigned long int hwcap, \
|
|
|
00db10 |
+ s390_libc_ifunc_expr_init);
|
|
|
00db10 |
--
|
|
|
00db10 |
1.8.3.1
|
|
|
00db10 |
|