On Thu, Nov 22, 2012 at 10:54:00AM +0100, Jakub Jelinek wrote: > Ok, thanks. The comments can be fixed up incrementally.
I had closer look at the libsanitizer/tsan configury, and I think I'd prefer the configure.tgt script to say if tsan should be built or not. Furthermore, GCC doesn't support -Wno-c99-extensions flag for C++, that is a clang-ism. Ok for trunk (after the tsan patches are committed, on top of them)? 2012-11-22 Jakub Jelinek <ja...@redhat.com> * tsan/Makefile.am (AM_CXXFLAGS): Remove -Wno-variadic-macros. * Makefile.am (SUBDIRS): Guard tsan addition with TSAN_SUPPORTED automake conditional instead of !MULTISUBDIR32. * configure.tgt: Set TSAN_SUPPORTED=yes for x86_64/i686-linux for 64-bit multilib. * configure.ac: Check for void * size, source in configure.tgt, define TSAN_SUPPORTED conditional instead of MULTILIBDIR32. * configure: Regenerated. * Makefile.in: Regenerated. * tsan/Makefile.in: Regenerated. --- libsanitizer/tsan/Makefile.am.jj 2012-11-22 13:18:04.000000000 +0100 +++ libsanitizer/tsan/Makefile.am 2012-11-22 13:44:51.898192821 +0100 @@ -1,7 +1,7 @@ AM_CPPFLAGS = -I $(top_srcdir) -I $(top_srcdir)/include DEFS = -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -Wno-c99-extensions +AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros ACLOCAL_AMFLAGS = -I m4 toolexeclib_LTLIBRARIES = libtsan.la --- libsanitizer/Makefile.am.jj 2012-11-22 13:18:04.000000000 +0100 +++ libsanitizer/Makefile.am 2012-11-22 14:03:36.947775816 +0100 @@ -1,9 +1,9 @@ ACLOCAL_AMFLAGS = -I .. -I ../config -if MULTISUBDIR32 -SUBDIRS = interception sanitizer_common asan -else +if TSAN_SUPPORTED SUBDIRS = interception sanitizer_common asan tsan +else +SUBDIRS = interception sanitizer_common asan endif # Work around what appears to be a GNU make bug handling MAKEFLAGS --- libsanitizer/configure.tgt.jj 2012-11-16 12:39:18.000000000 +0100 +++ libsanitizer/configure.tgt 2012-11-22 14:11:31.233300510 +0100 @@ -20,7 +20,12 @@ # Filter out unsupported systems. case "${target}" in - x86_64-*-linux* | i?86-*-linux* | sparc*-*-linux*) + x86_64-*-linux* | i?86-*-linux*) + if test x$ac_cv_sizeof_void_p = x8; then + TSAN_SUPPORTED=yes + fi + ;; + sparc*-*-linux*) ;; *) UNSUPPORTED=1 --- libsanitizer/configure.ac.jj 2012-11-22 13:18:04.000000000 +0100 +++ libsanitizer/configure.ac 2012-11-22 13:59:46.457084798 +0100 @@ -67,12 +67,18 @@ AM_PROG_LIBTOOL AC_SUBST(enable_shared) AC_SUBST(enable_static) +AC_CHECK_SIZEOF([void *]) + if test "${multilib}" = "yes"; then multilib_arg="--enable-multilib" else multilib_arg= fi -AM_CONDITIONAL(MULTISUBDIR32, [test "x$with_multisubdir" = "x32"]) + +# Get target configury. +unset TSAN_SUPPORTED +. ${srcdir}/configure.tgt +AM_CONDITIONAL(TSAN_SUPPORTED, [test "x$TSAN_SUPPORTED" = "xyes"]) AC_CONFIG_FILES([Makefile]) @@ -89,7 +95,7 @@ _EOF AS_UNSET([ml_norecursion]) ]) -if test "x$with_multisubdir" != "x32"; then +if test "x$TSAN_SUPPORTED" = "xyes"; then AC_CONFIG_FILES(AC_FOREACH([DIR], [tsan], [DIR/Makefile ]), [cat > vpsed$$ << \_EOF s!`test -f '$<' || echo '$(srcdir)/'`!! --- libsanitizer/configure.jj 2012-11-22 13:18:04.000000000 +0100 +++ libsanitizer/configure 2012-11-22 14:01:47.463398176 +0100 @@ -604,8 +604,8 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS -MULTISUBDIR32_FALSE -MULTISUBDIR32_TRUE +TSAN_SUPPORTED_FALSE +TSAN_SUPPORTED_TRUE enable_static enable_shared CXXCPP @@ -1878,6 +1878,184 @@ fi return $ac_retval } # ac_fn_cxx_try_link + +# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES +# -------------------------------------------- +# Tries to find the compile-time value of EXPR in a program that includes +# INCLUDES, setting VAR accordingly. Returns whether the value could be +# computed +ac_fn_c_compute_int () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=0 ac_mid=0 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid; break +else + as_fn_arith $ac_mid + 1 && ac_lo=$as_val + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=-1 ac_mid=-1 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=$ac_mid; break +else + as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + ac_lo= ac_hi= +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid +else + as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in #(( +?*) eval "$3=\$ac_lo"; ac_retval=0 ;; +'') ac_retval=1 ;; +esac + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +static long int longval () { return $2; } +static unsigned long int ulongval () { return $2; } +#include <stdio.h> +#include <stdlib.h> +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (($2) < 0) + { + long int i = longval (); + if (i != ($2)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ($2)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + echo >>conftest.val; read $3 <conftest.val; ac_retval=0 +else + ac_retval=1 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f conftest.val + + fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval + +} # ac_fn_c_compute_int cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -10900,7 +11078,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10903 "configure" +#line 11081 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11006,7 +11184,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11009 "configure" +#line 11187 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14263,17 +14441,56 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 +$as_echo_n "checking size of void *... " >&6; } +if test "${ac_cv_sizeof_void_p+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_void_p" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ as_fn_set_status 77 +as_fn_error "cannot compute sizeof (void *) +See \`config.log' for more details." "$LINENO" 5; }; } + else + ac_cv_sizeof_void_p=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 +$as_echo "$ac_cv_sizeof_void_p" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_VOID_P $ac_cv_sizeof_void_p +_ACEOF + + + if test "${multilib}" = "yes"; then multilib_arg="--enable-multilib" else multilib_arg= fi - if test "x$with_multisubdir" = "x32"; then - MULTISUBDIR32_TRUE= - MULTISUBDIR32_FALSE='#' + +# Get target configury. +unset TSAN_SUPPORTED +. ${srcdir}/configure.tgt + if test "x$TSAN_SUPPORTED" = "xyes"; then + TSAN_SUPPORTED_TRUE= + TSAN_SUPPORTED_FALSE='#' else - MULTISUBDIR32_TRUE='#' - MULTISUBDIR32_FALSE= + TSAN_SUPPORTED_TRUE='#' + TSAN_SUPPORTED_FALSE= fi @@ -14283,7 +14500,7 @@ ac_config_files="$ac_config_files Makefi ac_config_files="$ac_config_files interception/Makefile sanitizer_common/Makefile asan/Makefile" -if test "x$with_multisubdir" != "x32"; then +if test "x$TSAN_SUPPORTED" = "xyes"; then ac_config_files="$ac_config_files tsan/Makefile" fi @@ -14449,8 +14666,8 @@ if test -z "${am__fastdepCCAS_TRUE}" && as_fn_error "conditional \"am__fastdepCCAS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${MULTISUBDIR32_TRUE}" && test -z "${MULTISUBDIR32_FALSE}"; then - as_fn_error "conditional \"MULTISUBDIR32\" was never defined. +if test -z "${TSAN_SUPPORTED_TRUE}" && test -z "${TSAN_SUPPORTED_FALSE}"; then + as_fn_error "conditional \"TSAN_SUPPORTED\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi --- libsanitizer/tsan/Makefile.in.jj 2012-11-22 13:18:04.000000000 +0100 +++ libsanitizer/tsan/Makefile.in 2012-11-22 14:04:19.902532612 +0100 @@ -238,7 +238,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I $(top_srcdir) -I $(top_srcdir)/include -AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros -Wno-c99-extensions +AM_CXXFLAGS = -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fvisibility=hidden -Wno-variadic-macros ACLOCAL_AMFLAGS = -I m4 toolexeclib_LTLIBRARIES = libtsan.la tsan_files = \ --- libsanitizer/Makefile.in.jj 2012-11-22 13:18:04.000000000 +0100 +++ libsanitizer/Makefile.in 2012-11-22 14:04:19.928532489 +0100 @@ -244,8 +244,8 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I .. -I ../config -@MULTISUBDIR32_FALSE@SUBDIRS = interception sanitizer_common asan tsan -@MULTISUBDIR32_TRUE@SUBDIRS = interception sanitizer_common asan +@TSAN_SUPPORTED_FALSE@SUBDIRS = interception sanitizer_common asan +@TSAN_SUPPORTED_TRUE@SUBDIRS = interception sanitizer_common asan tsan # Work around what appears to be a GNU make bug handling MAKEFLAGS # values defined in terms of make variables, as is the case for CC and Jakub