+2015-11-06 Marcus Shawcroft <marcus.shawcroft@arm.com>
+
+ * libc/machine/arm/Makefile.am: Drop MEMCHR_SRC and MEMCHR_OBJ.
+ * libc/machine/arm/Makefile.in: Regenerate.
+ * libc/machine/arm/memchr-stub.c: New.
+ * libc/machine/arm/memchr.S: Adjust comments. Include memchr.c and
+ acle-compat.h. Make .arch directive architecture dependent.
+ * libc/machine/arm/configure.in (HAVE_ARMV7): Remove.
+ * libc/machine/arm/configure: Regenerate.
+
2015-11-06 Marcus Shawcroft <marcus.shawcroft@arm.com>
* libc/machine/arm/Makefile.am: Drop MEMCPY_SRC and MEMCPY_OBJ.
STRLEN_OBJ=$(lpfx)strlen.o
endif
-if HAVE_ARMV7
-MEMCHR_SRC=memchr.S
-MEMCHR_OBJ=$(lpfx)memchr.o
-else
-MEMCHR_SRC=
-MEMCHR_OBJ=
-endif
-
lib_a_SOURCES = setjmp.S access.c strcmp.S strcpy.c \
- $(MEMCHR_SRC) $(STRLEN_SRC) \
+ $(STRLEN_SRC) \
strlen-armv7.S aeabi_memcpy.c aeabi_memcpy-armv7a.S \
aeabi_memmove.c aeabi_memmove-soft.S \
aeabi_memset.c aeabi_memset-soft.S aeabi_memclr.c
+lib_a_SOURCES += memchr-stub.c
+lib_a_SOURCES += memchr.S
lib_a_SOURCES += memcpy-stub.c
lib_a_SOURCES += memcpy.S
lib_a_CCASFLAGS=$(AM_CCASFLAGS)
lib_a_CFLAGS = $(AM_CFLAGS)
-lib_a_LIBADD = $(STRLEN_OBJ) $(MEMCHR_OBJ)
+lib_a_LIBADD = $(STRLEN_OBJ)
-lib_a_DEPENDENCIES = $(STRLEN_OBJ) $(MEMCHR_OBJ)
+lib_a_DEPENDENCIES = $(STRLEN_OBJ)
ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
+MEMCHR_DEP=acle-compat.h arm_asm.h
MEMCPY_DEP=memcpy-armv7a.S memcpy-armv7m.S
STRCMP_DEP=strcmp-arm-tiny.S strcmp-armv4.S strcmp-armv4t.S strcmp-armv6.S \
strcmp-armv6m.S strcmp-armv7.S strcmp-armv7m.S
AEABI_MEMSET_DEP=aeabi_memset-thumb.S aeabi_memset-thumb2.S \
aeabi_memset-arm.S
+$(lpfx)memchr.o: $(MEMCHR_DEP)
+$(lpfx)memchr.obj: $(MEMCHR_DEP)
+
$(lpfx)memcpy.o: $(MEMCPY_DEP)
$(lpfx)memcpy.obj: $(MEMCPY_DEP)
lib_a_AR = $(AR) $(ARFLAGS)
@HAVE_THUMB1_FALSE@am__DEPENDENCIES_1 = $(lpfx)strlen.o
@HAVE_THUMB1_TRUE@@OPT_SIZE_TRUE@am__DEPENDENCIES_1 = $(lpfx)strlen.o
-@HAVE_ARMV7_TRUE@am__DEPENDENCIES_2 = $(lpfx)memchr.o
-@HAVE_ARMV7_TRUE@am__objects_1 = lib_a-memchr.$(OBJEXT)
-@HAVE_THUMB1_FALSE@am__objects_2 = lib_a-strlen.$(OBJEXT)
-@HAVE_THUMB1_TRUE@@OPT_SIZE_TRUE@am__objects_2 = \
+@HAVE_THUMB1_FALSE@am__objects_1 = lib_a-strlen.$(OBJEXT)
+@HAVE_THUMB1_TRUE@@OPT_SIZE_TRUE@am__objects_1 = \
@HAVE_THUMB1_TRUE@@OPT_SIZE_TRUE@ lib_a-strlen.$(OBJEXT)
am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT) lib_a-access.$(OBJEXT) \
lib_a-strcmp.$(OBJEXT) lib_a-strcpy.$(OBJEXT) $(am__objects_1) \
- $(am__objects_2) lib_a-strlen-armv7.$(OBJEXT) \
- lib_a-aeabi_memcpy.$(OBJEXT) \
+ lib_a-strlen-armv7.$(OBJEXT) lib_a-aeabi_memcpy.$(OBJEXT) \
lib_a-aeabi_memcpy-armv7a.$(OBJEXT) \
lib_a-aeabi_memmove.$(OBJEXT) \
lib_a-aeabi_memmove-soft.$(OBJEXT) \
lib_a-aeabi_memset.$(OBJEXT) lib_a-aeabi_memset-soft.$(OBJEXT) \
- lib_a-aeabi_memclr.$(OBJEXT) lib_a-memcpy-stub.$(OBJEXT) \
+ lib_a-aeabi_memclr.$(OBJEXT) lib_a-memchr-stub.$(OBJEXT) \
+ lib_a-memchr.$(OBJEXT) lib_a-memcpy-stub.$(OBJEXT) \
lib_a-memcpy.$(OBJEXT)
lib_a_OBJECTS = $(am_lib_a_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@
@HAVE_THUMB1_FALSE@STRLEN_OBJ = $(lpfx)strlen.o
@HAVE_THUMB1_TRUE@@OPT_SIZE_FALSE@STRLEN_OBJ =
@HAVE_THUMB1_TRUE@@OPT_SIZE_TRUE@STRLEN_OBJ = $(lpfx)strlen.o
-@HAVE_ARMV7_FALSE@MEMCHR_SRC =
-@HAVE_ARMV7_TRUE@MEMCHR_SRC = memchr.S
-@HAVE_ARMV7_FALSE@MEMCHR_OBJ =
-@HAVE_ARMV7_TRUE@MEMCHR_OBJ = $(lpfx)memchr.o
-lib_a_SOURCES = setjmp.S access.c strcmp.S strcpy.c $(MEMCHR_SRC) \
- $(STRLEN_SRC) strlen-armv7.S aeabi_memcpy.c \
- aeabi_memcpy-armv7a.S aeabi_memmove.c aeabi_memmove-soft.S \
- aeabi_memset.c aeabi_memset-soft.S aeabi_memclr.c \
+lib_a_SOURCES = setjmp.S access.c strcmp.S strcpy.c $(STRLEN_SRC) \
+ strlen-armv7.S aeabi_memcpy.c aeabi_memcpy-armv7a.S \
+ aeabi_memmove.c aeabi_memmove-soft.S aeabi_memset.c \
+ aeabi_memset-soft.S aeabi_memclr.c memchr-stub.c memchr.S \
memcpy-stub.c memcpy.S
lib_a_CCASFLAGS = $(AM_CCASFLAGS)
lib_a_CFLAGS = $(AM_CFLAGS)
-lib_a_LIBADD = $(STRLEN_OBJ) $(MEMCHR_OBJ)
-lib_a_DEPENDENCIES = $(STRLEN_OBJ) $(MEMCHR_OBJ)
+lib_a_LIBADD = $(STRLEN_OBJ)
+lib_a_DEPENDENCIES = $(STRLEN_OBJ)
ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
+MEMCHR_DEP = acle-compat.h arm_asm.h
MEMCPY_DEP = memcpy-armv7a.S memcpy-armv7m.S
STRCMP_DEP = strcmp-arm-tiny.S strcmp-armv4.S strcmp-armv4t.S strcmp-armv6.S \
strcmp-armv6m.S strcmp-armv7.S strcmp-armv7m.S
lib_a-strcmp.obj: strcmp.S
$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strcmp.obj `if test -f 'strcmp.S'; then $(CYGPATH_W) 'strcmp.S'; else $(CYGPATH_W) '$(srcdir)/strcmp.S'; fi`
-lib_a-memchr.o: memchr.S
- $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memchr.o `test -f 'memchr.S' || echo '$(srcdir)/'`memchr.S
-
-lib_a-memchr.obj: memchr.S
- $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memchr.obj `if test -f 'memchr.S'; then $(CYGPATH_W) 'memchr.S'; else $(CYGPATH_W) '$(srcdir)/memchr.S'; fi`
-
lib_a-strlen-armv7.o: strlen-armv7.S
$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-strlen-armv7.o `test -f 'strlen-armv7.S' || echo '$(srcdir)/'`strlen-armv7.S
lib_a-aeabi_memset-soft.obj: aeabi_memset-soft.S
$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-aeabi_memset-soft.obj `if test -f 'aeabi_memset-soft.S'; then $(CYGPATH_W) 'aeabi_memset-soft.S'; else $(CYGPATH_W) '$(srcdir)/aeabi_memset-soft.S'; fi`
+lib_a-memchr.o: memchr.S
+ $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memchr.o `test -f 'memchr.S' || echo '$(srcdir)/'`memchr.S
+
+lib_a-memchr.obj: memchr.S
+ $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memchr.obj `if test -f 'memchr.S'; then $(CYGPATH_W) 'memchr.S'; else $(CYGPATH_W) '$(srcdir)/memchr.S'; fi`
+
lib_a-memcpy.o: memcpy.S
$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memcpy.o `test -f 'memcpy.S' || echo '$(srcdir)/'`memcpy.S
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-memchr-stub.o: memchr-stub.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memchr-stub.o `test -f 'memchr-stub.c' || echo '$(srcdir)/'`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-memcpy-stub.o: memcpy-stub.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memcpy-stub.o `test -f 'memcpy-stub.c' || echo '$(srcdir)/'`memcpy-stub.c
uninstall-am
+$(lpfx)memchr.o: $(MEMCHR_DEP)
+$(lpfx)memchr.obj: $(MEMCHR_DEP)
+
$(lpfx)memcpy.o: $(MEMCPY_DEP)
$(lpfx)memcpy.obj: $(MEMCPY_DEP)
ac_subst_vars='LTLIBOBJS
LIBOBJS
CFLAGS
-HAVE_ARMV7_FALSE
-HAVE_ARMV7_TRUE
OPT_SIZE_FALSE
OPT_SIZE_TRUE
HAVE_THUMB1_FALSE
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether armv7 processor is supported" >&5
-$as_echo_n "checking whether armv7 processor is supported... " >&6; }
-if ${acnewlib_cv_armv7_processor+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat > conftest.c <<EOF
-
-#if defined (_ISA_ARM_7) || defined (__ARM_ARCH_6T2__)
- #define HAVE_ARMV7
- #else
- #error "ARMV7 is not supported."
-#endif
-int main () {
- return 0;
-}
-EOF
-if { ac_try='${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c
- 1>&5'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }
-then
- acnewlib_cv_armv7_processor=yes;
-else
- acnewlib_cv_armv7_processor=no;
-fi
-rm -f conftest*
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acnewlib_cv_armv7_processor" >&5
-$as_echo "$acnewlib_cv_armv7_processor" >&6; }
-
- if test x"$acnewlib_cv_armv7_processor" = x"yes"; then
- HAVE_ARMV7_TRUE=
- HAVE_ARMV7_FALSE='#'
-else
- HAVE_ARMV7_TRUE='#'
- HAVE_ARMV7_FALSE=
-fi
-
-
ac_config_files="$ac_config_files Makefile"
as_fn_error $? "conditional \"OPT_SIZE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
-if test -z "${HAVE_ARMV7_TRUE}" && test -z "${HAVE_ARMV7_FALSE}"; then
- as_fn_error $? "conditional \"HAVE_ARMV7\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
AM_CONDITIONAL(OPT_SIZE, test x"$acnewlib_cv_opt_size" = x"yes")
-dnl Check for whether ARM_7 or ARM_ARCH_6T2 is defined.
-dnl This macro is used to support memchr() for old CPU.
-AC_CACHE_CHECK(whether armv7 processor is supported,
- acnewlib_cv_armv7_processor, [dnl
-cat > conftest.c <<EOF
-
-#if defined (_ISA_ARM_7) || defined (__ARM_ARCH_6T2__)
- #define HAVE_ARMV7
- #else
- #error "ARMV7 is not supported."
-#endif
-int main () {
- return 0;
-}
-EOF
-if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c
- 1>&AS_MESSAGE_LOG_FD])
-then
- acnewlib_cv_armv7_processor=yes;
-else
- acnewlib_cv_armv7_processor=no;
-fi
-rm -f conftest*])
-
-AM_CONDITIONAL(HAVE_ARMV7, test x"$acnewlib_cv_armv7_processor" = x"yes")
-
AC_SUBST(CFLAGS)
AC_CONFIG_FILES([Makefile])
--- /dev/null
+/* Copyright (c) 2015 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:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * 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.
+ * Neither the name of the Linaro nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "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 THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS 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. */
+
+/* The structure of the following #if #else #endif conditional chain
+ must match the chain in memchr.S. */
+
+#include "acle-compat.h"
+
+#if __ARM_ARCH_ISA_THUMB >= 2 && defined (__ARM_FEATURE_DSP)
+/* Defined in memchr.S. */
+#else
+# include "../../string/memchr.c"
+#endif
an optimised path for large data sets; the worst case is finding the
match early in a large data set. */
+/* Copyright (c) 2015 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:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * 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.
+ * Neither the name of the Linaro nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "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 THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS 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. */
+
@ 2011-02-07 david.gilbert@linaro.org
@ Extracted from local git a5b438d861
@ 2011-07-14 david.gilbert@linaro.org
@ This code requires armv6t2 or later. Uses Thumb2.
.syntax unified
- .arch armv6t2
+#include "acle-compat.h"
#include "arm_asm.h"
@ NOTE: This ifdef MUST match the one in memchr-stub.c
-#if defined(_ISA_ARM_7) || defined(__ARM_ARCH_6T2__)
+#if __ARM_ARCH_ISA_THUMB >= 2 && defined (__ARM_FEATURE_DSP)
+
+#if __ARM_ARCH_PROFILE == 'M'
+ .arch armv7e-m
+#else
+ .arch armv6t2
+#endif
@ this lets us check a flag in a 00/ff byte easily in either endianness
#ifdef __ARMEB__
subs r0,r0,#1
bx lr
#else
- /* For an older CPU we just fall back to the .c code. */
-
- /* Leave this field blank. So the memchr() is not defined, and this will
- automatically pull in the default C definition of memchr() from
- ../../string/memchr.c. No need to include this file explicitely.
- The lib_a-memchr.o will not be generated, so it won't replace the
- default lib_a-memchr.o which is generated by ../../string/memchr.c.
- See the commands in configure.in and Makefile.am for more details.
-
- However, if we need to rewrite this function to be more efficient, we
- can add the corresponding assembly code into this field and change the
- commands in configure.in and Makefile.am to allow the corresponding
- lib_a-memchr.o to be generated.
- */
+ /* Defined in memchr-stub.c. */
#endif