From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23355 invoked by alias); 26 Nov 2014 19:43:11 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 23342 invoked by uid 89); 26 Nov 2014 19:43:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 26 Nov 2014 19:43:09 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAQJh8XW028786 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 26 Nov 2014 14:43:08 -0500 Received: from tucnak.zalov.cz (ovpn-116-85.ams2.redhat.com [10.36.116.85]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sAQJh6eY003213 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Wed, 26 Nov 2014 14:43:07 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.9/8.14.9) with ESMTP id sAQJh5N4024116; Wed, 26 Nov 2014 20:43:05 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.9/8.14.9/Submit) id sAQJh4AO023443; Wed, 26 Nov 2014 20:43:04 +0100 Date: Wed, 26 Nov 2014 21:15:00 -0000 From: Jakub Jelinek To: Dodji Seketeli , Dmitry Vyukov Cc: Konstantin Serebryany , GCC Patches Subject: [PATCH] Allow -fsanitize=thread without -pie Message-ID: <20141126194304.GV1669@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <20141113091614.GB5026@tucnak.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2014-11/txt/msg03337.txt.bz2 On Fri, Nov 21, 2014 at 04:20:44PM +0400, Dmitry Vyukov wrote: > Yes, I think it's the way to go. > I've just committed the following revision to clang that removes -pie > when compiling with tsan: > http://llvm.org/viewvc/llvm-project?view=revision&revision=222526 > The tests in llvm tree pass with this change. Ok, here it is. I think -static still doesn't work, for static linking symbols might not be interposed as libtsan wants, so I've changed it to match what we do for -fsanitize=address. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2014-11-26 Jakub Jelinek * gcc.c (SANITIZER_SPEC): Don't error on -fsanitize=thread without -pie or -shared, error on -fsanitize=thread -static instead. * lib/tsan-dg.exp (check_effective_target_fsanitize_thread, tsan_init): Don't use -fPIE or -pie. --- gcc/gcc.c.jj 2014-11-26 11:08:51.000000000 +0100 +++ gcc/gcc.c 2014-11-26 15:59:12.034729813 +0100 @@ -794,7 +794,7 @@ proper position among the other output f %{!nostdlib:%{!nodefaultlibs:%{%:sanitize(address):" LIBASAN_SPEC "\ %{static:%ecannot specify -static with -fsanitize=address}}\ %{%:sanitize(thread):" LIBTSAN_SPEC "\ - %{!pie:%{!shared:%e-fsanitize=thread linking must be done with -pie or -shared}}}\ + %{static:%ecannot specify -static with -fsanitize=thread}}\ %{%:sanitize(undefined):" LIBUBSAN_SPEC "}\ %{%:sanitize(leak):" LIBLSAN_SPEC "}}}" #endif --- gcc/testsuite/lib/tsan-dg.exp.jj 2014-10-10 19:42:16.000000000 +0200 +++ gcc/testsuite/lib/tsan-dg.exp 2014-11-26 16:02:21.663347886 +0100 @@ -18,9 +18,9 @@ # code, 0 otherwise. proc check_effective_target_fsanitize_thread {} { - return [check_no_compiler_messages fanitize_thread executable { + return [check_no_compiler_messages fsanitize_thread executable { int main (void) { return 0; } - } "-fPIE -pie -fsanitize=thread"] + } "-fsanitize=thread"] } # @@ -93,12 +93,12 @@ proc tsan_init { args } { if [info exists ALWAYS_CXXFLAGS] { set tsan_saved_ALWAYS_CXXFLAGS $ALWAYS_CXXFLAGS set ALWAYS_CXXFLAGS [concat "{ldflags=$link_flags}" $ALWAYS_CXXFLAGS] - set ALWAYS_CXXFLAGS [concat "{additional_flags=-fPIE -pie -fsanitize=thread -g}" $ALWAYS_CXXFLAGS] + set ALWAYS_CXXFLAGS [concat "{additional_flags=-fsanitize=thread -g}" $ALWAYS_CXXFLAGS] } else { if [info exists TEST_ALWAYS_FLAGS] { - set TEST_ALWAYS_FLAGS "$link_flags -fPIE -pie -fsanitize=thread -g $TEST_ALWAYS_FLAGS" + set TEST_ALWAYS_FLAGS "$link_flags -fsanitize=thread -g $TEST_ALWAYS_FLAGS" } else { - set TEST_ALWAYS_FLAGS "$link_flags -fPIE -pie -fsanitize=thread -g" + set TEST_ALWAYS_FLAGS "$link_flags -fsanitize=thread -g" } } @@ -110,7 +110,7 @@ proc tsan_init { args } { set individual_timeout 20 if [check_runtime_nocache tsan_works { int main () { return 0; } - } "-fPIE -pie -fsanitize=thread -g"] { + } "-fsanitize=thread -g"] { set dg-do-what-default run } else { set dg-do-what-default compile Jakub