From patchwork Thu Nov 22 13:20:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 201045 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 7A2612C0080 for ; Fri, 23 Nov 2012 00:21:28 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1354195289; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To:User-Agent:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=3LS/qcFl0SFMihwtNaGDyv7cWWs=; b=OvhTXJZrAFS4tKM VVrHPywqkULRI0NSky6/YGm7I5JXeqeeKDkvNC0/ReXxmEXUBECU2nfistnw38e7 mON46W+LShCFG64A801F/Ifxw5zTrcxFCkV4NkN2mz8HVP0eGN5yIA/EV0Q1CYCt iTV5fG0EeqXhZYE2WmTmxx3Oko3s= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=WGAAcTgoHGRY9k7k699MyOSNwMACoA9IjaMQCOHvgMq77b4LwAg01ULAxyS6jd 6/yNEvkUHg9wkKThOsxNv10iDn27acbi2EipCtFx9XyVb4T+lHmjPh6ZYYSVXYYg H8vFb1cPQmXbvCb4AbbJDrZctTl0xseCJNKRc/0LxJIDI=; Received: (qmail 13410 invoked by alias); 22 Nov 2012 13:21:23 -0000 Received: (qmail 13397 invoked by uid 22791); 22 Nov 2012 13:21:21 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS, TW_CX X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Nov 2012 13:21:11 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qAMDL3MR006934 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 22 Nov 2012 08:21:10 -0500 Received: from zalov.redhat.com (vpn1-6-55.ams2.redhat.com [10.36.6.55]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qAMDKxvn019495 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 22 Nov 2012 08:21:00 -0500 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.redhat.com (8.14.5/8.14.5) with ESMTP id qAMDKwHt011713; Thu, 22 Nov 2012 14:20:58 +0100 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id qAMDKwmr011712; Thu, 22 Nov 2012 14:20:58 +0100 Date: Thu, 22 Nov 2012 14:20:57 +0100 From: Jakub Jelinek To: Wei Mi , Dodji Seketeli Cc: Konstantin Serebryany , GCC Patches , David Li , Diego Novillo , Dmitry Vyukov Subject: [tsan] libsanitizer tweaks Message-ID: <20121122132057.GP2315@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <20121103183906.GF1881@tucnak.redhat.com> <20121113164014.GY1886@tucnak.redhat.com> <50A2EBD2.7000904@redhat.com> <20121122095400.GM2315@tucnak.redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20121122095400.GM2315@tucnak.redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 * 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. Jakub --- 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 +#include +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 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