]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
S390: Use new s390_libc_ifunc_expr macro in s390 8bit-generic.c.
authorStefan Liebler <stli@linux.vnet.ibm.com>
Fri, 21 Apr 2017 13:30:00 +0000 (15:30 +0200)
committerStefan Liebler <stli@linux.vnet.ibm.com>
Fri, 21 Apr 2017 13:30:00 +0000 (15:30 +0200)
This patch adds s390_libc_ifunc_expr macro which uses the __ifunc base macro
in include/libc-symbols.h and lets the user define a generic expression to
choose the correct ifunc variant.  Furthermore as the base macro is used,
the ifunc resolver functions are now also using inhibit_stack_protector.
S390 needs its own version due to the hwcap argument of the ifunc resolver.

This new macro is now used in iconv code in 8bit-generic.c instead of using
gcc attribute ifunc directly.

ChangeLog:

* sysdeps/s390/multiarch/ifunc-resolve.h
(s390_libc_ifunc_expr_init, s390_libc_ifunc_expr): New Define.
* sysdeps/s390/multiarch/8bit-generic.c
(__to_generic, __from_generic): Use s390_libc_ifunc_expr to
define ifunc resolvers.

ChangeLog
sysdeps/s390/multiarch/8bit-generic.c
sysdeps/s390/multiarch/ifunc-resolve.h

index dedd753d5f75b1913c868f39dfa51e456f4cabb3..12bf100cfa47c750527d7525351617a8ac42a7a8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2017-04-21  Stefan Liebler  <stli@linux.vnet.ibm.com>
+
+       * sysdeps/s390/multiarch/ifunc-resolve.h
+       (s390_libc_ifunc_expr_init, s390_libc_ifunc_expr): New Define.
+       * sysdeps/s390/multiarch/8bit-generic.c
+       (__to_generic, __from_generic): Use s390_libc_ifunc_expr to
+       define ifunc resolvers.
+
 2017-04-21  Florian Weimer  <fweimer@redhat.com>
 
        [BZ #20424]
index 99f63e4b0b4698dd29f7eb0fedf20dabca6f27bd..49f0ed8ae5fcf6faf5bea1707a65a251f85cf8eb 100644 (file)
@@ -40,8 +40,7 @@
    to translate between multiple generic characters and "1 byte UCS4"
    characters at once. The vector instructions are used to convert between
    the "1 byte UCS4" and UCS4.  */
-# include <unistd.h>
-# include <dl-procinfo.h>
+# include <ifunc-resolve.h>
 
 # undef FROM_LOOP
 # undef TO_LOOP
 
 
 /* Generate ifunc'ed loop function.  */
-__typeof(__from_generic_c)
-__attribute__ ((ifunc ("__from_generic_resolver")))
-__from_generic;
+s390_libc_ifunc_expr (__from_generic_c, __from_generic,
+                     (sizeof (from_ucs4) / sizeof (from_ucs4[0]) <= 256
+                      && hwcap & HWCAP_S390_VX)
+                     ? __from_generic_vx
+                     : __from_generic_c);
 
-static void *
-__from_generic_resolver (unsigned long int dl_hwcap)
-{
-  if (sizeof (from_ucs4) / sizeof (from_ucs4[0]) <= 256
-      && dl_hwcap & HWCAP_S390_VX)
-    return &__from_generic_vx;
-  else
-    return &__from_generic_c;
-}
-
-__typeof(__to_generic_c)
-__attribute__ ((ifunc ("__to_generic_resolver")))
-__to_generic;
-
-static void *
-__to_generic_resolver (unsigned long int dl_hwcap)
-{
-  if (sizeof (from_ucs4) / sizeof (from_ucs4[0]) <= 256
-      && dl_hwcap & HWCAP_S390_VX)
-    return &__to_generic_vx;
-  else
-    return &__to_generic_c;
-}
+s390_libc_ifunc_expr (__to_generic_c, __to_generic,
+                     (sizeof (from_ucs4) / sizeof (from_ucs4[0]) <= 256
+                      && hwcap & HWCAP_S390_VX)
+                     ? __to_generic_vx
+                     : __to_generic_c);
 
 strong_alias (__to_generic_c_single, __to_generic_single)
 
@@ -410,6 +393,6 @@ strong_alias (__to_generic_c_single, __to_generic_single)
 
 #else
 /* Generate this module without ifunc if build environment lacks vector
-   support. Instead the common 8bit-generic.c is used.  */
+   support.  Instead the common 8bit-generic.c is used.  */
 # include "iconvdata/8bit-generic.c"
 #endif /* !defined HAVE_S390_VX_ASM_SUPPORT */
index c04822d55a9ee843d8e09f014142f0168a42241b..adbd08a6eeb7576293571e0bf638708fb8a511cd 100644 (file)
@@ -83,3 +83,8 @@
           ? 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);