[compiler-rt] r173917 - tsan: introduce a helped macro CPP_WEAK (Go linker does not support weak symbols)

Dmitry Vyukov dvyukov at google.com
Wed Jan 30 01:46:53 PST 2013


Author: dvyukov
Date: Wed Jan 30 03:46:53 2013
New Revision: 173917

URL: http://llvm.org/viewvc/llvm-project?rev=173917&view=rev
Log:
tsan: introduce a helped macro CPP_WEAK (Go linker does not support weak symbols)

Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_defs.h
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_defs.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_defs.h?rev=173917&r1=173916&r2=173917&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_defs.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_defs.h Wed Jan 30 03:46:53 2013
@@ -28,10 +28,13 @@ namespace __tsan {
 const bool kGoMode = true;
 const bool kCppMode = false;
 const char *const kTsanOptionsEnv = "GORACE";
+#define CPP_WEAK WEAK
 #else
 const bool kGoMode = false;
 const bool kCppMode = true;
 const char *const kTsanOptionsEnv = "TSAN_OPTIONS";
+// Go linker does not support weak symbols.
+#define CPP_WEAK
 #endif
 
 const int kTidBits = 13;

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc?rev=173917&r1=173916&r2=173917&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc Wed Jan 30 03:46:53 2013
@@ -38,11 +38,9 @@ THREADLOCAL char cur_thread_placeholder[
 static char ctx_placeholder[sizeof(Context)] ALIGNED(64);
 
 // Can be overriden by a front-end.
-#ifndef TSAN_GO
-bool WEAK OnFinalize(bool failed) {
+bool CPP_WEAK OnFinalize(bool failed) {
   return failed;
 }
-#endif
 
 static Context *ctx;
 Context *CTX() {
@@ -284,9 +282,7 @@ int Finalize(ThreadState *thr) {
         ctx->nmissed_expected);
   }
 
-#ifndef TSAN_GO
   failed = OnFinalize(failed);
-#endif
 
   StatAggregate(ctx->stat, thr->stat);
   StatOutput(ctx->stat);





More information about the llvm-commits mailing list