Add support for no-vendor-variant VNDK
When no-vendor-variant VNDK is enabled, the vendor variant of VNDK libraries are not installed. Since not all VNDK libraries will be ready for this, we keep a list of library names in cc/vndk.go to indicate which libraries must have their vendor variants always installed regardless of whether no-vendor-variant VNDK is enabled. Also add --remove-build-id option to the strip script to facilitate the check of functional identity of the two variants. Bug: 119423884 Test: Add a dummy VNDK library and build with TARGET_VNDK_USE_CORE_VARIANT := true, with the corresponding build/make change. Change-Id: Ieb1589488690e1cef1e310669a8b47a8b8759dac
This commit is contained in:
parent
f8d3be9cb7
commit
efd249e62a
|
@ -103,6 +103,7 @@ bootstrap_go_package {
|
|||
"cc/config/global.go",
|
||||
"cc/config/tidy.go",
|
||||
"cc/config/toolchain.go",
|
||||
"cc/config/vndk.go",
|
||||
|
||||
"cc/config/arm_device.go",
|
||||
"cc/config/arm64_device.go",
|
||||
|
|
|
@ -818,6 +818,10 @@ func (c *deviceConfig) ExtraVndkVersions() []string {
|
|||
return c.config.productVariables.ExtraVndkVersions
|
||||
}
|
||||
|
||||
func (c *deviceConfig) VndkUseCoreVariant() bool {
|
||||
return Bool(c.config.productVariables.VndkUseCoreVariant)
|
||||
}
|
||||
|
||||
func (c *deviceConfig) SystemSdkVersions() []string {
|
||||
return c.config.productVariables.DeviceSystemSdkVersions
|
||||
}
|
||||
|
|
|
@ -253,6 +253,8 @@ type productVariables struct {
|
|||
|
||||
PgoAdditionalProfileDirs []string `json:",omitempty"`
|
||||
|
||||
VndkUseCoreVariant *bool `json:",omitempty"`
|
||||
|
||||
BoardVendorSepolicyDirs []string `json:",omitempty"`
|
||||
BoardOdmSepolicyDirs []string `json:",omitempty"`
|
||||
BoardPlatPublicSepolicyDirs []string `json:",omitempty"`
|
||||
|
|
|
@ -185,6 +185,12 @@ func (library *libraryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.An
|
|||
if library.coverageOutputFile.Valid() {
|
||||
fmt.Fprintln(w, "LOCAL_PREBUILT_COVERAGE_ARCHIVE :=", library.coverageOutputFile.String())
|
||||
}
|
||||
|
||||
if library.useCoreVariant {
|
||||
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
|
||||
fmt.Fprintln(w, "LOCAL_NO_NOTICE_FILE := true")
|
||||
fmt.Fprintln(w, "LOCAL_VNDK_DEPEND_ON_CORE_VARIANT := true")
|
||||
}
|
||||
})
|
||||
|
||||
if library.shared() && !library.buildStubs() {
|
||||
|
|
18
cc/cc.go
18
cc/cc.go
|
@ -266,6 +266,7 @@ type ModuleContextIntf interface {
|
|||
hasStubsVariants() bool
|
||||
isStubs() bool
|
||||
bootstrap() bool
|
||||
mustUseVendorVariant() bool
|
||||
}
|
||||
|
||||
type ModuleContext interface {
|
||||
|
@ -558,6 +559,10 @@ func (c *Module) isVndkExt() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func (c *Module) mustUseVendorVariant() bool {
|
||||
return c.isVndkSp() || inList(c.Name(), config.VndkMustUseVendorVariantList)
|
||||
}
|
||||
|
||||
func (c *Module) getVndkExtendsModuleName() string {
|
||||
if vndkdep := c.vndkdep; vndkdep != nil {
|
||||
return vndkdep.getVndkExtendsModuleName()
|
||||
|
@ -709,6 +714,10 @@ func (ctx *moduleContextImpl) isVndkExt() bool {
|
|||
return ctx.mod.isVndkExt()
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) mustUseVendorVariant() bool {
|
||||
return ctx.mod.mustUseVendorVariant()
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) inRecovery() bool {
|
||||
return ctx.mod.inRecovery()
|
||||
}
|
||||
|
@ -1769,7 +1778,12 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
|
|||
isLLndk := inList(libName, llndkLibraries)
|
||||
isVendorPublicLib := inList(libName, vendorPublicLibraries)
|
||||
bothVendorAndCoreVariantsExist := ccDep.hasVendorVariant() || isLLndk
|
||||
if c.useVndk() && bothVendorAndCoreVariantsExist {
|
||||
|
||||
if ctx.DeviceConfig().VndkUseCoreVariant() && ccDep.isVndk() && !ccDep.mustUseVendorVariant() {
|
||||
// The vendor module is a no-vendor-variant VNDK library. Depend on the
|
||||
// core module instead.
|
||||
return libName
|
||||
} else if c.useVndk() && bothVendorAndCoreVariantsExist {
|
||||
// The vendor module in Make will have been renamed to not conflict with the core
|
||||
// module, so update the dependency name here accordingly.
|
||||
return libName + vendorSuffix
|
||||
|
@ -1908,6 +1922,8 @@ func (c *Module) getMakeLinkType() string {
|
|||
// TODO(b/114741097): use the correct ndk stl once build errors have been fixed
|
||||
//family, link := getNdkStlFamilyAndLinkType(c)
|
||||
//return fmt.Sprintf("native:ndk:%s:%s", family, link)
|
||||
} else if inList(c.Name(), vndkUsingCoreVariantLibraries) {
|
||||
return "native:platform_vndk"
|
||||
} else {
|
||||
return "native:platform"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,157 @@
|
|||
// Copyright 2019 Google Inc. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package config
|
||||
|
||||
// List of VNDK libraries that have different core variant and vendor variant.
|
||||
// For these libraries, the vendor variants must be installed even if the device
|
||||
// has VndkUseCoreVariant set.
|
||||
var VndkMustUseVendorVariantList = []string{
|
||||
"android.frameworks.sensorservice@1.0",
|
||||
"android.hardware.atrace@1.0",
|
||||
"android.hardware.audio.common@5.0",
|
||||
"android.hardware.audio.effect@2.0",
|
||||
"android.hardware.audio.effect@4.0",
|
||||
"android.hardware.audio.effect@5.0",
|
||||
"android.hardware.audio@2.0",
|
||||
"android.hardware.audio@4.0",
|
||||
"android.hardware.audio@5.0",
|
||||
"android.hardware.automotive.evs@1.0",
|
||||
"android.hardware.automotive.vehicle@2.0",
|
||||
"android.hardware.bluetooth.audio@2.0",
|
||||
"android.hardware.boot@1.0",
|
||||
"android.hardware.broadcastradio@1.0",
|
||||
"android.hardware.broadcastradio@1.1",
|
||||
"android.hardware.broadcastradio@2.0",
|
||||
"android.hardware.camera.device@1.0",
|
||||
"android.hardware.camera.device@3.2",
|
||||
"android.hardware.camera.device@3.3",
|
||||
"android.hardware.camera.device@3.4",
|
||||
"android.hardware.camera.provider@2.4",
|
||||
"android.hardware.cas.native@1.0",
|
||||
"android.hardware.cas@1.0",
|
||||
"android.hardware.configstore@1.0",
|
||||
"android.hardware.configstore@1.1",
|
||||
"android.hardware.contexthub@1.0",
|
||||
"android.hardware.drm@1.0",
|
||||
"android.hardware.drm@1.1",
|
||||
"android.hardware.fastboot@1.0",
|
||||
"android.hardware.gatekeeper@1.0",
|
||||
"android.hardware.gnss@1.0",
|
||||
"android.hardware.graphics.allocator@2.0",
|
||||
"android.hardware.graphics.bufferqueue@1.0",
|
||||
"android.hardware.graphics.composer@2.1",
|
||||
"android.hardware.graphics.composer@2.2",
|
||||
"android.hardware.health@1.0",
|
||||
"android.hardware.health@2.0",
|
||||
"android.hardware.ir@1.0",
|
||||
"android.hardware.keymaster@3.0",
|
||||
"android.hardware.keymaster@4.0",
|
||||
"android.hardware.light@2.0",
|
||||
"android.hardware.media.bufferpool@1.0",
|
||||
"android.hardware.media.omx@1.0",
|
||||
"android.hardware.memtrack@1.0",
|
||||
"android.hardware.neuralnetworks@1.0",
|
||||
"android.hardware.neuralnetworks@1.1",
|
||||
"android.hardware.neuralnetworks@1.2",
|
||||
"android.hardware.nfc@1.1",
|
||||
"android.hardware.nfc@1.2",
|
||||
"android.hardware.oemlock@1.0",
|
||||
"android.hardware.power.stats@1.0",
|
||||
"android.hardware.power@1.0",
|
||||
"android.hardware.power@1.1",
|
||||
"android.hardware.radio@1.4",
|
||||
"android.hardware.secure_element@1.0",
|
||||
"android.hardware.sensors@1.0",
|
||||
"android.hardware.soundtrigger@2.0",
|
||||
"android.hardware.soundtrigger@2.0-core",
|
||||
"android.hardware.soundtrigger@2.1",
|
||||
"android.hardware.tetheroffload.config@1.0",
|
||||
"android.hardware.tetheroffload.control@1.0",
|
||||
"android.hardware.thermal@1.0",
|
||||
"android.hardware.tv.cec@1.0",
|
||||
"android.hardware.tv.input@1.0",
|
||||
"android.hardware.vibrator@1.0",
|
||||
"android.hardware.vibrator@1.1",
|
||||
"android.hardware.vibrator@1.2",
|
||||
"android.hardware.weaver@1.0",
|
||||
"android.hardware.wifi.hostapd@1.0",
|
||||
"android.hardware.wifi.offload@1.0",
|
||||
"android.hardware.wifi.supplicant@1.0",
|
||||
"android.hardware.wifi.supplicant@1.1",
|
||||
"android.hardware.wifi@1.0",
|
||||
"android.hardware.wifi@1.1",
|
||||
"android.hardware.wifi@1.2",
|
||||
"android.hardwareundtrigger@2.0",
|
||||
"android.hardwareundtrigger@2.0-core",
|
||||
"android.hardwareundtrigger@2.1",
|
||||
"android.hidl.allocator@1.0",
|
||||
"android.hidl.token@1.0",
|
||||
"android.hidl.token@1.0-utils",
|
||||
"android.system.net.netd@1.0",
|
||||
"android.system.wifi.keystore@1.0",
|
||||
"libaudioroute",
|
||||
"libaudioutils",
|
||||
"libbinder",
|
||||
"libcamera_metadata",
|
||||
"libcrypto",
|
||||
"libdiskconfig",
|
||||
"libdumpstateutil",
|
||||
"libexpat",
|
||||
"libfmq",
|
||||
"libgui",
|
||||
"libhidlcache",
|
||||
"libmedia_helper",
|
||||
"libmedia_omx",
|
||||
"libmemtrack",
|
||||
"libnetutils",
|
||||
"libpuresoftkeymasterdevice",
|
||||
"libradio_metadata",
|
||||
"libselinux",
|
||||
"libsoftkeymasterdevice",
|
||||
"libsqlite",
|
||||
"libssl",
|
||||
"libstagefright_bufferqueue_helper",
|
||||
"libstagefright_flacdec",
|
||||
"libstagefright_foundation",
|
||||
"libstagefright_omx",
|
||||
"libstagefright_omx_utils",
|
||||
"libstagefright_soft_aacdec",
|
||||
"libstagefright_soft_aacenc",
|
||||
"libstagefright_soft_amrdec",
|
||||
"libstagefright_soft_amrnbenc",
|
||||
"libstagefright_soft_amrwbenc",
|
||||
"libstagefright_soft_avcdec",
|
||||
"libstagefright_soft_avcenc",
|
||||
"libstagefright_soft_flacdec",
|
||||
"libstagefright_soft_flacenc",
|
||||
"libstagefright_soft_g711dec",
|
||||
"libstagefright_soft_gsmdec",
|
||||
"libstagefright_soft_hevcdec",
|
||||
"libstagefright_soft_mp3dec",
|
||||
"libstagefright_soft_mpeg2dec",
|
||||
"libstagefright_soft_mpeg4dec",
|
||||
"libstagefright_soft_mpeg4enc",
|
||||
"libstagefright_soft_opusdec",
|
||||
"libstagefright_soft_rawdec",
|
||||
"libstagefright_soft_vorbisdec",
|
||||
"libstagefright_soft_vpxdec",
|
||||
"libstagefright_soft_vpxenc",
|
||||
"libstagefright_xmlparser",
|
||||
"libsysutils",
|
||||
"libui",
|
||||
"libvorbisidec",
|
||||
"libxml2",
|
||||
"libziparchive",
|
||||
}
|
|
@ -293,6 +293,10 @@ type libraryDecorator struct {
|
|||
|
||||
post_install_cmds []string
|
||||
|
||||
// If useCoreVariant is true, the vendor variant of a VNDK library is
|
||||
// not installed.
|
||||
useCoreVariant bool
|
||||
|
||||
// Decorated interafaces
|
||||
*baseCompiler
|
||||
*baseLinker
|
||||
|
@ -914,6 +918,9 @@ func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) {
|
|||
if ctx.isVndkSp() {
|
||||
library.baseInstaller.subDir = "vndk-sp"
|
||||
} else if ctx.isVndk() {
|
||||
if ctx.DeviceConfig().VndkUseCoreVariant() && !ctx.mustUseVendorVariant() {
|
||||
library.useCoreVariant = true
|
||||
}
|
||||
library.baseInstaller.subDir = "vndk"
|
||||
}
|
||||
|
||||
|
|
|
@ -97,6 +97,7 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
|
|||
ctx.Strict("VNDK_SAMEPROCESS_LIBRARIES", strings.Join(vndkSpLibraries, " "))
|
||||
ctx.Strict("LLNDK_LIBRARIES", strings.Join(llndkLibraries, " "))
|
||||
ctx.Strict("VNDK_PRIVATE_LIBRARIES", strings.Join(vndkPrivateLibraries, " "))
|
||||
ctx.Strict("VNDK_USING_CORE_VARIANT_LIBRARIES", strings.Join(vndkUsingCoreVariantLibraries, " "))
|
||||
|
||||
// Filter vendor_public_library that are exported to make
|
||||
exportedVendorPublicLibraries := []string{}
|
||||
|
|
|
@ -21,6 +21,7 @@ import (
|
|||
"sync"
|
||||
|
||||
"android/soong/android"
|
||||
"android/soong/cc/config"
|
||||
)
|
||||
|
||||
type VndkProperties struct {
|
||||
|
@ -195,6 +196,7 @@ var (
|
|||
vndkSpLibraries []string
|
||||
llndkLibraries []string
|
||||
vndkPrivateLibraries []string
|
||||
vndkUsingCoreVariantLibraries []string
|
||||
vndkLibrariesLock sync.Mutex
|
||||
)
|
||||
|
||||
|
@ -223,6 +225,12 @@ func VndkMutator(mctx android.BottomUpMutatorContext) {
|
|||
if m.vndkdep.isVndk() && !m.vndkdep.isVndkExt() {
|
||||
vndkLibrariesLock.Lock()
|
||||
defer vndkLibrariesLock.Unlock()
|
||||
if mctx.DeviceConfig().VndkUseCoreVariant() && !inList(name, config.VndkMustUseVendorVariantList) {
|
||||
if !inList(name, vndkUsingCoreVariantLibraries) {
|
||||
vndkUsingCoreVariantLibraries = append(vndkUsingCoreVariantLibraries, name)
|
||||
sort.Strings(vndkUsingCoreVariantLibraries)
|
||||
}
|
||||
}
|
||||
if m.vndkdep.isVndkSp() {
|
||||
if !inList(name, vndkSpLibraries) {
|
||||
vndkSpLibraries = append(vndkSpLibraries, name)
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
# --keep-mini-debug-info
|
||||
# --keep-symbols
|
||||
# --use-gnu-strip
|
||||
# --remove-build-id
|
||||
|
||||
set -o pipefail
|
||||
|
||||
|
@ -41,6 +42,7 @@ Options:
|
|||
--keep-mini-debug-info Keep compressed debug info in out-file
|
||||
--keep-symbols Keep symbols in out-file
|
||||
--use-gnu-strip Use strip/objcopy instead of llvm-{strip,objcopy}
|
||||
--remove-build-id Remove the gnu build-id section in out-file
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
@ -110,6 +112,16 @@ do_add_gnu_debuglink() {
|
|||
fi
|
||||
}
|
||||
|
||||
do_remove_build_id() {
|
||||
if [ -z "${use_gnu_strip}" ]; then
|
||||
"${CLANG_BIN}/llvm-strip" -remove-section=.note.gnu.build-id "${outfile}.tmp" -o "${outfile}.tmp.no-build-id"
|
||||
else
|
||||
"${CROSS_COMPILE}strip" --remove-section=.note.gnu.build-id "${outfile}.tmp" -o "${outfile}.tmp.no-build-id"
|
||||
fi
|
||||
rm -f "${outfile}.tmp"
|
||||
mv "${outfile}.tmp.no-build-id" "${outfile}.tmp"
|
||||
}
|
||||
|
||||
while getopts $OPTSTRING opt; do
|
||||
case "$opt" in
|
||||
d) depsfile="${OPTARG}" ;;
|
||||
|
@ -120,7 +132,7 @@ while getopts $OPTSTRING opt; do
|
|||
add-gnu-debuglink) add_gnu_debuglink=true ;;
|
||||
keep-mini-debug-info) keep_mini_debug_info=true ;;
|
||||
keep-symbols) keep_symbols=true ;;
|
||||
use-gnu-strip) use_gnu_strip=true ;;
|
||||
remove-build-id) remove_build_id=true ;;
|
||||
*) echo "Unknown option --${OPTARG}"; usage ;;
|
||||
esac;;
|
||||
?) usage ;;
|
||||
|
@ -167,6 +179,10 @@ if [ ! -z "${add_gnu_debuglink}" ]; then
|
|||
do_add_gnu_debuglink
|
||||
fi
|
||||
|
||||
if [ ! -z "${remove_build_id}" ]; then
|
||||
do_remove_build_id
|
||||
fi
|
||||
|
||||
rm -f "${outfile}"
|
||||
mv "${outfile}.tmp" "${outfile}"
|
||||
|
||||
|
|
Loading…
Reference in New Issue