[ARM] Reorganize strlen selection.

Remove automake and autoconf selection of strchr implementation in
favour of conditional compilation in strlen.c.
This commit is contained in:
Marcus Shawcroft 2015-11-09 23:25:36 +00:00
parent 52f5864096
commit 2c8e31d654
6 changed files with 25 additions and 190 deletions

View File

@ -1,3 +1,12 @@
2015-11-13 Marcus Shawcroft <marcus.shawcroft@arm.com>
* libc/machine/arm/Makefile.am: Drop STRLEN_SRC and STRLEN_OBJ.
Adding strlen.c.
* libc/machine/arm/configure.in (HAVE_THUMB1, OPT_SIZE): Remove.
* libc/machine/arm/strlen.c: Include ../../string/strlen.c.
* libc/machine/arm/configure: Regenerate.
* libc/machine/arm/Makefile.in: Regenerate.
2015-11-13 Marcus Shawcroft <marcus.shawcroft@arm.com>
* libc/machine/arm/strlen.c: Refactor nested #if.

View File

@ -8,21 +8,7 @@ AM_CCASFLAGS = $(INCLUDES)
noinst_LIBRARIES = lib.a
if HAVE_THUMB1
if OPT_SIZE
STRLEN_SRC=strlen.c
STRLEN_OBJ=$(lpfx)strlen.o
else
STRLEN_SRC=
STRLEN_OBJ=
endif
else
STRLEN_SRC=strlen.c
STRLEN_OBJ=$(lpfx)strlen.o
endif
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
@ -30,12 +16,10 @@ lib_a_SOURCES += memchr-stub.c
lib_a_SOURCES += memchr.S
lib_a_SOURCES += memcpy-stub.c
lib_a_SOURCES += memcpy.S
lib_a_SOURCES += strlen.c
lib_a_CCASFLAGS=$(AM_CCASFLAGS)
lib_a_CFLAGS = $(AM_CFLAGS)
lib_a_LIBADD = $(STRLEN_OBJ)
lib_a_DEPENDENCIES = $(STRLEN_OBJ)
ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host

View File

@ -68,13 +68,9 @@ CONFIG_CLEAN_VPATH_FILES =
LIBRARIES = $(noinst_LIBRARIES)
ARFLAGS = cru
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_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)
lib_a_LIBADD =
am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT) lib_a-access.$(OBJEXT) \
lib_a-strcmp.$(OBJEXT) lib_a-strcpy.$(OBJEXT) $(am__objects_1) \
lib_a-strcmp.$(OBJEXT) lib_a-strcpy.$(OBJEXT) \
lib_a-strlen-armv7.$(OBJEXT) lib_a-aeabi_memcpy.$(OBJEXT) \
lib_a-aeabi_memcpy-armv7a.$(OBJEXT) \
lib_a-aeabi_memmove.$(OBJEXT) \
@ -82,7 +78,7 @@ am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT) lib_a-access.$(OBJEXT) \
lib_a-aeabi_memset.$(OBJEXT) lib_a-aeabi_memset-soft.$(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-memcpy.$(OBJEXT) lib_a-strlen.$(OBJEXT)
lib_a_OBJECTS = $(am_lib_a_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp =
@ -209,21 +205,13 @@ AUTOMAKE_OPTIONS = cygnus
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
AM_CCASFLAGS = $(INCLUDES)
noinst_LIBRARIES = lib.a
@HAVE_THUMB1_FALSE@STRLEN_SRC = strlen.c
@HAVE_THUMB1_TRUE@@OPT_SIZE_FALSE@STRLEN_SRC =
@HAVE_THUMB1_TRUE@@OPT_SIZE_TRUE@STRLEN_SRC = strlen.c
@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
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_SOURCES = setjmp.S access.c strcmp.S strcpy.c 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 \
strlen.c
lib_a_CCASFLAGS = $(AM_CCASFLAGS)
lib_a_CFLAGS = $(AM_CFLAGS)
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
@ -361,12 +349,6 @@ lib_a-strcpy.o: strcpy.c
lib_a-strcpy.obj: strcpy.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strcpy.obj `if test -f 'strcpy.c'; then $(CYGPATH_W) 'strcpy.c'; else $(CYGPATH_W) '$(srcdir)/strcpy.c'; fi`
lib_a-strlen.o: strlen.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strlen.o `test -f 'strlen.c' || echo '$(srcdir)/'`strlen.c
lib_a-strlen.obj: strlen.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strlen.obj `if test -f 'strlen.c'; then $(CYGPATH_W) 'strlen.c'; else $(CYGPATH_W) '$(srcdir)/strlen.c'; fi`
lib_a-aeabi_memcpy.o: aeabi_memcpy.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-aeabi_memcpy.o `test -f 'aeabi_memcpy.c' || echo '$(srcdir)/'`aeabi_memcpy.c
@ -403,6 +385,12 @@ lib_a-memcpy-stub.o: 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`
lib_a-strlen.o: strlen.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strlen.o `test -f 'strlen.c' || echo '$(srcdir)/'`strlen.c
lib_a-strlen.obj: strlen.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strlen.obj `if test -f 'strlen.c'; then $(CYGPATH_W) 'strlen.c'; else $(CYGPATH_W) '$(srcdir)/strlen.c'; fi`
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \

View File

@ -565,10 +565,6 @@ ac_unique_file="Makefile.am"
ac_subst_vars='LTLIBOBJS
LIBOBJS
CFLAGS
OPT_SIZE_FALSE
OPT_SIZE_TRUE
HAVE_THUMB1_FALSE
HAVE_THUMB1_TRUE
sys_dir
machine_dir
libm_machine_dir
@ -3415,90 +3411,6 @@ OBJEXT=${oext}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using thumb1" >&5
$as_echo_n "checking whether we are using thumb1... " >&6; }
if ${acnewlib_cv_thumb1_processor+:} false; then :
$as_echo_n "(cached) " >&6
else
cat > conftest.c <<EOF
#if defined (__thumb__) && !defined (__thumb2__)
#define _THUMB1
#else
#error "not thumb1"
#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_thumb1_processor=yes;
else
acnewlib_cv_thumb1_processor=no;
fi
rm -f conftest*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acnewlib_cv_thumb1_processor" >&5
$as_echo "$acnewlib_cv_thumb1_processor" >&6; }
if test x"$acnewlib_cv_thumb1_processor" = x"yes"; then
HAVE_THUMB1_TRUE=
HAVE_THUMB1_FALSE='#'
else
HAVE_THUMB1_TRUE='#'
HAVE_THUMB1_FALSE=
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the size is preferred" >&5
$as_echo_n "checking whether the size is preferred... " >&6; }
if ${acnewlib_cv_opt_size+:} false; then :
$as_echo_n "(cached) " >&6
else
cat > conftest.c <<EOF
#if defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED)
#define OPT_SIZE
#else
#error "not need for size optimization."
#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_opt_size=yes;
else
acnewlib_cv_opt_size=no;
fi
rm -f conftest*
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acnewlib_cv_opt_size" >&5
$as_echo "$acnewlib_cv_opt_size" >&6; }
if test x"$acnewlib_cv_opt_size" = x"yes"; then
OPT_SIZE_TRUE=
OPT_SIZE_FALSE='#'
else
OPT_SIZE_TRUE='#'
OPT_SIZE_FALSE=
fi
ac_config_files="$ac_config_files Makefile"
@ -3689,14 +3601,6 @@ if test -z "${USE_LIBTOOL_TRUE}" && test -z "${USE_LIBTOOL_FALSE}"; then
as_fn_error $? "conditional \"USE_LIBTOOL\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${HAVE_THUMB1_TRUE}" && test -z "${HAVE_THUMB1_FALSE}"; then
as_fn_error $? "conditional \"HAVE_THUMB1\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${OPT_SIZE_TRUE}" && test -z "${OPT_SIZE_FALSE}"; then
as_fn_error $? "conditional \"OPT_SIZE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0

View File

@ -10,56 +10,6 @@ AC_CONFIG_AUX_DIR(../../../..)
NEWLIB_CONFIGURE(../../..)
dnl Check for Thumb1 supported.
AC_CACHE_CHECK(whether we are using thumb1,
acnewlib_cv_thumb1_processor, [dnl
cat > conftest.c <<EOF
#if defined (__thumb__) && !defined (__thumb2__)
#define _THUMB1
#else
#error "not thumb1"
#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_thumb1_processor=yes;
else
acnewlib_cv_thumb1_processor=no;
fi
rm -f conftest*])
AM_CONDITIONAL(HAVE_THUMB1, test x"$acnewlib_cv_thumb1_processor" = x"yes")
dnl Check for whether the size is preferred.
AC_CACHE_CHECK(whether the size is preferred,
acnewlib_cv_opt_size, [dnl
cat > conftest.c <<EOF
#if defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED)
#define OPT_SIZE
#else
#error "not need for size optimization."
#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_opt_size=yes;
else
acnewlib_cv_opt_size=no;
fi
rm -f conftest*])
AM_CONDITIONAL(OPT_SIZE, test x"$acnewlib_cv_opt_size" = x"yes")
AC_SUBST(CFLAGS)
AC_CONFIG_FILES([Makefile])

View File

@ -65,7 +65,7 @@ strlen (const char* str)
#else /* defined __OPTIMIZE_SIZE__ || defined PREFER_SIZE_OVER_SPEED */
#if defined __thumb__ && ! defined __thumb2__
/* Implemented in ../../string/strlen.c. */
#include "../../string/strlen.c"
#elif defined _ISA_ARM_7 || defined __ARM_ARCH_6T2__
/* Implemented in strlen-armv7.S. */