diff options
author | Adhemerval Zanella <azanella@linux.vnet.ibm.com> | 2014-05-02 12:00:36 -0500 |
---|---|---|
committer | Adhemerval Zanella <azanella@linux.vnet.ibm.com> | 2014-05-05 13:30:16 -0500 |
commit | 19c4bec0f43599eecc2f32de96ae179cd7d64053 (patch) | |
tree | 26047ede88c1c4231207e887b5ee88de9c60faff /sysdeps/powerpc/powerpc64 | |
parent | 7776e6692fe19553dafcb918df467aed522eea8d (diff) | |
download | glibc-19c4bec0f43599eecc2f32de96ae179cd7d64053.tar.gz glibc-19c4bec0f43599eecc2f32de96ae179cd7d64053.tar.xz glibc-19c4bec0f43599eecc2f32de96ae179cd7d64053.zip |
PowerPC: ifunc improvement for internal calls
This patch changes de default symbol redirection for internal call of memcpy, memset, memchr, and strlen to the IFUNC resolved ones. The performance improvement is noticeable in algorithms that uses these symbols extensible, like the regex functions.
Diffstat (limited to 'sysdeps/powerpc/powerpc64')
-rw-r--r-- | sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S | 3 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/multiarch/memcpy.c | 27 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S | 3 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/multiarch/memset.c | 20 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/multiarch/strlen-ppc64.S | 3 | ||||
-rw-r--r-- | sysdeps/powerpc/powerpc64/multiarch/strlen.c | 16 |
6 files changed, 48 insertions, 24 deletions
diff --git a/sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S b/sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S index a09d7603a6..c63065439f 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S +++ b/sysdeps/powerpc/powerpc64/multiarch/memcpy-ppc64.S @@ -36,8 +36,7 @@ END_2(__memcpy_ppc) # undef libc_hidden_builtin_def -# define libc_hidden_builtin_def(name) \ - .globl __GI_memcpy; __GI_memcpy = __memcpy_ppc +# define libc_hidden_builtin_def(name) #endif #include <sysdeps/powerpc/powerpc64/memcpy.S> diff --git a/sysdeps/powerpc/powerpc64/multiarch/memcpy.c b/sysdeps/powerpc/powerpc64/multiarch/memcpy.c index 6a916301e1..305e963e63 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/memcpy.c +++ b/sysdeps/powerpc/powerpc64/multiarch/memcpy.c @@ -20,20 +20,23 @@ DSO. In static binaries we need memcpy before the initialization happened. */ #if defined SHARED && !defined NOT_IN_libc +/* Redefine memcpy so that the compiler won't complain about the type + mismatch with the IFUNC selector in strong_alias, below. */ +# undef memcpy +# define memcpy __redirect_memcpy # include <string.h> -# include <shlib-compat.h> # include "init-arch.h" -extern __typeof (memcpy) __memcpy_ppc attribute_hidden; -extern __typeof (memcpy) __memcpy_power4 attribute_hidden; -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; +extern __typeof (__redirect_memcpy) __libc_memcpy; -/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle - ifunc symbol properly. */ -libc_ifunc (memcpy, +extern __typeof (__redirect_memcpy) __memcpy_ppc attribute_hidden; +extern __typeof (__redirect_memcpy) __memcpy_power4 attribute_hidden; +extern __typeof (__redirect_memcpy) __memcpy_cell attribute_hidden; +extern __typeof (__redirect_memcpy) __memcpy_power6 attribute_hidden; +extern __typeof (__redirect_memcpy) __memcpy_a2 attribute_hidden; +extern __typeof (__redirect_memcpy) __memcpy_power7 attribute_hidden; + +libc_ifunc (__libc_memcpy, (hwcap & PPC_FEATURE_HAS_VSX) ? __memcpy_power7 : (hwcap & PPC_FEATURE_ARCH_2_06) @@ -45,4 +48,8 @@ libc_ifunc (memcpy, (hwcap & PPC_FEATURE_POWER4) ? __memcpy_power4 : __memcpy_ppc); + +#undef memcpy +strong_alias (__libc_memcpy, memcpy); +libc_hidden_ver (__libc_memcpy, memcpy); #endif diff --git a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S index 65b3afe250..3601a77cd4 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S +++ b/sysdeps/powerpc/powerpc64/multiarch/memset-ppc64.S @@ -47,8 +47,7 @@ END_GEN_TB (__bzero_ppc,TB_TOCLESS) END_2(__memset_ppc) # undef libc_hidden_builtin_def -# define libc_hidden_builtin_def(name) \ - .globl __GI_memset; __GI_memset = __memset_ppc +# define libc_hidden_builtin_def(name) #endif /* Do not implement __bzero at powerpc64/memset.S. */ diff --git a/sysdeps/powerpc/powerpc64/multiarch/memset.c b/sysdeps/powerpc/powerpc64/multiarch/memset.c index 829d12759a..aa2ae7056e 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/memset.c +++ b/sysdeps/powerpc/powerpc64/multiarch/memset.c @@ -18,18 +18,24 @@ /* Define multiple versions only for definition in libc. */ #if defined SHARED && !defined NOT_IN_libc +/* Redefine memset so that the compiler won't complain about the type + mismatch with the IFUNC selector in strong_alias, below. */ +# undef memset +# define memset __redirect_memset # include <string.h> # include <shlib-compat.h> # include "init-arch.h" -extern __typeof (memset) __memset_ppc attribute_hidden; -extern __typeof (memset) __memset_power4 attribute_hidden; -extern __typeof (memset) __memset_power6 attribute_hidden; -extern __typeof (memset) __memset_power7 attribute_hidden; +extern __typeof (__redirect_memset) __libc_memset; + +extern __typeof (__redirect_memset) __memset_ppc attribute_hidden; +extern __typeof (__redirect_memset) __memset_power4 attribute_hidden; +extern __typeof (__redirect_memset) __memset_power6 attribute_hidden; +extern __typeof (__redirect_memset) __memset_power7 attribute_hidden; /* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle ifunc symbol properly. */ -libc_ifunc (memset, +libc_ifunc (__libc_memset, (hwcap & PPC_FEATURE_HAS_VSX) ? __memset_power7 : (hwcap & PPC_FEATURE_ARCH_2_05) @@ -37,4 +43,8 @@ libc_ifunc (memset, (hwcap & PPC_FEATURE_POWER4) ? __memset_power4 : __memset_ppc); + +#undef memset +strong_alias (__libc_memset, memset); +libc_hidden_ver (__libc_memset, memset); #endif diff --git a/sysdeps/powerpc/powerpc64/multiarch/strlen-ppc64.S b/sysdeps/powerpc/powerpc64/multiarch/strlen-ppc64.S index efcc212d7f..a195e9a0c1 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/strlen-ppc64.S +++ b/sysdeps/powerpc/powerpc64/multiarch/strlen-ppc64.S @@ -35,8 +35,7 @@ END_2(__strlen_ppc) # undef libc_hidden_builtin_def -# define libc_hidden_builtin_def(name) \ - .globl __GI_strlen; __GI_strlen = __strlen_ppc +# define libc_hidden_builtin_def(name) #endif #include <sysdeps/powerpc/powerpc64/strlen.S> diff --git a/sysdeps/powerpc/powerpc64/multiarch/strlen.c b/sysdeps/powerpc/powerpc64/multiarch/strlen.c index 6574696443..d2c26e9a9c 100644 --- a/sysdeps/powerpc/powerpc64/multiarch/strlen.c +++ b/sysdeps/powerpc/powerpc64/multiarch/strlen.c @@ -17,15 +17,25 @@ <http://www.gnu.org/licenses/>. */ #if defined SHARED && !defined NOT_IN_libc +/* Redefine strlen so that the compiler won't complain about the type + mismatch with the IFUNC selector in strong_alias, below. */ +# undef strlen +# 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; +extern __typeof (__redirect_strlen) __libc_strlen; -libc_ifunc (strlen, +extern __typeof (__redirect_strlen) __strlen_ppc attribute_hidden; +extern __typeof (__redirect_strlen) __strlen_power7 attribute_hidden; + +libc_ifunc (__libc_strlen, (hwcap & PPC_FEATURE_HAS_VSX) ? __strlen_power7 : __strlen_ppc); + +#undef strlen +strong_alias (__libc_strlen, strlen) +libc_hidden_ver (__libc_strlen, strlen) #endif |