Merge "Add handling for libc_hwasan to Soong"
This commit is contained in:
commit
7de9aa1a7b
4 changed files with 22 additions and 3 deletions
|
@ -1659,7 +1659,6 @@ func apexFileForNativeLibrary(ctx android.BaseModuleContext, ccMod *cc.Module, h
|
|||
if ccMod.Target().NativeBridge == android.NativeBridgeEnabled {
|
||||
dirInApex = filepath.Join(dirInApex, ccMod.Target().NativeBridgeRelativePath)
|
||||
}
|
||||
dirInApex = filepath.Join(dirInApex, ccMod.RelativeInstallPath())
|
||||
if handleSpecialLibs && cc.InstallToBootstrap(ccMod.BaseModuleName(), ctx.Config()) {
|
||||
// Special case for Bionic libs and other libs installed with them. This is to
|
||||
// prevent those libs from being included in the search path
|
||||
|
@ -1672,6 +1671,10 @@ func apexFileForNativeLibrary(ctx android.BaseModuleContext, ccMod *cc.Module, h
|
|||
// loading of them, which isn't supported.
|
||||
dirInApex = filepath.Join(dirInApex, "bionic")
|
||||
}
|
||||
// This needs to go after the runtime APEX handling because otherwise we would get
|
||||
// weird paths like lib64/rel_install_path/bionic rather than
|
||||
// lib64/bionic/rel_install_path.
|
||||
dirInApex = filepath.Join(dirInApex, ccMod.RelativeInstallPath())
|
||||
|
||||
fileToCopy := android.OutputFileForModule(ctx, ccMod, "")
|
||||
androidMkModuleName := ccMod.BaseModuleName() + ccMod.Properties.SubName
|
||||
|
|
2
cc/cc.go
2
cc/cc.go
|
@ -1475,7 +1475,7 @@ func isBionic(name string) bool {
|
|||
func InstallToBootstrap(name string, config android.Config) bool {
|
||||
// NOTE: also update //build/bazel/rules/apex/cc.bzl#_installed_to_bootstrap
|
||||
// if this list is updated.
|
||||
if name == "libclang_rt.hwasan" {
|
||||
if name == "libclang_rt.hwasan" || name == "libc_hwasan" {
|
||||
return true
|
||||
}
|
||||
return isBionic(name)
|
||||
|
|
|
@ -2207,7 +2207,16 @@ func (library *libraryDecorator) toc() android.OptionalPath {
|
|||
func (library *libraryDecorator) installSymlinkToRuntimeApex(ctx ModuleContext, file android.Path) {
|
||||
dir := library.baseInstaller.installDir(ctx)
|
||||
dirOnDevice := android.InstallPathToOnDevicePath(ctx, dir)
|
||||
target := "/" + filepath.Join("apex", "com.android.runtime", dir.Base(), "bionic", file.Base())
|
||||
// libc_hwasan has relative_install_dir set, which would mess up the dir.Base() logic.
|
||||
// hardcode here because it's the only target, if we have other targets that use this
|
||||
// we can generalise this.
|
||||
var target string
|
||||
if ctx.baseModuleName() == "libc_hwasan" {
|
||||
target = "/" + filepath.Join("apex", "com.android.runtime", "lib64", "bionic", "hwasan", file.Base())
|
||||
} else {
|
||||
base := dir.Base()
|
||||
target = "/" + filepath.Join("apex", "com.android.runtime", base, "bionic", file.Base())
|
||||
}
|
||||
ctx.InstallAbsoluteSymlink(dir, file.Base(), target)
|
||||
library.postInstallCmds = append(library.postInstallCmds, makeSymlinkCmd(dirOnDevice, file.Base(), target))
|
||||
}
|
||||
|
|
|
@ -792,6 +792,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) {
|
||||
|
|
Loading…
Reference in a new issue