aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcc.c
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2012-11-22 21:56:58 +0000
committerWei Mi <wmi@google.com>2012-11-22 21:56:58 +0000
commit176aa82e506afdbce7bd29d3601e9a991b8df245 (patch)
tree368bbe384fc86dd4c4da764b1d83bb50a9b3ced8 /gcc/gcc.c
parentee0d683483ece567dcb3d5b1376ee5ffb3020233 (diff)
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: https://gcc.gnu.org/svn/gcc/trunk@193736 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r--gcc/gcc.c10
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