Merge "Teach soong not to duplicate the HWASAN runtime into each APEX."
am: 90b6561d5d
Change-Id: Ie730048acaa65c12927d152a80e5680a70809a7a
This commit is contained in:
11
apex/apex.go
11
apex/apex.go
@@ -521,6 +521,17 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
a.properties.Multilib.Prefer32.Binaries, target.String(),
|
a.properties.Multilib.Prefer32.Binaries, target.String(),
|
||||||
a.getImageVariation(config))
|
a.getImageVariation(config))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.HasPrefix(ctx.ModuleName(), "com.android.runtime") && target.Os.Class == android.Device {
|
||||||
|
for _, sanitizer := range ctx.Config().SanitizeDevice() {
|
||||||
|
if sanitizer == "hwaddress" {
|
||||||
|
addDependenciesForNativeModules(ctx,
|
||||||
|
[]string{"libclang_rt.hwasan-aarch64-android"},
|
||||||
|
nil, target.String(), a.getImageVariation(config))
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -440,8 +440,8 @@ func (binary *binaryDecorator) install(ctx ModuleContext, file android.Path) {
|
|||||||
// Bionic binaries (e.g. linker) is installed to the bootstrap subdirectory.
|
// Bionic binaries (e.g. linker) is installed to the bootstrap subdirectory.
|
||||||
// The original path becomes a symlink to the corresponding file in the
|
// The original path becomes a symlink to the corresponding file in the
|
||||||
// runtime APEX.
|
// runtime APEX.
|
||||||
if isBionic(ctx.baseModuleName()) && ctx.Arch().Native && ctx.apexName() == "" && !ctx.inRecovery() {
|
if installToBootstrap(ctx.baseModuleName(), ctx.Config()) && ctx.Arch().Native && ctx.apexName() == "" && !ctx.inRecovery() {
|
||||||
if ctx.Device() {
|
if ctx.Device() && isBionic(ctx.baseModuleName()) {
|
||||||
binary.installSymlinkToRuntimeApex(ctx, file)
|
binary.installSymlinkToRuntimeApex(ctx, file)
|
||||||
}
|
}
|
||||||
binary.baseInstaller.subDir = "bootstrap"
|
binary.baseInstaller.subDir = "bootstrap"
|
||||||
|
10
cc/cc.go
10
cc/cc.go
@@ -600,6 +600,9 @@ func (c *Module) HasStubsVariants() bool {
|
|||||||
if library, ok := c.linker.(*libraryDecorator); ok {
|
if library, ok := c.linker.(*libraryDecorator); ok {
|
||||||
return len(library.Properties.Stubs.Versions) > 0
|
return len(library.Properties.Stubs.Versions) > 0
|
||||||
}
|
}
|
||||||
|
if library, ok := c.linker.(*prebuiltLibraryLinker); ok {
|
||||||
|
return len(library.Properties.Stubs.Versions) > 0
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -619,6 +622,13 @@ func isBionic(name string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func installToBootstrap(name string, config android.Config) bool {
|
||||||
|
if name == "libclang_rt.hwasan-aarch64-android" {
|
||||||
|
return inList("hwaddress", config.SanitizeDevice())
|
||||||
|
}
|
||||||
|
return isBionic(name)
|
||||||
|
}
|
||||||
|
|
||||||
type baseModuleContext struct {
|
type baseModuleContext struct {
|
||||||
android.BaseContext
|
android.BaseContext
|
||||||
moduleContextImpl
|
moduleContextImpl
|
||||||
|
@@ -957,12 +957,12 @@ func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
|
|||||||
library.baseInstaller.subDir += "-" + vndkVersion
|
library.baseInstaller.subDir += "-" + vndkVersion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if len(library.Properties.Stubs.Versions) > 0 && android.DirectlyInAnyApex(ctx, ctx.ModuleName()) {
|
} else if len(library.Properties.Stubs.Versions) > 0 {
|
||||||
// Bionic libraries (e.g. libc.so) is installed to the bootstrap subdirectory.
|
// Bionic libraries (e.g. libc.so) is installed to the bootstrap subdirectory.
|
||||||
// The original path becomes a symlink to the corresponding file in the
|
// The original path becomes a symlink to the corresponding file in the
|
||||||
// runtime APEX.
|
// runtime APEX.
|
||||||
if isBionic(ctx.baseModuleName()) && !library.buildStubs() && ctx.Arch().Native && !ctx.inRecovery() {
|
if installToBootstrap(ctx.baseModuleName(), ctx.Config()) && !library.buildStubs() && ctx.Arch().Native && !ctx.inRecovery() {
|
||||||
if ctx.Device() {
|
if ctx.Device() && isBionic(ctx.baseModuleName()) {
|
||||||
library.installSymlinkToRuntimeApex(ctx, file)
|
library.installSymlinkToRuntimeApex(ctx, file)
|
||||||
}
|
}
|
||||||
library.baseInstaller.subDir = "bootstrap"
|
library.baseInstaller.subDir = "bootstrap"
|
||||||
|
@@ -96,7 +96,20 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
|
|||||||
|
|
||||||
ctx.Strict("VNDK_CORE_LIBRARIES", strings.Join(*vndkCoreLibraries(ctx.Config()), " "))
|
ctx.Strict("VNDK_CORE_LIBRARIES", strings.Join(*vndkCoreLibraries(ctx.Config()), " "))
|
||||||
ctx.Strict("VNDK_SAMEPROCESS_LIBRARIES", strings.Join(*vndkSpLibraries(ctx.Config()), " "))
|
ctx.Strict("VNDK_SAMEPROCESS_LIBRARIES", strings.Join(*vndkSpLibraries(ctx.Config()), " "))
|
||||||
ctx.Strict("LLNDK_LIBRARIES", strings.Join(*llndkLibraries(ctx.Config()), " "))
|
|
||||||
|
// Make uses LLNDK_LIBRARIES to determine which libraries to install.
|
||||||
|
// HWASAN is only part of the LL-NDK in builds in which libc depends on HWASAN.
|
||||||
|
// Therefore, by removing the library here, we cause it to only be installed if libc
|
||||||
|
// depends on it.
|
||||||
|
installedLlndkLibraries := []string{}
|
||||||
|
for _, lib := range *llndkLibraries(ctx.Config()) {
|
||||||
|
if strings.HasPrefix(lib, "libclang_rt.hwasan-") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
installedLlndkLibraries = append(installedLlndkLibraries, lib)
|
||||||
|
}
|
||||||
|
ctx.Strict("LLNDK_LIBRARIES", strings.Join(installedLlndkLibraries, " "))
|
||||||
|
|
||||||
ctx.Strict("VNDK_PRIVATE_LIBRARIES", strings.Join(*vndkPrivateLibraries(ctx.Config()), " "))
|
ctx.Strict("VNDK_PRIVATE_LIBRARIES", strings.Join(*vndkPrivateLibraries(ctx.Config()), " "))
|
||||||
ctx.Strict("VNDK_USING_CORE_VARIANT_LIBRARIES", strings.Join(*vndkUsingCoreVariantLibraries(ctx.Config()), " "))
|
ctx.Strict("VNDK_USING_CORE_VARIANT_LIBRARIES", strings.Join(*vndkUsingCoreVariantLibraries(ctx.Config()), " "))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user