aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiyong Park <jiyong@google.com>2017-07-18 13:23:39 +0900
committerJiyong Park <jiyong@google.com>2017-07-27 09:47:00 +0900
commit5bc738115e36ef0800f637abfc1b1bddab18024e (patch)
treea0f2ad9fe4199bc60caef64ae5d0059ca0d287b2
parent2c44fdf8a2a0434b71cbd9a37e44b20766e6a559 (diff)
downloadbuild_soong-5bc738115e36ef0800f637abfc1b1bddab18024e.tar.gz
build_soong-5bc738115e36ef0800f637abfc1b1bddab18024e.tar.bz2
build_soong-5bc738115e36ef0800f637abfc1b1bddab18024e.zip
.vendor suffix is added only for libs having core/vendor variants
When the lib is vendor-only, then .vendor suffix is not added. Furthermore, this change correctly adds .vendor suffix even to the names listed in LOCAL_SHARED_LIBRARIES so that we don't need to add the suffix in the make world. This also allows us to use the original name (without the .vendor suffix) of the vendor-only modules in make (e.g. in PRODUCT_PACKAGES or as a make target). Bug: 37480243 Test: BOARD_VNDK_VERSION=current m -j <name> is successful, where <name> is one of the vendor-only libraries in Soong. (i.e. android.hardware.renderscript@1.0-impl) Test: m -j does not break anything Merged-In: I203e546ff941878a40c5e7cfbb9f70b617df272d Change-Id: I203e546ff941878a40c5e7cfbb9f70b617df272d (cherry picked from commit 27b188bc86dae9d5756d83906955b8111218fac1)
-rw-r--r--cc/androidmk.go10
-rw-r--r--cc/cc.go23
-rw-r--r--cc/sanitize.go15
3 files changed, 39 insertions, 9 deletions
diff --git a/cc/androidmk.go b/cc/androidmk.go
index a92a95c0..940e7c77 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -23,6 +23,10 @@ import (
"android/soong/android"
)
+var (
+ vendorSuffix = ".vendor"
+)
+
type AndroidMkContext interface {
Target() android.Target
subAndroidMk(*android.AndroidMkData, interface{})
@@ -81,8 +85,10 @@ func (c *Module) AndroidMk() (ret android.AndroidMkData, err error) {
}
c.subAndroidMk(&ret, c.installer)
- if c.vndk() {
- ret.SubName += ".vendor"
+ if c.vndk() && Bool(c.Properties.Vendor_available) {
+ // .vendor suffix is added only when we will have two variants: core and vendor.
+ // The suffix is not added for vendor-only module.
+ ret.SubName += vendorSuffix
}
return ret, nil
diff --git a/cc/cc.go b/cc/cc.go
index 3824a3be..5de5ea9c 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -720,9 +720,6 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
deps := c.deps(ctx)
- c.Properties.AndroidMkSharedLibs = append(c.Properties.AndroidMkSharedLibs, deps.SharedLibs...)
- c.Properties.AndroidMkSharedLibs = append(c.Properties.AndroidMkSharedLibs, deps.LateSharedLibs...)
-
variantNdkLibs := []string{}
variantLateNdkLibs := []string{}
if ctx.Os() == android.Android {
@@ -1101,6 +1098,26 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
}
*depPtr = append(*depPtr, dep.Path())
}
+
+ // Export the shared libs to the make world. In doing so, .vendor suffix
+ // is added if the lib has both core and vendor variants and this module
+ // is building against vndk. This is because the vendor variant will be
+ // have .vendor suffix in its name in the make world. However, if the
+ // lib is a vendor-only lib or this lib is not building against vndk,
+ // then the suffix is not added.
+ switch tag {
+ case sharedDepTag, sharedExportDepTag, lateSharedDepTag:
+ libName := strings.TrimSuffix(name, llndkLibrarySuffix)
+ libName = strings.TrimPrefix(libName, "prebuilt_")
+ isLLndk := inList(libName, config.LLndkLibraries())
+ if c.vndk() && (Bool(cc.Properties.Vendor_available) || isLLndk) {
+ libName += vendorSuffix
+ }
+ // Note: the order of libs in this list is not important because
+ // they merely serve as dependencies in the make world and do not
+ // affect this lib itself.
+ c.Properties.AndroidMkSharedLibs = append(c.Properties.AndroidMkSharedLibs, libName)
+ }
})
// Dedup exported flags from dependencies
diff --git a/cc/sanitize.go b/cc/sanitize.go
index eccd2558..916fe718 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -116,7 +116,8 @@ type SanitizeProperties struct {
type sanitize struct {
Properties SanitizeProperties
- runtimeLibrary string
+ runtimeLibrary string
+ androidMkRuntimeLibrary string
}
func (sanitize *sanitize) props() []interface{} {
@@ -422,12 +423,18 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
runtimeLibrary = config.UndefinedBehaviorSanitizerRuntimeLibrary(ctx.toolchain())
}
- // ASan runtime library must be the first in the link order.
if runtimeLibrary != "" {
+ // ASan runtime library must be the first in the link order.
flags.libFlags = append([]string{
"${config.ClangAsanLibDir}/" + runtimeLibrary + ctx.toolchain().ShlibSuffix(),
}, flags.libFlags...)
sanitize.runtimeLibrary = runtimeLibrary
+
+ // When linking against VNDK, use the vendor variant of the runtime lib
+ sanitize.androidMkRuntimeLibrary = sanitize.runtimeLibrary
+ if ctx.vndk() {
+ sanitize.androidMkRuntimeLibrary = sanitize.runtimeLibrary + vendorSuffix
+ }
}
blacklist := android.OptionalPathForModuleSrc(ctx, sanitize.Properties.Sanitize.Blacklist)
@@ -441,8 +448,8 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
func (sanitize *sanitize) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkData) {
ret.Extra = append(ret.Extra, func(w io.Writer, outputFile android.Path) error {
- if sanitize.runtimeLibrary != "" {
- fmt.Fprintln(w, "LOCAL_SHARED_LIBRARIES += "+sanitize.runtimeLibrary)
+ if sanitize.androidMkRuntimeLibrary != "" {
+ fmt.Fprintln(w, "LOCAL_SHARED_LIBRARIES += "+sanitize.androidMkRuntimeLibrary)
}
return nil