diff options
author | wmi <wmi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-22 21:56:58 +0000 |
---|---|---|
committer | wmi <wmi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-22 21:56:58 +0000 |
commit | b077695d9e39a87da6f8bc68451a9d60467e7020 (patch) | |
tree | 368bbe384fc86dd4c4da764b1d83bb50a9b3ced8 /gcc/gcc.c | |
parent | c611e16f65257725d6a4fac5cb95ec0ae51111de (diff) | |
download | gcc-b077695d9e39a87da6f8bc68451a9d60467e7020.tar.gz |
2012-11-22 Dmitry Vyukov <dvyukov@google.com>
Wei Mi <wmi@google.com>
* builtins.def (DEF_SANITIZER_BUILTIN): Define tsan builtins.
* sanitizer.def: Ditto.
* Makefile.in (tsan.o): Add tsan.o target.
(BUILTINS_DEF): Add sanitizer.def.
* passes.c (init_optimization_passes): Add tsan passes.
* tree-pass.h (register_pass_info): Ditto.
* toplev.c (compile_file): Ditto.
* doc/invoke.texi: Document tsan related options.
* gcc.c (LINK_COMMAND_SPEC): Add LIBTSAN_SPEC in link command if
-fsanitize=thread.
* tsan.c: New file about tsan.
* tsan.h: Ditto.
* common.opt: Add -fsanitize=thread.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193736 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r-- | gcc/gcc.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c index ce5ab6136f3..13e93e5566b 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -560,6 +560,15 @@ proper position among the other output files. */ #endif #endif +#ifndef LIBTSAN_SPEC +#ifdef HAVE_LD_STATIC_DYNAMIC +#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION \ + "} -ltsan %{static-libtsan:" LD_DYNAMIC_OPTION "}" +#else +#define LIBTSAN_SPEC "-ltsan" +#endif +#endif + /* config.h can define LIBGCC_SPEC to override how and when libgcc.a is included. */ #ifndef LIBGCC_SPEC @@ -704,6 +713,7 @@ proper position among the other output files. */ %(mflib) " STACK_SPLIT_SPEC "\ %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\ %{fsanitize=address:" LIBASAN_SPEC "%{static:%ecannot specify -static with -fsanitize=address}}\ + %{fsanitize=thread:" LIBTSAN_SPEC "}\ %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\ %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}" #endif |