diff mbox

Fix stpcpy / mempcpy namespace (bug 17573)

Message ID alpine.DEB.2.10.1411131654290.20029@digraph.polyomino.org.uk
State New
Headers show

Commit Message

Joseph Myers Nov. 13, 2014, 4:55 p.m. UTC
On Thu, 13 Nov 2014, Andreas Schwab wrote:

> /tmp/ccXDS5DL.s: Assembler messages:
> /tmp/ccXDS5DL.s:40: Error: symbol `__mempcpy' is already defined

This patch fixes the build of C mempcpy and stpcpy by disabling the
redirection to __mempcpy and __stpcpy asm names if
NO_MEMPCPY_STPCPY_REDIRECT is defined, and defining that macro in the
relevant source files.

Tested for powerpc32 that the build is fixed.

2014-11-13  Joseph Myers  <joseph@codesourcery.com>

	* include/string.h [NO_MEMPCPY_STPCPY_REDIRECT] (mempcpy): Do not
	redeclare with asm name.
	[NO_MEMPCPY_STPCPY_REDIRECT] (stpcpy): Likewise.
	* string/mempcpy.c (NO_MEMPCPY_STPCPY_REDIRECT): Define before
	including <string.h>.
	* string/stpcpy.c (NO_MEMPCPY_STPCPY_REDIRECT): Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy.c
	[!NOT_IN_libc] (NO_MEMPCPY_STPCPY_REDIRECT): Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/mempcpy.c
	[!NOT_IN_libc] (NO_MEMPCPY_STPCPY_REDIRECT): Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
	[SHARED && !NOT_IN_libc] (NO_MEMPCPY_STPCPY_REDIRECT): Likewise.

Comments

Joseph Myers Nov. 13, 2014, 8:18 p.m. UTC | #1
Note that I haven't yet committed this build fix patch for architectures 
using C stpcpy / mempcpy 
<https://sourceware.org/ml/libc-alpha/2014-11/msg00305.html>, pending 
confirmation from somebody that it seems sane.
Maciej W. Rozycki Nov. 13, 2014, 11:51 p.m. UTC | #2
On Thu, 13 Nov 2014, Joseph Myers wrote:

> > /tmp/ccXDS5DL.s: Assembler messages:
> > /tmp/ccXDS5DL.s:40: Error: symbol `__mempcpy' is already defined
> 
> This patch fixes the build of C mempcpy and stpcpy by disabling the
> redirection to __mempcpy and __stpcpy asm names if
> NO_MEMPCPY_STPCPY_REDIRECT is defined, and defining that macro in the
> relevant source files.
> 
> Tested for powerpc32 that the build is fixed.

 Likewise with the `mips64-linux-gnu' target (spanning the three usual 
MIPS ABIs).  Thanks!

  Maciej
Vidya Praveen Nov. 14, 2014, 10:20 a.m. UTC | #3
On Thu, Nov 13, 2014 at 08:18:49PM +0000, Joseph Myers wrote:
> Note that I haven't yet committed this build fix patch for architectures 
> using C stpcpy / mempcpy 
> <https://sourceware.org/ml/libc-alpha/2014-11/msg00305.html>, pending 
> confirmation from somebody that it seems sane.

This fixes aarch64-none-linux-gnu build.

VP.
Adhemerval Zanella Nov. 14, 2014, 12:19 p.m. UTC | #4
On 13-11-2014 18:18, Joseph Myers wrote:
> Note that I haven't yet committed this build fix patch for architectures 
> using C stpcpy / mempcpy 
> <https://sourceware.org/ml/libc-alpha/2014-11/msg00305.html>, pending 
> confirmation from somebody that it seems sane.
>
It fixes the powerpc64 build issues I was seeing.
Stefan Liebler Nov. 14, 2014, 12:34 p.m. UTC | #5
On 11/13/2014 09:18 PM, Joseph Myers wrote:
> Note that I haven't yet committed this build fix patch for architectures
> using C stpcpy / mempcpy
> <https://sourceware.org/ml/libc-alpha/2014-11/msg00305.html>, pending
> confirmation from somebody that it seems sane.
>
This fixes build issues on s390. Thanks.
Vidya Praveen Nov. 14, 2014, 2:08 p.m. UTC | #6
On Fri, Nov 14, 2014 at 10:20:48AM +0000, Vidya Praveen wrote:
> On Thu, Nov 13, 2014 at 08:18:49PM +0000, Joseph Myers wrote:
> > Note that I haven't yet committed this build fix patch for architectures 
> > using C stpcpy / mempcpy 
> > <https://sourceware.org/ml/libc-alpha/2014-11/msg00305.html>, pending 
> > confirmation from somebody that it seems sane.
> 
> This fixes aarch64-none-linux-gnu build.

And arm-none-linux-gnueabi/gnueabihf.

VP.
diff mbox

Patch

diff --git a/include/string.h b/include/string.h
index 99cc2d3..172940b 100644
--- a/include/string.h
+++ b/include/string.h
@@ -115,7 +115,8 @@  libc_hidden_builtin_proto (strspn)
 libc_hidden_builtin_proto (strstr)
 libc_hidden_builtin_proto (ffs)
 
-#if defined NOT_IN_libc || !defined SHARED
+#if (defined NOT_IN_libc || !defined SHARED) \
+  && !defined NO_MEMPCPY_STPCPY_REDIRECT
 /* Redirect calls to __builtin_mempcpy and __builtin_stpcpy to call
    __mempcpy and __stpcpy if not inlined.  */
 extern __typeof (mempcpy) mempcpy __asm__ ("__mempcpy");
diff --git a/string/mempcpy.c b/string/mempcpy.c
index 9749863..aab1bed 100644
--- a/string/mempcpy.c
+++ b/string/mempcpy.c
@@ -19,6 +19,7 @@ 
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define NO_MEMPCPY_STPCPY_REDIRECT
 #include <string.h>
 
 #undef mempcpy
diff --git a/string/stpcpy.c b/string/stpcpy.c
index fc5ae55..9185acc 100644
--- a/string/stpcpy.c
+++ b/string/stpcpy.c
@@ -19,6 +19,7 @@ 
 # include <config.h>
 #endif
 
+#define NO_MEMPCPY_STPCPY_REDIRECT
 #include <string.h>
 
 #undef __stpcpy
diff --git a/sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy.c b/sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy.c
index 38fbcc3..89f4912 100644
--- a/sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy.c
+++ b/sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy.c
@@ -17,6 +17,7 @@ 
    <http://www.gnu.org/licenses/>.  */
 
 #ifndef NOT_IN_libc
+# define NO_MEMPCPY_STPCPY_REDIRECT
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
diff --git a/sysdeps/powerpc/powerpc64/multiarch/mempcpy.c b/sysdeps/powerpc/powerpc64/multiarch/mempcpy.c
index 38fbcc3..89f4912 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/mempcpy.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/mempcpy.c
@@ -17,6 +17,7 @@ 
    <http://www.gnu.org/licenses/>.  */
 
 #ifndef NOT_IN_libc
+# define NO_MEMPCPY_STPCPY_REDIRECT
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"
diff --git a/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c b/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
index c7118d5..28153b7 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
@@ -17,6 +17,7 @@ 
    <http://www.gnu.org/licenses/>.  */
 
 #if defined SHARED && !defined NOT_IN_libc
+# define NO_MEMPCPY_STPCPY_REDIRECT
 # include <string.h>
 # include <shlib-compat.h>
 # include "init-arch.h"