summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cc/config/toolchain.go4
-rw-r--r--cc/makevars.go1
-rw-r--r--cc/sanitize.go7
3 files changed, 10 insertions, 2 deletions
diff --git a/cc/config/toolchain.go b/cc/config/toolchain.go
index 997bca6b9..d5e9d0169 100644
--- a/cc/config/toolchain.go
+++ b/cc/config/toolchain.go
@@ -220,6 +220,10 @@ func ScudoRuntimeLibrary(t Toolchain) string {
return LibclangRuntimeLibrary(t, "scudo")
}
+func ScudoMinimalRuntimeLibrary(t Toolchain) string {
+ return LibclangRuntimeLibrary(t, "scudo_minimal")
+}
+
func ToolPath(t Toolchain) string {
if p := t.ToolPath(); p != "" {
return p
diff --git a/cc/makevars.go b/cc/makevars.go
index 47e549189..993b2a8ba 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -281,6 +281,7 @@ func makeVarsToolchain(ctx android.MakeVarsContext, secondPrefix string,
ctx.Strict(secondPrefix+"UBSAN_MINIMAL_RUNTIME_LIBRARY", strings.TrimSuffix(config.UndefinedBehaviorSanitizerMinimalRuntimeLibrary(toolchain), ".a"))
ctx.Strict(secondPrefix+"TSAN_RUNTIME_LIBRARY", strings.TrimSuffix(config.ThreadSanitizerRuntimeLibrary(toolchain), ".so"))
ctx.Strict(secondPrefix+"SCUDO_RUNTIME_LIBRARY", strings.TrimSuffix(config.ScudoRuntimeLibrary(toolchain), ".so"))
+ ctx.Strict(secondPrefix+"SCUDO_MINIMAL_RUNTIME_LIBRARY", strings.TrimSuffix(config.ScudoMinimalRuntimeLibrary(toolchain), ".so"))
}
// This is used by external/gentoo/...
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 8262a6810..3fef6a8d0 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -531,7 +531,11 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
} else if Bool(sanitize.Properties.Sanitize.Thread) {
runtimeLibrary = config.ThreadSanitizerRuntimeLibrary(ctx.toolchain())
} else if Bool(sanitize.Properties.Sanitize.Scudo) {
- runtimeLibrary = config.ScudoRuntimeLibrary(ctx.toolchain())
+ if len(diagSanitizers) == 0 && !sanitize.Properties.UbsanRuntimeDep {
+ runtimeLibrary = config.ScudoMinimalRuntimeLibrary(ctx.toolchain())
+ } else {
+ runtimeLibrary = config.ScudoRuntimeLibrary(ctx.toolchain())
+ }
} else if len(diagSanitizers) > 0 || sanitize.Properties.UbsanRuntimeDep {
runtimeLibrary = config.UndefinedBehaviorSanitizerRuntimeLibrary(ctx.toolchain())
}
@@ -831,7 +835,6 @@ func hwasanVendorStaticLibs(config android.Config) *[]string {
func enableMinimalRuntime(sanitize *sanitize) bool {
if !Bool(sanitize.Properties.Sanitize.Address) &&
!Bool(sanitize.Properties.Sanitize.Hwaddress) &&
- !Bool(sanitize.Properties.Sanitize.Scudo) &&
(Bool(sanitize.Properties.Sanitize.Integer_overflow) ||
len(sanitize.Properties.Sanitize.Misc_undefined) > 0) &&
!(Bool(sanitize.Properties.Sanitize.Diag.Integer_overflow) ||