This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Support __aeabi_memclr, __aeabi_memmove and __aeabi_memset routines in the arm backend in newlib


Hi,

Like the previous __aeabi_memcpy patch. 

Some other routines in the run-time PCS are also need to be supported in
newlib.

In this patch,
__aeabi_memclr, __aeabi_memclr4 and __aeabi_memclr8 routines are added in
aeabi_memclr.c. And bzero() is called in __aeabi_memclr.
__aeabi_memmove, __aeabi_memmove4 and __aeabi_memmove8 routines are added in
aeabi_memmove.c. And memmove() is called in __aeabi_memmove.
__aeabi_memset, __aeabi_memset4 and __aeabi_memset8 routines are added in
aeabi_memset.c. And memset() is called in __aeabi_memset.

Bootstrap and no make check regression on X86-64. And the regression test on
thumb1, thumb2, armv7-a and armv7-m are passed.

Patch and ChangeLog are also attached for convenience.

Thanks and Best Regards,
Hale Wang

newlib/ChangeLog:

2014-08-05  Hale Wang  <hale.wang@arm.com>

	* libc/machine/arm/aeabi_memclr.c: New file.
	* libc/machine/arm/aeabi_memmove.c: Likewise.
	* libc/machine/arm/aeabi_memset.c: Likewise.
	* libc/machine/arm/Makefile.am: Add dependencies.
	* libc/machine/arm/Makefile.in: Regenerated.

============================================================================
=====================
diff --git a/newlib/libc/machine/arm/Makefile.am
b/newlib/libc/machine/arm/Makefile.am
index fb33926..a524d91 100644
--- a/newlib/libc/machine/arm/Makefile.am
+++ b/newlib/libc/machine/arm/Makefile.am
@@ -10,7 +10,8 @@ noinst_LIBRARIES = lib.a
 
 lib_a_SOURCES = setjmp.S access.c strlen.c strcmp.S strcpy.c \
 	        memcpy.S memcpy-stub.c memchr-stub.c memchr.S \
-		strlen.c strlen-armv7.S
+		strlen.c strlen-armv7.S aeabi_memclr.c aeabi_memmove.c \
+		aeabi_memset.c
 lib_a_CCASFLAGS=$(AM_CCASFLAGS)
 lib_a_CFLAGS = $(AM_CFLAGS)
 
diff --git a/newlib/libc/machine/arm/Makefile.in
b/newlib/libc/machine/arm/Makefile.in
index 1ccfac5..b6c5d23 100644
--- a/newlib/libc/machine/arm/Makefile.in
+++ b/newlib/libc/machine/arm/Makefile.in
@@ -74,7 +74,8 @@ am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT)
lib_a-access.$(OBJEXT) \
 	lib_a-strcpy.$(OBJEXT) lib_a-memcpy.$(OBJEXT) \
 	lib_a-memcpy-stub.$(OBJEXT) lib_a-memchr-stub.$(OBJEXT) \
 	lib_a-memchr.$(OBJEXT) lib_a-strlen.$(OBJEXT) \
-	lib_a-strlen-armv7.$(OBJEXT)
+	lib_a-strlen-armv7.$(OBJEXT) lib_a-aeabi_memclr.$(OBJEXT) \
+	lib_a-aeabi_memmove.$(OBJEXT) lib_a-aeabi_memset.$(OBJEXT)
 lib_a_OBJECTS = $(am_lib_a_OBJECTS)
 DEFAULT_INCLUDES = -I.@am__isrc@
 depcomp =
@@ -202,7 +203,8 @@ AM_CCASFLAGS = $(INCLUDES)
 noinst_LIBRARIES = lib.a
 lib_a_SOURCES = setjmp.S access.c strlen.c strcmp.S strcpy.c \
 	        memcpy.S memcpy-stub.c memchr-stub.c memchr.S \
-		strlen.c strlen-armv7.S
+		strlen.c strlen-armv7.S aeabi_memclr.c aeabi_memmove.c \
+		aeabi_memset.c
 
 lib_a_CCASFLAGS = $(AM_CCASFLAGS)
 lib_a_CFLAGS = $(AM_CFLAGS)
@@ -336,6 +338,25 @@ lib_a-memchr-stub.o: memchr-stub.c
 lib_a-memchr-stub.obj: memchr-stub.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)
$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memchr-stub.obj `if test
-f 'memchr-stub.c'; then $(CYGPATH_W) 'memchr-stub.c'; else $(CYGPATH_W)
'$(srcdir)/memchr-stub.c'; fi`
 
+lib_a-aeabi_memclr.o: aeabi_memclr.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)
$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-aeabi_memclr.o `test -f
'aeabi_memclr.c' || echo '$(srcdir)/'`aeabi_memclr.c
+
+lib_a-aeabi_memclr.obj: aeabi_memclr.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)
$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-aeabi_memclr.obj `if test
-f 'aeabi_memclr.c'; then $(CYGPATH_W) 'aeabi_memclr.c'; else $(CYGPATH_W)
'$(srcdir)/aeabi_memclr.c'; fi`
+
+lib_a-aeabi_memmove.o: aeabi_memmove.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)
$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-aeabi_memmove.o `test -f
'aeabi_memmove.c' || echo '$(srcdir)/'`aeabi_memmove.c
+
+lib_a-aeabi_memmove.obj: aeabi_memmove.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)
$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-aeabi_memmove.obj `if test
-f 'aeabi_memmove.c'; then $(CYGPATH_W) 'aeabi_memmove.c'; else $(CYGPATH_W)
'$(srcdir)/aeabi_memmove.c'; fi`
+
+lib_a-aeabi_memset.o: aeabi_memset.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)
$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-aeabi_memset.o `test -f
'aeabi_memset.c' || echo '$(srcdir)/'`aeabi_memset.c
+
+lib_a-aeabi_memset.obj: aeabi_memset.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)
$(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-aeabi_memset.obj `if test
-f 'aeabi_memset.c'; then $(CYGPATH_W) 'aeabi_memset.c'; else $(CYGPATH_W)
'$(srcdir)/aeabi_memset.c'; fi`
+
+
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
 	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
diff --git a/newlib/libc/machine/arm/aeabi_memclr.c
b/newlib/libc/machine/arm/aeabi_memclr.c
new file mode 100644
index 0000000..936da87
--- /dev/null
+++ b/newlib/libc/machine/arm/aeabi_memclr.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014 ARM Ltd
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the company may not be used to endorse or promote
+ *    products derived from this software without specific prior written
+ *    permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR
IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string.h>
+#include <_ansi.h>
+
+/* Support the routine __aeabi_memclr like bzero.  Can't alias
+   to bzero because it's not defined in the same translation
+   unit.  */
+void
+__aeabi_memclr (void *dest, size_t n)
+{
+  bzero (dest, n);
+}
+
+/* Support the alias versions of __aeabi_memclr which may assume
+   memory alignment.  */
+void
+__aeabi_memclr4 (void *dest, size_t n)
+	_ATTRIBUTE ((alias ("__aeabi_memclr")));
+void
+__aeabi_memclr8 (void *dest, size_t n)
+	_ATTRIBUTE ((alias ("__aeabi_memclr")));
diff --git a/newlib/libc/machine/arm/aeabi_memmove.c
b/newlib/libc/machine/arm/aeabi_memmove.c
new file mode 100644
index 0000000..cbbd3a8
--- /dev/null
+++ b/newlib/libc/machine/arm/aeabi_memmove.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014 ARM Ltd
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the company may not be used to endorse or promote
+ *    products derived from this software without specific prior written
+ *    permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR
IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string.h>
+#include <_ansi.h>
+
+/* Support the routine __aeabi_memmove like memmove.  Can't alias
+   to memmove because it's not defined in the same translation
+   unit.  */
+void
+__aeabi_memmove (void *dest, const void *src, size_t n)
+{
+  memmove (dest, src, n);
+}
+
+/* Support the alias versions of __aeabi_memmove which may assume
+   memory alignment.  */
+void
+__aeabi_memmove4 (void *dest, const void *src, size_t n)
+	_ATTRIBUTE ((alias ("__aeabi_memmove")));
+void
+__aeabi_memmove8 (void *dest, const void *src, size_t n)
+	_ATTRIBUTE ((alias ("__aeabi_memmove")));
diff --git a/newlib/libc/machine/arm/aeabi_memset.c
b/newlib/libc/machine/arm/aeabi_memset.c
new file mode 100644
index 0000000..c4a59f2
--- /dev/null
+++ b/newlib/libc/machine/arm/aeabi_memset.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014 ARM Ltd
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. The name of the company may not be used to endorse or promote
+ *    products derived from this software without specific prior written
+ *    permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR
IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string.h>
+#include <_ansi.h>
+
+/* Support the routine __aeabi_memset like memset, but different
+   argument order and no return value required.  Can't alias
+   to memset because it's not defined in the same translation
+   unit.  */
+void
+__aeabi_memset (void *dest, size_t n, int c)
+{
+  memset (dest, c, n);
+}
+
+/* Support the alias versions of __aeabi_memset which may assume
+   memory alignment.  */
+void
+__aeabi_memset4 (void *dest, size_t n, int c)
+	_ATTRIBUTE ((alias ("__aeabi_memset")));
+void
+__aeabi_memset8 (void *dest, size_t n, int c)
+	_ATTRIBUTE ((alias ("__aeabi_memset")));



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]