Add sanitizer runtime library to recovery when needed.

Make sanitized targets in recovery depend on ".recovery" flavor of
sanitizer runtime library. This forces installation of the runtime
library in recovery image as long as at least one target depends on it.

Test: hwasan build can boot into recovery
Bug: 112438058
Bug: 119582521
Change-Id: I1b7f9fa4ff5f29acb03c27074512ea24467a3d37
This commit is contained in:
Evgenii Stepanov 2018-11-29 15:12:51 -08:00
parent 42f19a7987
commit 98f5b0642c

View file

@ -49,7 +49,7 @@ var (
cfiStaticLibsMutex sync.Mutex
hwasanStaticLibsMutex sync.Mutex
intOverflowCflags = []string{"-fsanitize-blacklist=build/soong/cc/config/integer_overflow_blacklist.txt"}
intOverflowCflags = []string{"-fsanitize-blacklist=build/soong/cc/config/integer_overflow_blacklist.txt"}
// Pass -Xclang before -fsanitize-minimal-runtime to work around a driver
// check which rejects -fsanitize-minimal-runtime together with
@ -576,9 +576,12 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
sanitize.runtimeLibrary = runtimeLibrary
// When linking against VNDK, use the vendor variant of the runtime lib
sanitize.androidMkRuntimeLibrary = sanitize.runtimeLibrary
if ctx.useVndk() {
sanitize.androidMkRuntimeLibrary = sanitize.runtimeLibrary + vendorSuffix
} else if ctx.inRecovery() {
sanitize.androidMkRuntimeLibrary = sanitize.runtimeLibrary + recoverySuffix
} else {
sanitize.androidMkRuntimeLibrary = sanitize.runtimeLibrary
}
}