Add two more vendor-specific properties

target.vendor.exclude_static_libs: this is the static counterpart of
target.vendor.exclude_shared_libs. This removes the libs from the static
dependency when build the vendor variant.

target.vendor.version_script: vendor-specific version script.

Right now, these are required to merge libseliux_vendor into libselinux
and make it vendor_avaialble:true. libselinux is using libpackageparser
which is a platform-only library. The vendor variant of libselinux can't
depend on the library.

Bug: 66914194
Test: lunch aosp_arm64_ab-userdebug; m libselinux.vendor

Change-Id: I163e634f2f54d419f9471a585a3b04731b63f809
This commit is contained in:
Jiyong Park
2017-10-13 09:17:01 +09:00
parent e87ae20e25
commit 52d25bd812
2 changed files with 21 additions and 1 deletions

View File

@@ -64,6 +64,12 @@ type LibraryProperties struct {
// export headers generated from .proto sources
Export_proto_headers bool
}
Target struct {
Vendor struct {
// version script for this vendor variant
Version_script *string `android:"arch_variant"`
}
}
}
type LibraryMutatedProperties struct {
@@ -455,7 +461,11 @@ func (library *libraryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps {
deps.StaticLibs = append(deps.StaticLibs, library.Properties.Shared.Static_libs...)
deps.SharedLibs = append(deps.SharedLibs, library.Properties.Shared.Shared_libs...)
}
if ctx.useVndk() {
deps.WholeStaticLibs = removeListFromList(deps.WholeStaticLibs, library.baseLinker.Properties.Target.Vendor.Exclude_static_libs)
deps.SharedLibs = removeListFromList(deps.SharedLibs, library.baseLinker.Properties.Target.Vendor.Exclude_shared_libs)
deps.StaticLibs = removeListFromList(deps.StaticLibs, library.baseLinker.Properties.Target.Vendor.Exclude_static_libs)
}
return deps
}
@@ -491,6 +501,9 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
unexportedSymbols := android.OptionalPathForModuleSrc(ctx, library.Properties.Unexported_symbols_list)
forceNotWeakSymbols := android.OptionalPathForModuleSrc(ctx, library.Properties.Force_symbols_not_weak_list)
forceWeakSymbols := android.OptionalPathForModuleSrc(ctx, library.Properties.Force_symbols_weak_list)
if ctx.useVndk() && library.Properties.Target.Vendor.Version_script != nil {
versionScript = android.OptionalPathForModuleSrc(ctx, library.Properties.Target.Vendor.Version_script)
}
if !ctx.Darwin() {
if versionScript.Valid() {
flags.LdFlags = append(flags.LdFlags, "-Wl,--version-script,"+versionScript.String())