Module: xenomai-2.6 Branch: master Commit: aed548fa55b2e1bf8b2fce9bc313dc9fcff23407 URL: http://git.xenomai.org/?p=xenomai-2.6.git;a=commit;h=aed548fa55b2e1bf8b2fce9bc313dc9fcff23407
Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org> Date: Sun Sep 7 22:12:45 2014 +0200 arm: fix compilation issue with --enable-debug When passing --enable-debug and no CFLAGS, the user-space support is compiled without optimization. Unfortunately, on ARM, when compiling in thumb2 mode with frame pointers, this causes compilation errors when inline assembly uses the "r7" register, which is also the frame pointer. We can not very well stop using the r7 register since it is, for instance, part of the user/kernel syscall ABI, so when we detect this situation, we add the -fomit-frame-pointer flag. This will make the resulting code a little less easy to debug, but at least it will compile. --- configure | 34 +++++++++++++++++++++++++++++++++- configure.in | 24 ++++++++++++++++++++++-- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/configure b/configure index ac318b7..b0b3e54 100755 --- a/configure +++ b/configure @@ -13650,6 +13650,38 @@ XENO_LIB_CFLAGS="$XENO_USER_CFLAGS" XENO_LIB_LDFLAGS="$XENO_USER_LDFLAGS" case "$build_for" in + arm*-*) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether using r7 causes errors" >&5 +$as_echo_n "checking whether using r7 causes errors... " >&6; } +if ${ac_cv_r7_error+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.c <<\EOF +int foo(void) { + register unsigned x __asm__("r7"); + __asm__("mov %0,#0\n\t": "=r"(x)); + return x; +} +EOF + if { ac_try='${CC-cc} $CPPFLAGS $CFLAGS $XENO_USER_CFLAGS -c conftest.c >&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 + ac_cv_r7_error=no + else + ac_cv_r7_error=yes + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_r7_error" >&5 +$as_echo "$ac_cv_r7_error" >&6; } + if test x"$ac_cv_r7_error" = xyes; then + XENO_USER_CFLAGS="-fomit-frame-pointer $XENO_USER_CFLAGS" + XENO_LIB_CFLAGS="-fomit-frame-pointer $XENO_LIB_CFLAGS" + fi + ;; i*86*-*) XENO_LIB_CFLAGS="$XENO_LIB_CFLAGS -fno-omit-frame-pointer" ;; @@ -13776,7 +13808,7 @@ $as_echo_n "checking for fortify support... " >&6; } # Check whether --enable-fortify was given. if test "${enable_fortify+set}" = set; then : enableval=$enable_fortify; case "$enableval" in - y | yes) want_fortify=yes;; + y | yes) want_fortify=yes;; *) want_fortify=no;; esac fi diff --git a/configure.in b/configure.in index 5e8aad1..d04c6e0 100644 --- a/configure.in +++ b/configure.in @@ -549,6 +549,26 @@ XENO_LIB_CFLAGS="$XENO_USER_CFLAGS" XENO_LIB_LDFLAGS="$XENO_USER_LDFLAGS" case "$build_for" in + arm*-*) + AC_CACHE_CHECK([whether using r7 causes errors], ac_cv_r7_error, + [cat > conftest.c <<\EOF +int foo(void) { + register unsigned x __asm__("r7"); + __asm__("mov %0,#0\n\t": "=r"(x)); + return x; +} +EOF + if AC_TRY_COMMAND([${CC-cc} $CPPFLAGS $CFLAGS $XENO_USER_CFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then + ac_cv_r7_error=no + else + ac_cv_r7_error=yes + fi + rm -f conftest*]) + if test x"$ac_cv_r7_error" = xyes; then + XENO_USER_CFLAGS="-fomit-frame-pointer $XENO_USER_CFLAGS" + XENO_LIB_CFLAGS="-fomit-frame-pointer $XENO_LIB_CFLAGS" + fi + ;; i*86*-*) XENO_LIB_CFLAGS="$XENO_LIB_CFLAGS -fno-omit-frame-pointer" ;; @@ -619,12 +639,12 @@ AC_MSG_RESULT($XENO_TEST_DIR) unset want_fortify AC_MSG_CHECKING(for fortify support) -AC_ARG_ENABLE([fortify], +AC_ARG_ENABLE([fortify], AC_HELP_STRING([--enable-fortify], [Enable support for applications compiled with _FORTIFY_SOURCE]), [case "$enableval" in - y | yes) want_fortify=yes;; + y | yes) want_fortify=yes;; *) want_fortify=no;; esac]) AC_MSG_RESULT(${want_fortify:-autodetect}) _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git