Add handling for libc_hwasan to Soong

libc_hwasan is a new library in the runtime apex that lives in
bionic/hwasan/libc.so and is symlinked to /system/lib64/hwasan/libc.so.
This is chosen by the linker if an app or binary requires HWASan
support.

Bug: 276930343
Change-Id: If331744ad84241ad99a41805ea3110d37cf9b0af
This commit is contained in:
Florian Mayer
2023-03-23 17:48:07 -07:00
parent b4949c2b4f
commit 95cd6db590
4 changed files with 22 additions and 3 deletions

View File

@@ -785,6 +785,13 @@ func (s *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
if Bool(sanProps.Writeonly) {
flags.Local.CFlags = append(flags.Local.CFlags, "-mllvm", "-hwasan-instrument-reads=0")
}
if !ctx.staticBinary() && !ctx.Host() {
if ctx.bootstrap() {
flags.DynamicLinker = "/system/bin/bootstrap/linker_hwasan64"
} else {
flags.DynamicLinker = "/system/bin/linker_hwasan64"
}
}
}
if Bool(sanProps.Fuzzer) {