summaryrefslogtreecommitdiff
path: root/aclocal.m4
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2013-05-26 16:21:10 +0200
committerThomas Schwinge <thomas@codesourcery.com>2013-05-26 16:21:10 +0200
commitd9e11d0c51182483d30760f3c66000a0e9b8c922 (patch)
treee1d147b2d9d270f8cec60e499bc5fd738144d4c2 /aclocal.m4
parentd5ce2d1c5dfae01688cad679b2fbd071e70a1f3a (diff)
parent9a079e270a9bec7e1fe28aeda63e07c1bb808d44 (diff)
Merge branch 'baseline' into refs/top-bases/tschwinge/Roger_Whittaker
Conflicts: sysdeps/mach/hurd/i386/init-first.c
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m433
1 files changed, 33 insertions, 0 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index b9f717a8fa..350ce55957 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -249,3 +249,36 @@ dnl LIBC_CONFIG_VAR(make-variable, shell-value)
AC_DEFUN([LIBC_CONFIG_VAR],
[config_vars="$config_vars
$1 = $2"])
+
+dnl Check that function FUNC was inlined as a builtin. The code fragment
+dnl CODE is compiled with additional options CC_OPTION. If FUNC is
+dnl not found in the assembly then it is assumed the compiler has support
+dnl for this builtin and has inlined the call. If the compiler has the
+dnl feature then ACTION-IF-TRUE is called, otherwise ACTION-IF-FALSE.
+dnl It is up to the caller to provide a CC_OPTION that ensures the
+dnl builtin is inlined if present.
+dnl Warning: This may not work for some machines. For example on ARM the
+dnl ABI dictates that some functions should not be inlined and instead
+dnl should be provided by a compiler helper library e.g. __aeabi_memcpy.
+dnl This is done to reduce code size.
+dnl LIBC_COMPILER_BUILTIN([func], [code], [cc_option], [action-if-true], [action-if-false])
+AC_DEFUN([LIBC_COMPILER_BUILTIN_INLINED],
+[AC_MSG_CHECKING([for compiler support of inlined builtin function $1])
+libc_compiler_builtin_inlined=no
+cat > conftest.c <<EOF
+int _start (void) { $2 return 0; }
+EOF
+if ! AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
+ $3 -nostdlib -nostartfiles
+ -S conftest.c -o - | fgrep "$1"
+ 1>&AS_MESSAGE_LOG_FD])
+then
+ libc_compiler_builtin_inlined=yes
+fi
+rm -f conftest*
+if test $libc_compiler_builtin_inlined = yes; then
+ $4
+else
+ $5
+fi
+AC_MSG_RESULT($libc_compiler_builtin_inlined)])