Add a few feature tests to configure.ac because clang does not
understand the following:
- nested functions
- -gstabs option
- loopnel instruction
- addr32 in asm statements
- 'p' constraint in asm statements
Adapt Makefiles accordingly.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13615 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/configure.ac b/configure.ac
index 0223ee2..6fc3f1d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1715,6 +1715,59 @@
CFLAGS=$safe_CFLAGS
+# does this compiler support -gstabs ?
+
+AC_MSG_CHECKING([if gcc accepts -gstabs])
+
+safe_CFLAGS=$CFLAGS
+CFLAGS="-gstabs"
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
+ return 0;
+]])], [
+ac_have_gstabs=yes
+AC_MSG_RESULT([yes])
+], [
+ac_have_gstabs=no
+AC_MSG_RESULT([no])
+])
+CFLAGS=$safe_CFLAGS
+AM_CONDITIONAL([HAVE_GSTABS], [test x$ac_have_gstabs = xyes])
+
+
+# does this compiler support nested functions ?
+
+AC_MSG_CHECKING([if gcc accepts nested functions])
+
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
+ int foo() { return 1; }
+ return foo();
+]])], [
+ac_have_nested_functions=yes
+AC_MSG_RESULT([yes])
+], [
+ac_have_nested_functions=no
+AC_MSG_RESULT([no])
+])
+AM_CONDITIONAL([HAVE_NESTED_FUNCTIONS], [test x$ac_have_nested_functions = xyes])
+
+
+# does this compiler support the 'p' constraint in ASM statements ?
+
+AC_MSG_CHECKING([if gcc accepts the 'p' constraint in asm statements])
+
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
+ char *p;
+ __asm__ __volatile__ ("movdqa (%0),%%xmm6\n" : "=p" (p));
+]])], [
+ac_have_asm_constraint_p=yes
+AC_MSG_RESULT([yes])
+], [
+ac_have_asm_constraint_p=no
+AC_MSG_RESULT([no])
+])
+AM_CONDITIONAL([HAVE_ASM_CONSTRAINT_P], [test x$ac_have_asm_constraint_p = xyes])
+
+
# We want to use use the -Ttext-segment option to the linker.
# GNU (bfd) ld supports this directly. Newer GNU gold linkers
# support it as an alias of -Ttext. Sadly GNU (bfd) ld's -Ttext
@@ -1929,6 +1982,46 @@
AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
+# does the x86/amd64 assembler understand the LOOPNEL instruction?
+# Note, this doesn't generate a C-level symbol. It generates a
+# automake-level symbol (BUILD_LOOPNEL_TESTS), used in test Makefile.am's
+AC_MSG_CHECKING([if x86/amd64 assembler supports 'loopnel'])
+
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
+ do {
+ __asm__ __volatile__("1: loopnel 1b\n");
+ } while (0)
+]])], [
+ ac_have_as_loopnel=yes
+ AC_MSG_RESULT([yes])
+], [
+ ac_have_as_loopnel=no
+ AC_MSG_RESULT([no])
+])
+
+AM_CONDITIONAL([BUILD_LOOPNEL_TESTS], [test x$ac_have_as_loopnel = xyes])
+
+
+# does the x86/amd64 assembler understand ADDR32 ?
+# Note, this doesn't generate a C-level symbol. It generates a
+# automake-level symbol (BUILD_ADDR32_TESTS), used in test Makefile.am's
+AC_MSG_CHECKING([if x86/amd64 assembler supports 'addr32'])
+
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
+ do {
+ asm volatile ("addr32 rep movsb");
+ } while (0)
+]])], [
+ ac_have_as_addr32=yes
+ AC_MSG_RESULT([yes])
+], [
+ ac_have_as_addr32=no
+ AC_MSG_RESULT([no])
+])
+
+AM_CONDITIONAL([BUILD_ADDR32_TESTS], [test x$ac_have_as_addr32 = xyes])
+
+
# does the x86/amd64 assembler understand SSE 4.2 instructions?
# Note, this doesn't generate a C-level symbol. It generates a
# automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am
index 555f2ac..7614e89 100644
--- a/memcheck/tests/Makefile.am
+++ b/memcheck/tests/Makefile.am
@@ -287,7 +287,6 @@
custom_alloc \
custom-overlap \
deep-backtrace \
- deep_templates \
describe-block \
doublefree error_counts errs1 exitprog execve1 execve2 erringfds \
err_disable1 err_disable2 err_disable3 err_disable4 \
@@ -353,6 +352,10 @@
check_PROGRAMS += threadname
endif
+if HAVE_GSTABS
+check_PROGRAMS += deep_templates
+endif
+
AM_CFLAGS += $(AM_FLAG_M3264_PRI)
AM_CXXFLAGS += $(AM_FLAG_M3264_PRI)
diff --git a/memcheck/tests/amd64/Makefile.am b/memcheck/tests/amd64/Makefile.am
index 513ce64..6b37fe1 100644
--- a/memcheck/tests/amd64/Makefile.am
+++ b/memcheck/tests/amd64/Makefile.am
@@ -40,7 +40,6 @@
bug279698 \
fxsave-amd64 \
insn-bsfl \
- insn-pcmpistri \
insn-pmovmskb \
more_x87_fp \
sh-mem-vec128 \
@@ -49,6 +48,9 @@
if BUILD_AVX_TESTS
check_PROGRAMS += sh-mem-vec256
endif
+if HAVE_ASM_CONSTRAINT_P
+ check_PROGRAMS += insn-pcmpistri
+endif
AM_CFLAGS += @FLAG_M64@
AM_CXXFLAGS += @FLAG_M64@
diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am
index e9c4fdb..65689dc 100644
--- a/none/tests/Makefile.am
+++ b/none/tests/Makefile.am
@@ -186,7 +186,6 @@
floored fork fucomip \
mmap_fcntl_bug \
munmap_exe map_unaligned map_unmap mq \
- nestedfns \
pending \
procfs-cmdline-exe \
pth_atfork1 pth_blockedsig pth_cancel1 pth_cancel2 pth_cvsimple \
@@ -212,6 +211,10 @@
gxx304 \
process_vm_readv_writev
+if HAVE_NESTED_FUNCTIONS
+ check_PROGRAMS += nestedfns
+endif
+
# DDD:
# - manythreads and thread-exits have lots of this:
# --61831:0:aspacem sync_check_mapping_callback: segment mismatch:
diff --git a/none/tests/amd64/Makefile.am b/none/tests/amd64/Makefile.am
index cc351b7..c7d63d4 100644
--- a/none/tests/amd64/Makefile.am
+++ b/none/tests/amd64/Makefile.am
@@ -85,7 +85,6 @@
check_PROGRAMS = \
allexec \
amd64locked \
- asorep \
bug127521-64 bug132813-amd64 bug132918 \
clc \
cmpxchg \
@@ -97,6 +96,9 @@
sbbmisc \
nibz_bennee_mmap \
xadd
+if BUILD_ADDR32_TESTS
+ check_PROGRAMS += asorep
+endif
if BUILD_SSSE3_TESTS
check_PROGRAMS += ssse3_misaligned
endif
@@ -138,10 +140,12 @@
fcmovnu \
fxtract \
looper \
- loopnel \
jrcxz \
shrld \
slahf-amd64
+if BUILD_LOOPNEL_TESTS
+ check_PROGRAMS += loopnel
+endif
endif
AM_CFLAGS += @FLAG_M64@