This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 2.25] powerpc: Avoid calling strncmp via PLT on GCC 7
- From: Aaron Sawdey <acsawdey at linux dot vnet dot ibm dot com>
- To: Tulio Magno Quites Machado Filho <tuliom at linux dot vnet dot ibm dot com>, libc-alpha at sourceware dot org, joseph at codesourcery dot com
- Cc: segher at kernel dot crashing dot org, siddhesh at sourceware dot org
- Date: Mon, 16 Jan 2017 14:40:43 -0600
- Subject: Re: [PATCH 2.25] powerpc: Avoid calling strncmp via PLT on GCC 7
- Authentication-results: sourceware.org; auth=none
- References: <1484573359-7879-1-git-send-email-tuliom@linux.vnet.ibm.com>
On Mon, 2017-01-16 at 11:29 -0200, Tulio Magno Quites Machado Filho
wrote:
> This patch only fixes the issue on elf/check-localplt.
> In case you notice any other test failures when comparing strings on
> GCC
> 7, please refer to this patch:
> https://gcc.gnu.org/ml/gcc-patches/2017-01/msg00744.html
Tulio,
I'll be posting an updated version of that patch shortly that
addresses the issues you were seeing. However it adds builtin expansion
of both strncmp and strcmp so I think your patch needs to add both to
powerpc/symbol-hacks.h. Here is what I get from check-localplt with
gcc7 plus this patch:
cat /home/sawdey/src/glibc/build/elf/check-localplt.out
Extra PLT reference: libc.so: strcmp
Extra PLT reference: libc.so: strncmp
Thanks,
Aaron
>
> -- 8< --
>
> GCC 7 added support for a strncmp built-in for POWER7, generating PLT
> calls
> to strncmp from libc.
>
> 2017-01-16 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.
> com>
>
> * sysdeps/powerpc/symbol-hacks.h: New file. Enforce strncmp
> calls don't go through the PLT.
> ---
> sysdeps/powerpc/symbol-hacks.h | 7 +++++++
> 1 file changed, 7 insertions(+)
> create mode 100644 sysdeps/powerpc/symbol-hacks.h
>
> diff --git a/sysdeps/powerpc/symbol-hacks.h b/sysdeps/powerpc/symbol-
> hacks.h
> new file mode 100644
> index 0000000..7558b18
> --- /dev/null
> +++ b/sysdeps/powerpc/symbol-hacks.h
> @@ -0,0 +1,7 @@
> +#include <sysdeps/generic/symbol-hacks.h>
> +
> +/* GCC 7.0 added support for a builtin strncmp that is used on POWER
> >= 7. */
> +#if !defined __ASSEMBLER__ && IS_IN (libc) && defined SHARED \
> + && defined _ARCH_PWR7
> +asm ("strncmp = __GI_strncmp");
> +#endif
--
Aaron Sawdey, Ph.D. acsawdey@linux.vnet.ibm.com
050-2/C113 (507) 253-7520 home: 507/263-0782
IBM Linux Technology Center - PPC Toolchain