aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-08-13 07:33:17 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-08-13 07:33:17 +0000
commitb690d509c71cc09de5d478ad06d532a01bf636a1 (patch)
treecc7acdf8d786078b263a1cd7f68b5bbc03b2bc8c
parent0a81d326546d738d988418ffc4e9d57cadeadfc5 (diff)
parente43392af4a95cc949c02b84dbfbe6eabb8a5c0b5 (diff)
downloadbuild_soong-b690d509c71cc09de5d478ad06d532a01bf636a1.tar.gz
build_soong-b690d509c71cc09de5d478ad06d532a01bf636a1.tar.bz2
build_soong-b690d509c71cc09de5d478ad06d532a01bf636a1.zip
release-request-68cc9b2a-98ae-4fbf-8b56-3e535855f399-for-git_oc-mr1-release-4269864 snap-temp-L25700000092502312
Change-Id: Ib1fe2d734e1bc3c131e460729c3c3e7bc211e693
-rw-r--r--cc/cc.go7
-rw-r--r--cc/compiler.go8
-rw-r--r--cc/config/global.go11
-rw-r--r--cc/library.go3
-rw-r--r--cc/makevars.go4
-rw-r--r--cc/sabi.go2
-rw-r--r--cc/util.go7
-rw-r--r--cc/vndk.go38
8 files changed, 63 insertions, 17 deletions
diff --git a/cc/cc.go b/cc/cc.go
index 0f754a66..983ffc0e 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -35,6 +35,7 @@ func init() {
android.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
ctx.BottomUp("link", linkageMutator).Parallel()
+ ctx.BottomUp("vndk", vndkMutator).Parallel()
ctx.BottomUp("image", vendorMutator).Parallel()
ctx.BottomUp("ndk_api", ndkApiMutator).Parallel()
ctx.BottomUp("test_per_src", testPerSrcMutator).Parallel()
@@ -457,7 +458,7 @@ func (ctx *moduleContextImpl) isVndkSp() bool {
// Create source abi dumps if the module belongs to the list of VndkLibraries.
func (ctx *moduleContextImpl) createVndkSourceAbiDump() bool {
- return ctx.ctx.Device() && (ctx.mod.isVndk() || inList(ctx.baseModuleName(), config.LLndkLibraries()))
+ return ctx.ctx.Device() && (ctx.mod.isVndk() || inList(ctx.baseModuleName(), llndkLibraries))
}
func (ctx *moduleContextImpl) selectedStl() string {
@@ -745,7 +746,7 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
} else {
variantLibs = append(variantLibs, entry+ndkLibrarySuffix)
}
- } else if ctx.vndk() && inList(entry, config.LLndkLibraries()) {
+ } else if ctx.vndk() && inList(entry, llndkLibraries) {
nonvariantLibs = append(nonvariantLibs, entry+llndkLibrarySuffix)
} else {
nonvariantLibs = append(nonvariantLibs, entry)
@@ -1109,7 +1110,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
case sharedDepTag, sharedExportDepTag, lateSharedDepTag:
libName := strings.TrimSuffix(name, llndkLibrarySuffix)
libName = strings.TrimPrefix(libName, "prebuilt_")
- isLLndk := inList(libName, config.LLndkLibraries())
+ isLLndk := inList(libName, llndkLibraries)
if c.vndk() && (Bool(cc.Properties.Vendor_available) || isLLndk) {
libName += vendorSuffix
}
diff --git a/cc/compiler.go b/cc/compiler.go
index cec527bf..c7fcca79 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -134,6 +134,10 @@ type BaseCompilerProperties struct {
// list of source files that should not be used to
// build the vendor variant of the C/C++ module.
Exclude_srcs []string
+
+ // List of additional cflags that should be used to build the vendor
+ // variant of the C/C++ module.
+ Cflags []string
}
}
@@ -392,6 +396,10 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags) Flag
flags.CppFlags = append([]string{"-std=" + cppStd}, flags.CppFlags...)
}
+ if ctx.vndk() {
+ flags.CFlags = append(flags.CFlags, esc(compiler.Properties.Target.Vendor.Cflags)...)
+ }
+
// We can enforce some rules more strictly in the code we own. strict
// indicates if this is code that we can be stricter with. If we have
// rules that we want to apply to *our* code (but maybe can't for
diff --git a/cc/config/global.go b/cc/config/global.go
index 65a211c6..56de3513 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -185,17 +185,6 @@ func bionicHeaders(bionicArch, kernelArch string) string {
}, " ")
}
-func VndkLibraries() []string {
- return []string{}
-}
-
-// This needs to be kept up to date with the list in system/core/rootdir/etc/ld.config.txt:
-// [vendor]
-// namespace.default.link.system.shared_libs
-func LLndkLibraries() []string {
- return []string{"libc", "libm", "libdl", "liblog", "libandroid_net", "ld-android", "libvndksupport", "libnativewindow"}
-}
-
func replaceFirst(slice []string, from, to string) {
if slice[0] != from {
panic(fmt.Errorf("Expected %q, found %q", from, to))
diff --git a/cc/library.go b/cc/library.go
index 4e3e2b39..4a173a5d 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -21,7 +21,6 @@ import (
"github.com/google/blueprint/pathtools"
"android/soong/android"
- "android/soong/cc/config"
)
type LibraryProperties struct {
@@ -621,7 +620,7 @@ func (library *libraryDecorator) linkSAbiDumpFiles(ctx ModuleContext, objs Objec
}
func vndkVsNdk(ctx ModuleContext) bool {
- if inList(ctx.baseModuleName(), config.LLndkLibraries()) {
+ if inList(ctx.baseModuleName(), llndkLibraries) {
return false
}
return true
diff --git a/cc/makevars.go b/cc/makevars.go
index 294f3e65..8bdcf9fb 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -59,6 +59,10 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
ctx.Strict("BOARD_VNDK_VERSION", "")
}
+ ctx.Strict("VNDK_CORE_LIBRARIES", strings.Join(vndkCoreLibraries, " "))
+ ctx.Strict("VNDK_SAMEPROCESS_LIBRARIES", strings.Join(vndkSpLibraries, " "))
+ ctx.Strict("LLNDK_LIBRARIES", strings.Join(llndkLibraries, " "))
+
ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS", strings.Join(asanCflags, " "))
ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS", strings.Join(asanLdflags, " "))
ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES", strings.Join(asanLibs, " "))
diff --git a/cc/sabi.go b/cc/sabi.go
index 318d1983..6f9a6e57 100644
--- a/cc/sabi.go
+++ b/cc/sabi.go
@@ -72,7 +72,7 @@ func (sabimod *sabi) flags(ctx ModuleContext, flags Flags) Flags {
func sabiDepsMutator(mctx android.TopDownMutatorContext) {
if c, ok := mctx.Module().(*Module); ok &&
- (c.isVndk() || inList(c.Name(), config.LLndkLibraries()) ||
+ (c.isVndk() || inList(c.Name(), llndkLibraries) ||
(c.sabi != nil && c.sabi.Properties.CreateSAbiDumps)) {
mctx.VisitDirectDeps(func(m blueprint.Module) {
tag := mctx.OtherModuleDependencyTag(m)
diff --git a/cc/util.go b/cc/util.go
index eeb64eb3..cc89af61 100644
--- a/cc/util.go
+++ b/cc/util.go
@@ -131,3 +131,10 @@ func addPrefix(list []string, prefix string) []string {
}
return list
}
+
+func addSuffix(list []string, suffix string) []string {
+ for i := range list {
+ list[i] = list[i] + suffix
+ }
+ return list
+}
diff --git a/cc/vndk.go b/cc/vndk.go
index fd1bdcb5..2e6ac137 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -15,6 +15,9 @@
package cc
import (
+ "strings"
+ "sync"
+
"android/soong/android"
)
@@ -96,3 +99,38 @@ func (vndk *vndkdep) vndkCheckLinkType(ctx android.ModuleContext, to *Module) {
return
}
}
+
+var (
+ vndkCoreLibraries []string
+ vndkSpLibraries []string
+ llndkLibraries []string
+ vndkLibrariesLock sync.Mutex
+)
+
+// gather list of vndk-core, vndk-sp, and ll-ndk libs
+func vndkMutator(mctx android.BottomUpMutatorContext) {
+ if m, ok := mctx.Module().(*Module); ok {
+ if _, ok := m.linker.(*llndkStubDecorator); ok {
+ vndkLibrariesLock.Lock()
+ defer vndkLibrariesLock.Unlock()
+ name := strings.TrimSuffix(m.Name(), llndkLibrarySuffix)
+ if !inList(name, llndkLibraries) {
+ llndkLibraries = append(llndkLibraries, name)
+ }
+ } else if lib, ok := m.linker.(*libraryDecorator); ok && lib.shared() {
+ if m.vndkdep.isVndk() {
+ vndkLibrariesLock.Lock()
+ defer vndkLibrariesLock.Unlock()
+ if m.vndkdep.isVndkSp() {
+ if !inList(m.Name(), vndkSpLibraries) {
+ vndkSpLibraries = append(vndkSpLibraries, m.Name())
+ }
+ } else {
+ if !inList(m.Name(), vndkCoreLibraries) {
+ vndkCoreLibraries = append(vndkCoreLibraries, m.Name())
+ }
+ }
+ }
+ }
+ }
+}