This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] builtin expansion of strncmp for rs6000
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Aaron Sawdey <acsawdey at linux dot vnet dot ibm dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>, Segher Boessenkool <segher at kernel dot crashing dot org>, David Edelsohn <dje dot gcc at gmail dot com>, Bill Schmidt <wschmidt at linux dot vnet dot ibm dot com>, Tulio Magno Quites Machado Filho <tuliom at linux dot vnet dot ibm dot com>
- Date: Thu, 12 Jan 2017 17:53:06 +0000
- Subject: Re: [PATCH] builtin expansion of strncmp for rs6000
- Authentication-results: sourceware.org; auth=none
- References: <1481819465.5501.5.camel@linux.vnet.ibm.com>
On Thu, 15 Dec 2016, Aaron Sawdey wrote:
> + emit_library_call_value (gen_rtx_SYMBOL_REF (Pmode, "strncmp"),
> + target, LCT_NORMAL, GET_MODE (target), 3,
> + force_reg (Pmode, XEXP (src1, 0)), Pmode,
> + force_reg (Pmode, XEXP (src2, 0)), Pmode,
> + len_rtx, GET_MODE (len_rtx));
Building glibc with GCC mainline for powerpc64le-linux-gnu (from my bot
doing such builds and compilation parts of the testsuite for all GNU/Linux
glibc ABIs daily), I'm seeing a failure of the elf/check-localplt test,
"Extra PLT reference: libc.so: strncmp".
Without having bisected, I suspect this patch of being a likely cause of
that failure. glibc redirects internal calls to use hidden aliases such
as __GI_strncmp to avoid them going through the PLT. By using
gen_rtx_SYMBOL_REF there with a hardcoded function name "strncmp", this
code looks like it would render a declaration of strncmp with asm
("__GI_strncmp") ineffective, generating a direct call to strncmp when
glibc expects __GI_strncmp to be called instead.
I don't know how readily this code can be made to respect asm renaming of
strncmp. If it's hard to fix in GCC, I suppose glibc needs a powerpc
version of symbol-hacks.h to handle this redirection.
--
Joseph S. Myers
joseph@codesourcery.com