Allow VNDK-SP extensions to use vendor lib
This commit changes the VNDK-SP dependencies check. With the commit, VNDK-SP-Ext can link to non-VNDK vendor shared libs. This commit also refines the "cc_test" so that more error handling cases are properly tested. Before this commit, VNDK-SP-Ext could not depend on vendor libs. It was disallowed because there were no correct way to load vendor libs. The fallback link had to specify the shared lib names. On the other hand, adding "/vendor/${LIB}" to search paths will lead to double-loading issue. In aosp/595067, "allow_all_shared_libs" was added to bionic dynamic linker. Now, we can link the "vndk" namespace to "sphal" namespace. Thus, like VNDK-Ext, VNDK-SP-Ext can link to vendor libs now. Bug: 77249955 Test: lunch aosp_walleye-userdebug && make -j8 # runs unit tests Test: lunch aosp_sailfish-userdebug && make -j8 # runs unit tests Test: Create a VNDK-SP-Ext, link to vendor libs, and run it. Change-Id: I5511204539a22c998528111076f46756807faf29
This commit is contained in:
37
cc/vndk.go
37
cc/vndk.go
@@ -150,22 +150,39 @@ func (vndk *vndkdep) vndkCheckLinkType(ctx android.ModuleContext, to *Module, ta
|
||||
return
|
||||
}
|
||||
|
||||
// VNDK-core and VNDK-SP must not depend on VNDK extensions.
|
||||
if (vndk.isVndk() || vndk.isVndkSp()) && !vndk.isVndkExt() && to.vndkdep.isVndkExt() {
|
||||
// Check the dependencies of VNDK shared libraries.
|
||||
if !vndkIsVndkDepAllowed(vndk, to.vndkdep) {
|
||||
ctx.ModuleErrorf("(%s) should not link to %q (%s)",
|
||||
vndk.typeName(), to.Name(), to.vndkdep.typeName())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// VNDK-core must be only depend on VNDK-SP or LL-NDK. VNDK-SP must only depend on
|
||||
// LL-NDK, regardless the extension status. VNDK-Ext may depend on vendor libraries, but
|
||||
// VNDK-SP-Ext must remain self-contained.
|
||||
if (vndk.isVndk() && !to.vndkdep.isVndk() && !vndk.isVndkExt()) ||
|
||||
(vndk.isVndkSp() && !to.vndkdep.isVndkSp()) {
|
||||
ctx.ModuleErrorf("(%s) should not link to %q (%s)",
|
||||
vndk.typeName(), to.Name(), to.vndkdep.typeName())
|
||||
return
|
||||
func vndkIsVndkDepAllowed(from *vndkdep, to *vndkdep) bool {
|
||||
// Check the dependencies of VNDK, VNDK-Ext, VNDK-SP, VNDK-SP-Ext and vendor modules.
|
||||
if from.isVndkExt() {
|
||||
if from.isVndkSp() {
|
||||
// VNDK-SP-Ext may depend on VNDK-SP, VNDK-SP-Ext, or vendor libs (excluding
|
||||
// VNDK and VNDK-Ext).
|
||||
return to.isVndkSp() || !to.isVndk()
|
||||
}
|
||||
// VNDK-Ext may depend on VNDK, VNDK-Ext, VNDK-SP, VNDK-SP-Ext, or vendor libs.
|
||||
return true
|
||||
}
|
||||
if from.isVndk() {
|
||||
if to.isVndkExt() {
|
||||
// VNDK-core and VNDK-SP must not depend on VNDK extensions.
|
||||
return false
|
||||
}
|
||||
if from.isVndkSp() {
|
||||
// VNDK-SP must only depend on VNDK-SP.
|
||||
return to.isVndkSp()
|
||||
}
|
||||
// VNDK-core may depend on VNDK-core or VNDK-SP.
|
||||
return to.isVndk()
|
||||
}
|
||||
// Vendor modules may depend on VNDK, VNDK-Ext, VNDK-SP, VNDK-SP-Ext, or vendor libs.
|
||||
return true
|
||||
}
|
||||
|
||||
var (
|
||||
|
Reference in New Issue
Block a user