[llvm] r309611 - [sanitizer-coverage] don't instrument available_externally functions
Kostya Serebryany via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 31 13:00:23 PDT 2017
Author: kcc
Date: Mon Jul 31 13:00:22 2017
New Revision: 309611
URL: http://llvm.org/viewvc/llvm-project?rev=309611&view=rev
Log:
[sanitizer-coverage] don't instrument available_externally functions
Modified:
llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
llvm/trunk/test/Instrumentation/SanitizerCoverage/tracing.ll
Modified: llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp?rev=309611&r1=309610&r2=309611&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp Mon Jul 31 13:00:22 2017
@@ -418,6 +418,9 @@ bool SanitizerCoverageModule::runOnFunct
return false; // Should not instrument sanitizer init functions.
if (F.getName().startswith("__sanitizer_"))
return false; // Don't instrument __sanitizer_* callbacks.
+ // Don't touch available_externally functions, their actual body is elewhere.
+ if (F.getLinkage() == GlobalValue::AvailableExternallyLinkage)
+ return false;
// Don't instrument MSVC CRT configuration helpers. They may run before normal
// initialization.
if (F.getName() == "__local_stdio_printf_options" ||
Modified: llvm/trunk/test/Instrumentation/SanitizerCoverage/tracing.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/SanitizerCoverage/tracing.ll?rev=309611&r1=309610&r2=309611&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/SanitizerCoverage/tracing.ll (original)
+++ llvm/trunk/test/Instrumentation/SanitizerCoverage/tracing.ll Mon Jul 31 13:00:22 2017
@@ -18,6 +18,12 @@ entry:
ret void
}
+define available_externally void @external_bar(i32* %a) sanitize_address {
+entry:
+ ret void
+}
+
+
; CHECK_PC-LABEL: define void @foo
; CHECK_PC: call void @__sanitizer_cov_trace_pc
; CHECK_PC: call void @__sanitizer_cov_trace_pc
@@ -33,6 +39,10 @@ entry:
; CHECK_PC_GUARD: call void @__sanitizer_cov_trace_pc_guard
; CHECK_PC_GUARD-NOT: call void @__sanitizer_cov_trace_pc
; CHECK_PC_GUARD: ret void
+; CHECK_PC_GUARD-LABEL: @external_bar
+; CHECK_PC_GUARD-NOT: call void @__sanitizer_cov_trace_pc
+; CHECK_PC_GUARD: ret void
+
; CHECK_PC_GUARD: call void @__sanitizer_cov_trace_pc_guard_init(i32* bitcast (i32** @__start___sancov_guards to i32*), i32* bitcast (i32** @__stop___sancov_guards to i32*))
; CHECK_PC_GUARD_DARWIN-LABEL: define void @foo
More information about the llvm-commits
mailing list