public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Dmitry Vyukov <dvyukov@google.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Dodji Seketeli <dodji@redhat.com>,
		Konstantin Serebryany <konstantin.s.serebryany@gmail.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Allow -fsanitize=thread without -pie
Date: Wed, 26 Nov 2014 21:20:00 -0000	[thread overview]
Message-ID: <CACT4Y+bsbesHrx64bhCszmscPdgrT4tZ9DeM=NLmLpQPRXAGEA@mail.gmail.com> (raw)
In-Reply-To: <20141126194304.GV1669@tucnak.redhat.com>

Looks good to me.
Thanks!

On Wed, Nov 26, 2014 at 10:43 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> 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  <jakub@redhat.com>
>
>         * 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

  reply	other threads:[~2014-11-26 19:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-13  1:45 libsanitizer merge from upstream r221802 Konstantin Serebryany
2014-11-13  9:16 ` Jakub Jelinek
2014-11-13 20:49   ` Konstantin Serebryany
2014-11-14 10:44     ` Christophe Lyon
2014-11-14 15:51       ` Christophe Lyon
2014-11-14 17:00         ` Konstantin Serebryany
2014-11-14 16:53       ` Konstantin Serebryany
2014-11-14 16:57         ` Konstantin Serebryany
2014-11-21 12:24   ` Dmitry Vyukov
2014-11-26 21:15     ` [PATCH] Allow -fsanitize=thread without -pie Jakub Jelinek
2014-11-26 21:20       ` Dmitry Vyukov [this message]
2014-12-01 18:27       ` Jeff Law
2014-12-29 18:36     ` libsanitizer merge from upstream r221802 David Abdurachmanov
2014-12-29 20:03       ` Jakub Jelinek
2014-12-30 22:48         ` David Abdurachmanov
2014-12-30 22:49           ` Andrew Pinski
2014-12-31 12:36             ` David Abdurachmanov
2015-01-05 20:25               ` Christophe Lyon
2014-12-29 18:44     ` David Abdurachmanov
2014-11-13 14:45 ` Jack Howarth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACT4Y+bsbesHrx64bhCszmscPdgrT4tZ9DeM=NLmLpQPRXAGEA@mail.gmail.com' \
    --to=dvyukov@google.com \
    --cc=dodji@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=konstantin.s.serebryany@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).