[sanitizer-coverage] don't instrument available_externally functions

llvm-svn: 309611
This commit is contained in:
Kostya Serebryany 2017-07-31 20:00:22 +00:00
parent bb6f079a45
commit bfc83fa8d7
2 changed files with 13 additions and 0 deletions

View File

@ -418,6 +418,9 @@ bool SanitizerCoverageModule::runOnFunction(Function &F) {
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" ||

View File

@ -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