[llvm-commits] [llvm] r144596 - in /llvm/trunk: include/llvm/Support/Compiler.h lib/Support/Valgrind.cpp
Nick Lewycky
nicholas at mxc.ca
Mon Nov 14 16:14:04 PST 2011
Author: nicholas
Date: Mon Nov 14 18:14:04 2011
New Revision: 144596
URL: http://llvm.org/viewvc/llvm-project?rev=144596&view=rev
Log:
Fix linking for some users who already have tsan enabled code and are trying to
link it against llvm code, by making our definitions weak. "Some users."
Modified:
llvm/trunk/include/llvm/Support/Compiler.h
llvm/trunk/lib/Support/Valgrind.cpp
Modified: llvm/trunk/include/llvm/Support/Compiler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Compiler.h?rev=144596&r1=144595&r2=144596&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Compiler.h (original)
+++ llvm/trunk/include/llvm/Support/Compiler.h Mon Nov 14 18:14:04 2011
@@ -62,11 +62,18 @@
#endif
#if (__GNUC__ >= 4)
+#define LLVM_ATTRIBUTE_WEAK __attribute__((__weak__))
+#else
+#define LLVM_ATTRIBUTE_WEAK
+#endif
+
+#if (__GNUC__ >= 4)
#define BUILTIN_EXPECT(EXPR, VALUE) __builtin_expect((EXPR), (VALUE))
#else
#define BUILTIN_EXPECT(EXPR, VALUE) (EXPR)
#endif
+
// C++ doesn't support 'extern template' of template specializations. GCC does,
// but requires __extension__ before it. In the header, use this:
// EXTERN_TEMPLATE_INSTANTIATION(class foo<bar>);
Modified: llvm/trunk/lib/Support/Valgrind.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Valgrind.cpp?rev=144596&r1=144595&r2=144596&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Valgrind.cpp (original)
+++ llvm/trunk/lib/Support/Valgrind.cpp Mon Nov 14 18:14:04 2011
@@ -56,10 +56,10 @@
// These functions require no implementation, tsan just looks at the arguments
// they're called with.
extern "C" {
-void AnnotateHappensBefore(const char *file, int line,
- const volatile void *cv) {}
-void AnnotateHappensAfter(const char *file, int line,
- const volatile void *cv) {}
-void AnnotateIgnoreWritesBegin(const char *file, int line) {}
-void AnnotateIgnoreWritesEnd(const char *file, int line) {}
+LLVM_ATTRIBUTE_WEAK void AnnotateHappensBefore(const char *file, int line,
+ const volatile void *cv) {}
+LLVM_ATTRIBUTE_WEAK void AnnotateHappensAfter(const char *file, int line,
+ const volatile void *cv) {}
+LLVM_ATTRIBUTE_WEAK void AnnotateIgnoreWritesBegin(const char *file, int line){}
+LLVM_ATTRIBUTE_WEAK void AnnotateIgnoreWritesEnd(const char *file, int line) {}
}
More information about the llvm-commits
mailing list