[ARM] Reorganize memcpy selection.
Richard Earnshaw
Richard.Earnshaw@foss.arm.com
Fri Nov 6 13:49:00 GMT 2015
On 06/11/15 13:37, Marcus Shawcroft wrote:
> On 06/11/15 13:29, Marcus Shawcroft wrote:
>> On 05/11/15 11:32, Richard Earnshaw wrote:
>>> On 05/11/15 09:55, Marcus Shawcroft wrote:
>>
>>>> 2015-11-05 Marcus Shawcroft <marcus.shawcroft@arm.com>
>>>>
>>>> * libc/machine/arm/Makefile.am: Drop MEMCPY_SRC and MEMCPY_OBJ.
>>>> * libc/machine/arm/Makefile.in: Regenerate.
>>>> * libc/machine/arm/memcpy-stub.c: New.
>>>> * libc/machine/arm/memcpy.c: Adjust copyright year. Adjust
>>>> comments.
>>
>>
>>>> +#if (defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED))
>>>> +# include "../../string/memcpy.c"
>>>> +#elif (__ARM_ARCH >= 7 && __ARM_ARCH_PROFILE == 'A' \
>>>> + && defined (__ARM_FEATURE_UNALIGNED))
>>>
>>> You should include acle-compat.h before testing ACLE macros, so that
>>> this will work with older GCC.
>>
>> Done.
>>
>>>> +/* Defined in memcpy.S. */
>>>> +#elif defined (__ARM_ARCH_7M__) || defined (__ARM_ARCH_7EM__)
>>>
>>> Ideally these should also be replaced with ACLE style tests.
>>
>> OK, you are tugging on a long bit of thread here... I've modified this
>> one, please eyeball my replacement before I commit it.
>>
>> This spin of the patch also drops the now disused configure.in tests.
>>
>>>
>>> OK with those changes.
>>
>> Please check my armv7[e]m change looks sane before I commit it...
>>
>> Cheers
>> /Marcus
>>
>
> Sorry, wrong patch, try this one.
>
> /M
>
>
> 0001-ARM-Reorganize-memcpy-selection.patch
>
>
> From 40fad432980ecab06d6ceb0e3a43fe1f08229fac Mon Sep 17 00:00:00 2001
> From: Marcus Shawcroft <marcus.shawcroft@arm.com>
> Date: Fri, 30 Oct 2015 15:14:53 +0000
> Subject: [PATCH 1/4] [ARM] Reorganize memcpy selection.
>
> This patch cleans up the auto configury mechanism used to select
> different implementations of memcpy for various architecture versions.
>
> The approach here is to remove the selection of memcpy within automake
> and instead use complimentary logic in memcpy-stub.c and memcpy.S to
> choose between the generic memcpy.c implemenation or one of the
> architecture specific memcpy*.S implemenations.
>
> Regressed for armv7-a armv5 armv8-a, correct selection of memcpy
> implementation by manual inspection of a test program built for these
> three architectures.
>
> This revised patch flips the remaining preprocessor logic in
> memcpy-stub.c to use ACLE defines as requested in the previous review
> and removes the now disused HAVE_ARMV7A and HAVE_ARMV8A configure.in
> support.
>
> OK?
> ---
> newlib/ChangeLog | 11 +++
> newlib/libc/machine/arm/Makefile.am | 32 ++------
> newlib/libc/machine/arm/Makefile.in | 62 ++++++---------
> newlib/libc/machine/arm/configure | 144 ----------------------------------
> newlib/libc/machine/arm/configure.in | 75 ------------------
> newlib/libc/machine/arm/memcpy-stub.c | 41 ++++++++++
> newlib/libc/machine/arm/memcpy.S | 21 ++---
> 7 files changed, 91 insertions(+), 295 deletions(-)
> create mode 100644 newlib/libc/machine/arm/memcpy-stub.c
>
> diff --git a/newlib/ChangeLog b/newlib/ChangeLog
> index 3dec6e2..a1eedc4 100644
> --- a/newlib/ChangeLog
> +++ b/newlib/ChangeLog
> @@ -1,3 +1,14 @@
> +2015-11-05 Marcus Shawcroft <marcus.shawcroft@arm.com>
> +
> + * libc/machine/arm/Makefile.am: Drop MEMCPY_SRC and MEMCPY_OBJ.
> + * libc/machine/arm/Makefile.in: Regenerate.
> + * libc/machine/arm/configure.in: Remove HAVE_ARMV8A, HAVE_ARMV7A and
> + HAVE_ARM7M.
> + * libc/machine/arm/configure: Regenerate.
> + * libc/machine/arm/memcpy-stub.c: New.
> + * libc/machine/arm/memcpy.c: Adjust copyright year. Adjust comments.
> + Include acle-compat.h.
> +
> 2015-11-03 Marcus Shawcroft <marcus.shawcroft@arm.com>
>
> * libc/machine/arm/configure.in: Check for __ARM_ARCH_8A__.
> diff --git a/newlib/libc/machine/arm/Makefile.am b/newlib/libc/machine/arm/Makefile.am
> index 0eb1cf1..70afdf1 100644
> --- a/newlib/libc/machine/arm/Makefile.am
> +++ b/newlib/libc/machine/arm/Makefile.am
> @@ -29,39 +29,19 @@ MEMCHR_SRC=
> MEMCHR_OBJ=
> endif
>
> -if OPT_SIZE
> -MEMCPY_SRC=
> -MEMCPY_OBJ=
> -else
> -if HAVE_ARMV8A
> -MEMCPY_SRC=memcpy.S
> -MEMCPY_OBJ=$(lpfx)memcpy.o
> -else
> -if HAVE_ARMV7A
> -MEMCPY_SRC=memcpy.S
> -MEMCPY_OBJ=$(lpfx)memcpy.o
> -else
> -if HAVE_ARMV7M
> -MEMCPY_SRC=memcpy.S
> -MEMCPY_OBJ=$(lpfx)memcpy.o
> -else
> -MEMCPY_SRC=
> -MEMCPY_OBJ=
> -endif !HAVE_ARMV7M
> -endif !HAVE_ARMV7A
> -endif !HAVE_ARMV8A
> -endif !OPT_SIZE
> -
> lib_a_SOURCES = setjmp.S access.c strcmp.S strcpy.c \
> - $(MEMCPY_SRC) $(MEMCHR_SRC) $(STRLEN_SRC) \
> + $(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 += 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) $(MEMCPY_OBJ)
> -lib_a_DEPENDENCIES = $(STRLEN_OBJ) $(MEMCHR_OBJ) $(MEMCPY_OBJ)
> +lib_a_LIBADD = $(STRLEN_OBJ) $(MEMCHR_OBJ)
> +
> +lib_a_DEPENDENCIES = $(STRLEN_OBJ) $(MEMCHR_OBJ)
>
> ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
> CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
> diff --git a/newlib/libc/machine/arm/Makefile.in b/newlib/libc/machine/arm/Makefile.in
> index 81dea30..8b69c12 100644
> --- a/newlib/libc/machine/arm/Makefile.in
> +++ b/newlib/libc/machine/arm/Makefile.in
> @@ -71,27 +71,20 @@ 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_ARMV7A_FALSE@@HAVE_ARMV7M_TRUE@@HAVE_ARMV8A_FALSE@@OPT_SIZE_FALSE@am__DEPENDENCIES_3 = $(lpfx)memcpy.o
> -@HAVE_ARMV7A_TRUE@@HAVE_ARMV8A_FALSE@@OPT_SIZE_FALSE@am__DEPENDENCIES_3 = $(lpfx)memcpy.o
> -@HAVE_ARMV8A_TRUE@@OPT_SIZE_FALSE@am__DEPENDENCIES_3 = \
> -@HAVE_ARMV8A_TRUE@@OPT_SIZE_FALSE@ $(lpfx)memcpy.o
> -@HAVE_ARMV7A_FALSE@@HAVE_ARMV7M_TRUE@@HAVE_ARMV8A_FALSE@@OPT_SIZE_FALSE@am__objects_1 = lib_a-memcpy.$(OBJEXT)
> -@HAVE_ARMV7A_TRUE@@HAVE_ARMV8A_FALSE@@OPT_SIZE_FALSE@am__objects_1 = lib_a-memcpy.$(OBJEXT)
> -@HAVE_ARMV8A_TRUE@@OPT_SIZE_FALSE@am__objects_1 = \
> -@HAVE_ARMV8A_TRUE@@OPT_SIZE_FALSE@ lib_a-memcpy.$(OBJEXT)
> -@HAVE_ARMV7_TRUE@am__objects_2 = lib_a-memchr.$(OBJEXT)
> -@HAVE_THUMB1_FALSE@am__objects_3 = lib_a-strlen.$(OBJEXT)
> -@HAVE_THUMB1_TRUE@@OPT_SIZE_TRUE@am__objects_3 = \
> +@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_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) $(am__objects_3) lib_a-strlen-armv7.$(OBJEXT) \
> + $(am__objects_2) 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-aeabi_memclr.$(OBJEXT) lib_a-memcpy-stub.$(OBJEXT) \
> + lib_a-memcpy.$(OBJEXT)
> lib_a_OBJECTS = $(am_lib_a_OBJECTS)
> DEFAULT_INCLUDES = -I.@am__isrc@
> depcomp =
> @@ -228,26 +221,15 @@ noinst_LIBRARIES = lib.a
> @HAVE_ARMV7_TRUE@MEMCHR_SRC = memchr.S
> @HAVE_ARMV7_FALSE@MEMCHR_OBJ =
> @HAVE_ARMV7_TRUE@MEMCHR_OBJ = $(lpfx)memchr.o
> -@HAVE_ARMV7A_FALSE@@HAVE_ARMV7M_FALSE@@HAVE_ARMV8A_FALSE@@OPT_SIZE_FALSE@MEMCPY_SRC =
> -@HAVE_ARMV7A_FALSE@@HAVE_ARMV7M_TRUE@@HAVE_ARMV8A_FALSE@@OPT_SIZE_FALSE@MEMCPY_SRC = memcpy.S
> -@HAVE_ARMV7A_TRUE@@HAVE_ARMV8A_FALSE@@OPT_SIZE_FALSE@MEMCPY_SRC = memcpy.S
> -@HAVE_ARMV8A_TRUE@@OPT_SIZE_FALSE@MEMCPY_SRC = memcpy.S
> -@OPT_SIZE_TRUE@MEMCPY_SRC =
> -@HAVE_ARMV7A_FALSE@@HAVE_ARMV7M_FALSE@@HAVE_ARMV8A_FALSE@@OPT_SIZE_FALSE@MEMCPY_OBJ =
> -@HAVE_ARMV7A_FALSE@@HAVE_ARMV7M_TRUE@@HAVE_ARMV8A_FALSE@@OPT_SIZE_FALSE@MEMCPY_OBJ = $(lpfx)memcpy.o
> -@HAVE_ARMV7A_TRUE@@HAVE_ARMV8A_FALSE@@OPT_SIZE_FALSE@MEMCPY_OBJ = $(lpfx)memcpy.o
> -@HAVE_ARMV8A_TRUE@@OPT_SIZE_FALSE@MEMCPY_OBJ = $(lpfx)memcpy.o
> -@OPT_SIZE_TRUE@MEMCPY_OBJ =
> -lib_a_SOURCES = setjmp.S access.c strcmp.S strcpy.c \
> - $(MEMCPY_SRC) $(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 $(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 \
> + memcpy-stub.c memcpy.S
> lib_a_CCASFLAGS = $(AM_CCASFLAGS)
> lib_a_CFLAGS = $(AM_CFLAGS)
> -lib_a_LIBADD = $(STRLEN_OBJ) $(MEMCHR_OBJ) $(MEMCPY_OBJ)
> -lib_a_DEPENDENCIES = $(STRLEN_OBJ) $(MEMCHR_OBJ) $(MEMCPY_OBJ)
> +lib_a_LIBADD = $(STRLEN_OBJ) $(MEMCHR_OBJ)
> +lib_a_DEPENDENCIES = $(STRLEN_OBJ) $(MEMCHR_OBJ)
> ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
> CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
> MEMCPY_DEP = memcpy-armv7a.S memcpy-armv7m.S
> @@ -330,12 +312,6 @@ lib_a-strcmp.o: strcmp.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-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-memcpy.obj: memcpy.S
> - $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memcpy.obj `if test -f 'memcpy.S'; then $(CYGPATH_W) 'memcpy.S'; else $(CYGPATH_W) '$(srcdir)/memcpy.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
>
> @@ -366,6 +342,12 @@ lib_a-aeabi_memset-soft.o: aeabi_memset-soft.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-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-memcpy.obj: memcpy.S
> + $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-memcpy.obj `if test -f 'memcpy.S'; then $(CYGPATH_W) 'memcpy.S'; else $(CYGPATH_W) '$(srcdir)/memcpy.S'; fi`
> +
> .c.o:
> $(COMPILE) -c $<
>
> @@ -414,6 +396,12 @@ lib_a-aeabi_memclr.o: 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-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
> +
> +lib_a-memcpy-stub.obj: memcpy-stub.c
> + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memcpy-stub.obj `if test -f 'memcpy-stub.c'; then $(CYGPATH_W) 'memcpy-stub.c'; else $(CYGPATH_W) '$(srcdir)/memcpy-stub.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/configure b/newlib/libc/machine/arm/configure
> index 9f82c7f..eb62361 100755
> --- a/newlib/libc/machine/arm/configure
> +++ b/newlib/libc/machine/arm/configure
> @@ -565,12 +565,6 @@ ac_unique_file="Makefile.am"
> ac_subst_vars='LTLIBOBJS
> LIBOBJS
> CFLAGS
> -HAVE_ARMV7M_FALSE
> -HAVE_ARMV7M_TRUE
> -HAVE_ARMV8A_FALSE
> -HAVE_ARMV8A_TRUE
> -HAVE_ARMV7A_FALSE
> -HAVE_ARMV7A_TRUE
> HAVE_ARMV7_FALSE
> HAVE_ARMV7_TRUE
> OPT_SIZE_FALSE
> @@ -3549,132 +3543,6 @@ else
> fi
>
>
> -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether armv7a processor is supported" >&5
> -$as_echo_n "checking whether armv7a processor is supported... " >&6; }
> -if ${acnewlib_cv_armv7a_processor+:} false; then :
> - $as_echo_n "(cached) " >&6
> -else
> - cat > conftest.c <<EOF
> -
> -#if defined (__ARM_ARCH_7A__) && defined (__ARM_FEATURE_UNALIGNED)
> - #define HAVE_ARMV7A
> - #else
> - #error "ARMV7A 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_armv7a_processor=yes;
> -else
> - acnewlib_cv_armv7a_processor=no;
> -fi
> -rm -f conftest*
> -fi
> -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acnewlib_cv_armv7a_processor" >&5
> -$as_echo "$acnewlib_cv_armv7a_processor" >&6; }
> -
> - if test x"$acnewlib_cv_armv7a_processor" = x"yes"; then
> - HAVE_ARMV7A_TRUE=
> - HAVE_ARMV7A_FALSE='#'
> -else
> - HAVE_ARMV7A_TRUE='#'
> - HAVE_ARMV7A_FALSE=
> -fi
> -
> -
> -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether armv8a processor is supported" >&5
> -$as_echo_n "checking whether armv8a processor is supported... " >&6; }
> -if ${acnewlib_cv_armv8a_processor+:} false; then :
> - $as_echo_n "(cached) " >&6
> -else
> - cat > conftest.c <<EOF
> -
> -#if defined (__ARM_ARCH_8A__) && defined (__ARM_FEATURE_UNALIGNED)
> - #define HAVE_ARMV8A
> - #else
> - #error "ARMV8A 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_armv8a_processor=yes;
> -else
> - acnewlib_cv_armv8a_processor=no;
> -fi
> -rm -f conftest*
> -fi
> -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acnewlib_cv_armv8a_processor" >&5
> -$as_echo "$acnewlib_cv_armv8a_processor" >&6; }
> -
> - if test x"$acnewlib_cv_armv8a_processor" = x"yes"; then
> - HAVE_ARMV8A_TRUE=
> - HAVE_ARMV8A_FALSE='#'
> -else
> - HAVE_ARMV8A_TRUE='#'
> - HAVE_ARMV8A_FALSE=
> -fi
> -
> -
> -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether armv7m processor is supported" >&5
> -$as_echo_n "checking whether armv7m processor is supported... " >&6; }
> -if ${acnewlib_cv_armv7m_processor+:} false; then :
> - $as_echo_n "(cached) " >&6
> -else
> - cat > conftest.c <<EOF
> -
> -#if defined (__ARM_ARCH_7M__) || defined (__ARM_ARCH_7EM__)
> - #define HAVE_ARMV7M
> - #else
> - #error "ARMV7M 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_armv7m_processor=yes;
> -else
> - acnewlib_cv_armv7m_processor=no;
> -fi
> -rm -f conftest*
> -fi
> -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acnewlib_cv_armv7m_processor" >&5
> -$as_echo "$acnewlib_cv_armv7m_processor" >&6; }
> -
> - if test x"$acnewlib_cv_armv7m_processor" = x"yes"; then
> - HAVE_ARMV7M_TRUE=
> - HAVE_ARMV7M_FALSE='#'
> -else
> - HAVE_ARMV7M_TRUE='#'
> - HAVE_ARMV7M_FALSE=
> -fi
> -
> -
>
>
> ac_config_files="$ac_config_files Makefile"
> @@ -3877,18 +3745,6 @@ 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
> -if test -z "${HAVE_ARMV7A_TRUE}" && test -z "${HAVE_ARMV7A_FALSE}"; then
> - as_fn_error $? "conditional \"HAVE_ARMV7A\" was never defined.
> -Usually this means the macro was only invoked conditionally." "$LINENO" 5
> -fi
> -if test -z "${HAVE_ARMV8A_TRUE}" && test -z "${HAVE_ARMV8A_FALSE}"; then
> - as_fn_error $? "conditional \"HAVE_ARMV8A\" was never defined.
> -Usually this means the macro was only invoked conditionally." "$LINENO" 5
> -fi
> -if test -z "${HAVE_ARMV7M_TRUE}" && test -z "${HAVE_ARMV7M_FALSE}"; then
> - as_fn_error $? "conditional \"HAVE_ARMV7M\" was never defined.
> -Usually this means the macro was only invoked conditionally." "$LINENO" 5
> -fi
>
> : "${CONFIG_STATUS=./config.status}"
> ac_write_fail=0
> diff --git a/newlib/libc/machine/arm/configure.in b/newlib/libc/machine/arm/configure.in
> index 69fbe2b..b76f731 100644
> --- a/newlib/libc/machine/arm/configure.in
> +++ b/newlib/libc/machine/arm/configure.in
> @@ -86,81 +86,6 @@ rm -f conftest*])
>
> AM_CONDITIONAL(HAVE_ARMV7, test x"$acnewlib_cv_armv7_processor" = x"yes")
>
> -dnl Check for whether ARM_ARCH_7A is defined.
> -AC_CACHE_CHECK(whether armv7a processor is supported,
> - acnewlib_cv_armv7a_processor, [dnl
> -cat > conftest.c <<EOF
> -
> -#if defined (__ARM_ARCH_7A__) && defined (__ARM_FEATURE_UNALIGNED)
> - #define HAVE_ARMV7A
> - #else
> - #error "ARMV7A 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_armv7a_processor=yes;
> -else
> - acnewlib_cv_armv7a_processor=no;
> -fi
> -rm -f conftest*])
> -
> -AM_CONDITIONAL(HAVE_ARMV7A, test x"$acnewlib_cv_armv7a_processor" = x"yes")
> -
> -dnl Check for whether ARM_ARCH_8A is defined.
> -AC_CACHE_CHECK(whether armv8a processor is supported,
> - acnewlib_cv_armv8a_processor, [dnl
> -cat > conftest.c <<EOF
> -
> -#if defined (__ARM_ARCH_8A__) && defined (__ARM_FEATURE_UNALIGNED)
> - #define HAVE_ARMV8A
> - #else
> - #error "ARMV8A 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_armv8a_processor=yes;
> -else
> - acnewlib_cv_armv8a_processor=no;
> -fi
> -rm -f conftest*])
> -
> -AM_CONDITIONAL(HAVE_ARMV8A, test x"$acnewlib_cv_armv8a_processor" = x"yes")
> -
> -dnl Check for whether ARM_ARCH_7M is defined.
> -AC_CACHE_CHECK(whether armv7m processor is supported,
> - acnewlib_cv_armv7m_processor, [dnl
> -cat > conftest.c <<EOF
> -
> -#if defined (__ARM_ARCH_7M__) || defined (__ARM_ARCH_7EM__)
> - #define HAVE_ARMV7M
> - #else
> - #error "ARMV7M 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_armv7m_processor=yes;
> -else
> - acnewlib_cv_armv7m_processor=no;
> -fi
> -rm -f conftest*])
> -
> -AM_CONDITIONAL(HAVE_ARMV7M, test x"$acnewlib_cv_armv7m_processor" = x"yes")
> -
> AC_SUBST(CFLAGS)
>
> AC_CONFIG_FILES([Makefile])
> diff --git a/newlib/libc/machine/arm/memcpy-stub.c b/newlib/libc/machine/arm/memcpy-stub.c
> new file mode 100644
> index 0000000..52a0f91
> --- /dev/null
> +++ b/newlib/libc/machine/arm/memcpy-stub.c
> @@ -0,0 +1,41 @@
> +/* 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 memcpy.S. */
> +
> +#include "acle-compat.h"
> +
> +#if (defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED))
> +# include "../../string/memcpy.c"
> +#elif (__ARM_ARCH >= 7 && __ARM_ARCH_PROFILE == 'A' \
> + && defined (__ARM_FEATURE_UNALIGNED))
> +/* Defined in memcpy.S. */
> +#elif __ARM_ARCH >= 7 && __ARM_ARCH_PROFILE == 'M'
> +/* Defined in memcpy.S. */
> +#else
> +# include "../../string/memcpy.c"
> +#endif
> diff --git a/newlib/libc/machine/arm/memcpy.S b/newlib/libc/machine/arm/memcpy.S
> index b1bab88..d3f1dc1 100644
> --- a/newlib/libc/machine/arm/memcpy.S
> +++ b/newlib/libc/machine/arm/memcpy.S
> @@ -26,19 +26,13 @@
> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> */
>
> -#if defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED)
> - /* Leave this field blank. So the memcpy() is not defined, and this will
> - automatically pull in the default C definition of memcpy() from
> - ../../string/memcpy.c. No need to include this file explicitely.
> - The lib_a-memcpy.o will not be generated, so it won't replace the default
> - lib_a-memcpy.o which is generated by ../../string/memcpy.c.
> - See the commands in configure.in and Makefile.am for more details.
> +/* The structure of the following #if #else #endif conditional chain
> + must match the chain in memcpy-stub.c. */
> +
> +#include "acle-compat.h"
>
> - 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-memcpy.o to be generated.
> - */
> +#if defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED)
> + /* Defined in memcpy-stub.c. */
>
> #elif (__ARM_ARCH >= 7 && __ARM_ARCH_PROFILE == 'A' \
> && defined (__ARM_FEATURE_UNALIGNED))
> @@ -48,5 +42,6 @@
> #include "memcpy-armv7m.S"
There's a test immediately before this line that needs to match the
#elif __ARM_ARCH >= 7 && __ARM_ARCH_PROFILE == 'M'
line in memcpy-stub.c, it's still in the old format.
OK with that change.
R.
>
> #else
> - /* Leave this filed blank. See the commands above. */
> + /* Defined in memcpy-stub.c. */
> +
> #endif
>
More information about the Newlib
mailing list