From 9875edb04f939727b431d0645d20c9a986c517cd Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Fri, 16 Jun 2017 12:03:55 +0900 Subject: add exclude_shared_libs for vendor_available:true libs Adding a mechanism to conditionally exclude some shared library dependencies when a lib is built for vendors. Without this, some libraries cannot be earily marked as vendor_available if they are depending on shared libs can shouldn't be marked as vendor_available. By using exclude_shared_libs with exclude_srcs (or __ANDROID_VNDK__ macro), we can eliminate the unnecessary dependency for vendors. Bug: 62471389 Test: build (cherry picked from commit 44cf1a777916fbe2dc03760b0f2076c4cd3a0f63) Merged-In: If94277b45c3769223cea371d0028e75277640356 Change-Id: If94277b45c3769223cea371d0028e75277640356 --- cc/linker.go | 12 ++++++++++++ cc/util.go | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/cc/linker.go b/cc/linker.go index 5a3b4781..2c391320 100644 --- a/cc/linker.go +++ b/cc/linker.go @@ -87,6 +87,14 @@ type BaseLinkerProperties struct { // group static libraries. This can resolve missing symbols issues with interdependencies // between static libraries, but it is generally better to order them correctly instead. Group_static_libs *bool `android:"arch_variant"` + + Target struct { + Vendor struct { + // list of shared libs that should not be used to build + // the vendor variant of the C/C++ module. + Exclude_shared_libs []string + } + } } func NewBaseLinker() *baseLinker { @@ -123,6 +131,10 @@ func (linker *baseLinker) linkerDeps(ctx BaseModuleContext, deps Deps) Deps { deps.StaticLibs = append(deps.StaticLibs, linker.Properties.Static_libs...) deps.SharedLibs = append(deps.SharedLibs, linker.Properties.Shared_libs...) + if ctx.vndk() { + deps.SharedLibs = removeListFromList(deps.SharedLibs, linker.Properties.Target.Vendor.Exclude_shared_libs) + } + deps.ReexportHeaderLibHeaders = append(deps.ReexportHeaderLibHeaders, linker.Properties.Export_header_lib_headers...) deps.ReexportStaticLibHeaders = append(deps.ReexportStaticLibHeaders, linker.Properties.Export_static_lib_headers...) deps.ReexportSharedLibHeaders = append(deps.ReexportSharedLibHeaders, linker.Properties.Export_shared_lib_headers...) diff --git a/cc/util.go b/cc/util.go index 2febb57c..50fb332f 100644 --- a/cc/util.go +++ b/cc/util.go @@ -66,6 +66,16 @@ func filterList(list []string, filter []string) (remainder []string, filtered [] return } +func removeListFromList(list []string, filter_out []string) (result []string) { + result = make([]string, 0, len(list)) + for _, l := range list { + if !inList(l, filter_out) { + result = append(result, l) + } + } + return +} + func removeFromList(s string, list []string) (bool, []string) { i := indexList(s, list) if i != -1 { -- cgit v1.2.3 From 98b16c3aba9ee1ac8e93df58f36d881800dae1b7 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Wed, 21 Jun 2017 12:03:08 +0900 Subject: Register libnativewindow as llndk libnativewindow was defined as llndk but has not been built as such because the name of the lib was missing in LLndkLibraries list. Bug: 37488074 Test: BOARD_VNDK_VERSION=current m -j libnativewindow Change-Id: I37f03972ef37da816efc33eee12540b9980a9a38 --- cc/config/global.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cc/config/global.go b/cc/config/global.go index 5a669987..2e16068c 100644 --- a/cc/config/global.go +++ b/cc/config/global.go @@ -193,7 +193,7 @@ func VndkLibraries() []string { // [vendor] // namespace.default.link.system.shared_libs func LLndkLibraries() []string { - return []string{"libc", "libm", "libdl", "liblog", "libandroid_net", "ld-android", "libvndksupport"} + return []string{"libc", "libm", "libdl", "liblog", "libandroid_net", "ld-android", "libvndksupport", "libnativewindow"} } func replaceFirst(slice []string, from, to string) { -- cgit v1.2.3