This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Compilation problem on m68k/memcpy.S
- From: Vincent Rivière <vincent dot riviere at freesbee dot fr>
- To: newlib at sourceware dot org
- Date: Thu, 03 Jan 2008 11:42:26 +0100
- Subject: Compilation problem on m68k/memcpy.S
Hello.
There is a compilation problem on these 2 files :
newlib/libc/machine/m68k/memcpy.S
newlib/libc/machine/m68k/memset.S
when compiling on a m68k target using symbols with leading underscores.
The attached patch fixes the problem.
It uses the well-known SYM() macro.
This patch works. However, it may be a good idea do centralize this
macro somewhere for the whole library.
Note there is also:
#ifndef __USER_LABEL_PREFIX__
#define __USER_LABEL_PREFIX__ _
#endif
I kept it like this, because this is the usual way to do.
However, when __USER_LABEL_PREFIX__ is not automatically defined, it
might be better to define it to nothing to avoid regressions.
I hope this will help.
--
Vincent Rivière
diff -aurN newlib-1.16.0/newlib/libc/machine/m68k/memcpy.S newlib-1.16.0-mint-20080103/newlib/libc/machine/m68k/memcpy.S
--- newlib-1.16.0/newlib/libc/machine/m68k/memcpy.S 2007-05-03 21:45:26.000000000 +0200
+++ newlib-1.16.0-mint-20080103/newlib/libc/machine/m68k/memcpy.S 2008-01-01 23:22:06.406250000 +0100
@@ -13,11 +13,26 @@
* they apply.
*/
+/* These are predefined by new versions of GNU cpp. */
+
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+/* ANSI concatenation macros. */
+
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+/* Use the right prefix for global labels. */
+
+#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+
.text
.align 4
- .globl memcpy
- .type memcpy, @function
+ .globl SYM(memcpy)
+ .type SYM(memcpy), @function
/* memcpy, optimised
*
@@ -31,7 +46,7 @@
* to further improve speed.
*/
-memcpy:
+SYM(memcpy):
move.l 4(%sp),%a0 | dest ptr
move.l 8(%sp),%a1 | src ptr
move.l 12(%sp),%d1 | len
diff -aurN newlib-1.16.0/newlib/libc/machine/m68k/memset.S newlib-1.16.0-mint-20080103/newlib/libc/machine/m68k/memset.S
--- newlib-1.16.0/newlib/libc/machine/m68k/memset.S 2007-05-03 21:45:26.000000000 +0200
+++ newlib-1.16.0-mint-20080103/newlib/libc/machine/m68k/memset.S 2008-01-01 23:22:06.406250000 +0100
@@ -13,11 +13,26 @@
* they apply.
*/
+/* These are predefined by new versions of GNU cpp. */
+
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+/* ANSI concatenation macros. */
+
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+/* Use the right prefix for global labels. */
+
+#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+
.text
.align 4
- .globl memset
- .type memset, @function
+ .globl SYM(memset)
+ .type SYM(memset), @function
| memset, optimised
|
@@ -38,7 +53,7 @@
|
| VG, April 2007
|
-memset:
+SYM(memset):
move.l 4(%sp),%a0 | dest ptr
move.l 8(%sp),%d0 | value
move.l 12(%sp),%d1 | len