aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Collingbourne2019-05-20 21:29:46 -0500
committerGerrit Code Review2019-05-20 21:29:46 -0500
commit90b6561d5d2ae198dcabd167727e06e728391b71 (patch)
tree23aad1a75f7a81adbc0497af1e178722cab2c91e
parent288a1e2957d3474ccfe95ee096441fa64ad70c24 (diff)
parent3478bb2a7fbcaaea1326a1df4a564d7ca24056ce (diff)
downloadplatform-build-soong-90b6561d5d2ae198dcabd167727e06e728391b71.tar.gz
platform-build-soong-90b6561d5d2ae198dcabd167727e06e728391b71.tar.xz
platform-build-soong-90b6561d5d2ae198dcabd167727e06e728391b71.zip
Merge "Teach soong not to duplicate the HWASAN runtime into each APEX."
-rw-r--r--apex/apex.go11
-rw-r--r--cc/binary.go4
-rw-r--r--cc/cc.go10
-rw-r--r--cc/library.go6
-rw-r--r--cc/makevars.go15
5 files changed, 40 insertions, 6 deletions
diff --git a/apex/apex.go b/apex/apex.go
index 68d0bc14..51d0718a 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -521,6 +521,17 @@ func (a *apexBundle) DepsMutator(ctx android.BottomUpMutatorContext) {
521 a.properties.Multilib.Prefer32.Binaries, target.String(), 521 a.properties.Multilib.Prefer32.Binaries, target.String(),
522 a.getImageVariation(config)) 522 a.getImageVariation(config))
523 } 523 }
524
525 if strings.HasPrefix(ctx.ModuleName(), "com.android.runtime") && target.Os.Class == android.Device {
526 for _, sanitizer := range ctx.Config().SanitizeDevice() {
527 if sanitizer == "hwaddress" {
528 addDependenciesForNativeModules(ctx,
529 []string{"libclang_rt.hwasan-aarch64-android"},
530 nil, target.String(), a.getImageVariation(config))
531 break
532 }
533 }
534 }
524 } 535 }
525 536
526 } 537 }
diff --git a/cc/binary.go b/cc/binary.go
index 51e68fcd..93d1de2d 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -440,8 +440,8 @@ func (binary *binaryDecorator) install(ctx ModuleContext, file android.Path) {
440 // Bionic binaries (e.g. linker) is installed to the bootstrap subdirectory. 440 // Bionic binaries (e.g. linker) is installed to the bootstrap subdirectory.
441 // The original path becomes a symlink to the corresponding file in the 441 // The original path becomes a symlink to the corresponding file in the
442 // runtime APEX. 442 // runtime APEX.
443 if isBionic(ctx.baseModuleName()) && ctx.Arch().Native && ctx.apexName() == "" && !ctx.inRecovery() { 443 if installToBootstrap(ctx.baseModuleName(), ctx.Config()) && ctx.Arch().Native && ctx.apexName() == "" && !ctx.inRecovery() {
444 if ctx.Device() { 444 if ctx.Device() && isBionic(ctx.baseModuleName()) {
445 binary.installSymlinkToRuntimeApex(ctx, file) 445 binary.installSymlinkToRuntimeApex(ctx, file)
446 } 446 }
447 binary.baseInstaller.subDir = "bootstrap" 447 binary.baseInstaller.subDir = "bootstrap"
diff --git a/cc/cc.go b/cc/cc.go
index a3b9a92d..786e4fd2 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -600,6 +600,9 @@ func (c *Module) HasStubsVariants() bool {
600 if library, ok := c.linker.(*libraryDecorator); ok { 600 if library, ok := c.linker.(*libraryDecorator); ok {
601 return len(library.Properties.Stubs.Versions) > 0 601 return len(library.Properties.Stubs.Versions) > 0
602 } 602 }
603 if library, ok := c.linker.(*prebuiltLibraryLinker); ok {
604 return len(library.Properties.Stubs.Versions) > 0
605 }
603 return false 606 return false
604} 607}
605 608
@@ -619,6 +622,13 @@ func isBionic(name string) bool {
619 return false 622 return false
620} 623}
621 624
625func installToBootstrap(name string, config android.Config) bool {
626 if name == "libclang_rt.hwasan-aarch64-android" {
627 return inList("hwaddress", config.SanitizeDevice())
628 }
629 return isBionic(name)
630}
631
622type baseModuleContext struct { 632type baseModuleContext struct {
623 android.BaseContext 633 android.BaseContext
624 moduleContextImpl 634 moduleContextImpl
diff --git a/cc/library.go b/cc/library.go
index 11c1d90e..7889cb19 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -957,12 +957,12 @@ func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
957 library.baseInstaller.subDir += "-" + vndkVersion 957 library.baseInstaller.subDir += "-" + vndkVersion
958 } 958 }
959 } 959 }
960 } else if len(library.Properties.Stubs.Versions) > 0 && android.DirectlyInAnyApex(ctx, ctx.ModuleName()) { 960 } else if len(library.Properties.Stubs.Versions) > 0 {
961 // Bionic libraries (e.g. libc.so) is installed to the bootstrap subdirectory. 961 // Bionic libraries (e.g. libc.so) is installed to the bootstrap subdirectory.
962 // The original path becomes a symlink to the corresponding file in the 962 // The original path becomes a symlink to the corresponding file in the
963 // runtime APEX. 963 // runtime APEX.
964 if isBionic(ctx.baseModuleName()) && !library.buildStubs() && ctx.Arch().Native && !ctx.inRecovery() { 964 if installToBootstrap(ctx.baseModuleName(), ctx.Config()) && !library.buildStubs() && ctx.Arch().Native && !ctx.inRecovery() {
965 if ctx.Device() { 965 if ctx.Device() && isBionic(ctx.baseModuleName()) {
966 library.installSymlinkToRuntimeApex(ctx, file) 966 library.installSymlinkToRuntimeApex(ctx, file)
967 } 967 }
968 library.baseInstaller.subDir = "bootstrap" 968 library.baseInstaller.subDir = "bootstrap"
diff --git a/cc/makevars.go b/cc/makevars.go
index 3c24f347..a71f479a 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -96,7 +96,20 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
96 96
97 ctx.Strict("VNDK_CORE_LIBRARIES", strings.Join(*vndkCoreLibraries(ctx.Config()), " ")) 97 ctx.Strict("VNDK_CORE_LIBRARIES", strings.Join(*vndkCoreLibraries(ctx.Config()), " "))
98 ctx.Strict("VNDK_SAMEPROCESS_LIBRARIES", strings.Join(*vndkSpLibraries(ctx.Config()), " ")) 98 ctx.Strict("VNDK_SAMEPROCESS_LIBRARIES", strings.Join(*vndkSpLibraries(ctx.Config()), " "))
99 ctx.Strict("LLNDK_LIBRARIES", strings.Join(*llndkLibraries(ctx.Config()), " ")) 99
100 // Make uses LLNDK_LIBRARIES to determine which libraries to install.
101 // HWASAN is only part of the LL-NDK in builds in which libc depends on HWASAN.
102 // Therefore, by removing the library here, we cause it to only be installed if libc
103 // depends on it.
104 installedLlndkLibraries := []string{}
105 for _, lib := range *llndkLibraries(ctx.Config()) {
106 if strings.HasPrefix(lib, "libclang_rt.hwasan-") {
107 continue
108 }
109 installedLlndkLibraries = append(installedLlndkLibraries, lib)
110 }
111 ctx.Strict("LLNDK_LIBRARIES", strings.Join(installedLlndkLibraries, " "))
112
100 ctx.Strict("VNDK_PRIVATE_LIBRARIES", strings.Join(*vndkPrivateLibraries(ctx.Config()), " ")) 113 ctx.Strict("VNDK_PRIVATE_LIBRARIES", strings.Join(*vndkPrivateLibraries(ctx.Config()), " "))
101 ctx.Strict("VNDK_USING_CORE_VARIANT_LIBRARIES", strings.Join(*vndkUsingCoreVariantLibraries(ctx.Config()), " ")) 114 ctx.Strict("VNDK_USING_CORE_VARIANT_LIBRARIES", strings.Join(*vndkUsingCoreVariantLibraries(ctx.Config()), " "))
102 115