[compiler-rt] r230501 - Reland r230419 - add __asan_default_suppressions() hook with a fix for Windows
Timur Iskhodzhanov
timurrrr at google.com
Wed Feb 25 08:00:26 PST 2015
Author: timurrrr
Date: Wed Feb 25 10:00:26 2015
New Revision: 230501
URL: http://llvm.org/viewvc/llvm-project?rev=230501&view=rev
Log:
Reland r230419 - add __asan_default_suppressions() hook with a fix for Windows
Added:
compiler-rt/trunk/test/asan/TestCases/Linux/asan_default_suppressions.cc
Modified:
compiler-rt/trunk/lib/asan/asan_suppressions.cc
compiler-rt/trunk/lib/asan/asan_win.cc
Modified: compiler-rt/trunk/lib/asan/asan_suppressions.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_suppressions.cc?rev=230501&r1=230500&r2=230501&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_suppressions.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_suppressions.cc Wed Feb 25 10:00:26 2015
@@ -31,11 +31,23 @@ static const char *kSuppressionTypes[] =
kInterceptorName, kInterceptorViaFunction, kInterceptorViaLibrary,
kODRViolation};
+extern "C" {
+#if SANITIZER_SUPPORTS_WEAK_HOOKS
+SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE
+const char *__asan_default_suppressions();
+#else
+// No week hooks, provide empty implementation.
+const char *__asan_default_suppressions() { return ""; }
+#endif // SANITIZER_SUPPORTS_WEAK_HOOKS
+} // extern "C"
+
void InitializeSuppressions() {
CHECK_EQ(nullptr, suppression_ctx);
suppression_ctx = new (suppression_placeholder) // NOLINT
SuppressionContext(kSuppressionTypes, ARRAY_SIZE(kSuppressionTypes));
suppression_ctx->ParseFromFile(flags()->suppressions);
+ if (&__asan_default_suppressions)
+ suppression_ctx->Parse(__asan_default_suppressions());
}
bool IsInterceptorSuppressed(const char *interceptor_name) {
Modified: compiler-rt/trunk/lib/asan/asan_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_win.cc?rev=230501&r1=230500&r2=230501&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_win.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_win.cc Wed Feb 25 10:00:26 2015
@@ -40,10 +40,12 @@ int __asan_should_detect_stack_use_after
void __sanitizer_default_malloc_hook(void *ptr, uptr size) { }
void __sanitizer_default_free_hook(void *ptr) { }
const char* __asan_default_default_options() { return ""; }
+const char* __asan_default_default_suppressions() { return ""; }
void __asan_default_on_error() {}
#pragma comment(linker, "/alternatename:___sanitizer_malloc_hook=___sanitizer_default_malloc_hook") // NOLINT
#pragma comment(linker, "/alternatename:___sanitizer_free_hook=___sanitizer_default_free_hook") // NOLINT
#pragma comment(linker, "/alternatename:___asan_default_options=___asan_default_default_options") // NOLINT
+#pragma comment(linker, "/alternatename:___asan_default_suppressions=___asan_default_default_suppressions") // NOLINT
#pragma comment(linker, "/alternatename:___asan_on_error=___asan_default_on_error") // NOLINT
} // extern "C"
Added: compiler-rt/trunk/test/asan/TestCases/Linux/asan_default_suppressions.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Linux/asan_default_suppressions.cc?rev=230501&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Linux/asan_default_suppressions.cc (added)
+++ compiler-rt/trunk/test/asan/TestCases/Linux/asan_default_suppressions.cc Wed Feb 25 10:00:26 2015
@@ -0,0 +1,14 @@
+// Test that we use the suppressions from __asan_default_suppressions.
+// RUN: %clangxx_asan %s -o %t && not %run %t 2>&1 | FileCheck %s
+extern "C" {
+ const char *__asan_default_suppressions() { return "FooBar"; }
+}
+// CHECK: AddressSanitizer: failed to parse suppressions
+int main() {}
+// Test that we use the suppressions from __asan_default_suppressions.
+// RUN: %clangxx_asan %s -o %t && not %run %t 2>&1 | FileCheck %s
+extern "C" {
+ const char *__asan_default_suppressions() { return "FooBar"; }
+}
+// CHECK: AddressSanitizer: failed to parse suppressions
+int main() {}
More information about the llvm-commits
mailing list