aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/sanitizer_flags.go
diff options
context:
space:
mode:
Diffstat (limited to 'compiler_wrapper/sanitizer_flags.go')
-rw-r--r--compiler_wrapper/sanitizer_flags.go26
1 files changed, 17 insertions, 9 deletions
diff --git a/compiler_wrapper/sanitizer_flags.go b/compiler_wrapper/sanitizer_flags.go
index 32f2cb78..fe8d1503 100644
--- a/compiler_wrapper/sanitizer_flags.go
+++ b/compiler_wrapper/sanitizer_flags.go
@@ -9,15 +9,20 @@ import (
)
func processSanitizerFlags(builder *commandBuilder) {
+ hasCoverageFlags := false
hasSanitizeFlags := false
hasSanitizeFuzzerFlags := false
for _, arg := range builder.args {
// TODO: This should probably be -fsanitize= to not match on
// e.g. -fsanitize-blacklist
- if arg.fromUser && strings.HasPrefix(arg.value, "-fsanitize") {
- hasSanitizeFlags = true
- if strings.Contains(arg.value, "fuzzer") {
- hasSanitizeFuzzerFlags = true
+ if arg.fromUser {
+ if strings.HasPrefix(arg.value, "-fsanitize") {
+ hasSanitizeFlags = true
+ if strings.Contains(arg.value, "fuzzer") {
+ hasSanitizeFuzzerFlags = true
+ }
+ } else if arg.value == "-fprofile-instr-generate" {
+ hasCoverageFlags = true
}
}
}
@@ -39,12 +44,15 @@ func processSanitizerFlags(builder *commandBuilder) {
}
return arg.value
})
- if hasSanitizeFuzzerFlags && builder.target.compilerType == clangType {
- fuzzerFlagsToAdd := []string{
- // TODO: This flag should be removed once fuzzer works with new pass manager
- "-fno-experimental-new-pass-manager",
+ if builder.target.compilerType == clangType {
+ // hasSanitizeFlags && hasCoverageFlags is to work around crbug.com/1013622
+ if hasSanitizeFuzzerFlags || (hasSanitizeFlags && hasCoverageFlags) {
+ fuzzerFlagsToAdd := []string{
+ // TODO: This flag should be removed once fuzzer works with new pass manager
+ "-fno-experimental-new-pass-manager",
+ }
+ builder.addPreUserArgs(fuzzerFlagsToAdd...)
}
- builder.addPreUserArgs(fuzzerFlagsToAdd...)
}
}
}