Scudo minimal runtime support for Soong
Scudo is now compatible with the -fsanitize-minimal-runtime, and offers a new dynamic library that doesn't bundle UBSan. This patch adds support for this new library in Soong, preferring it over the full one, unless a UBSan or diagnostic dependency is found. Test: aosp compiled with m -j Test: local test enabling Scudo for tombstoned Change-Id: I17794131db148b33f8a8710ac43302cadf1af314
This commit is contained in:
parent
3393b26cdc
commit
ad73b2e18a
|
@ -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
|
||||
|
|
|
@ -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/...
|
||||
|
|
|
@ -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) ||
|
||||
|
|
Loading…
Reference in New Issue