Merge "Adjust the double loadable check"
This commit is contained in:
24
cc/cc.go
24
cc/cc.go
@@ -2336,10 +2336,18 @@ func checkDoubleLoadableLibraries(ctx android.TopDownMutatorContext) {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These dependencies are not excercised at runtime. Tracking these will give us
|
||||||
|
// false negative, so skip.
|
||||||
depTag := ctx.OtherModuleDependencyTag(child)
|
depTag := ctx.OtherModuleDependencyTag(child)
|
||||||
if IsHeaderDepTag(depTag) {
|
if IsHeaderDepTag(depTag) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if depTag == staticVariantTag {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if depTag == stubImplDepTag {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// Even if target lib has no vendor variant, keep checking dependency
|
// Even if target lib has no vendor variant, keep checking dependency
|
||||||
// graph in case it depends on vendor_available or product_available
|
// graph in case it depends on vendor_available or product_available
|
||||||
@@ -2348,22 +2356,24 @@ func checkDoubleLoadableLibraries(ctx android.TopDownMutatorContext) {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if to.isVndkSp() || to.IsLlndk() || Bool(to.VendorProperties.Double_loadable) {
|
// The happy path. Keep tracking dependencies until we hit a non double-loadable
|
||||||
|
// one.
|
||||||
|
if Bool(to.VendorProperties.Double_loadable) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if to.isVndkSp() || to.IsLlndk() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
var stringPath []string
|
|
||||||
for _, m := range ctx.GetWalkPath() {
|
|
||||||
stringPath = append(stringPath, m.Name())
|
|
||||||
}
|
|
||||||
ctx.ModuleErrorf("links a library %q which is not LL-NDK, "+
|
ctx.ModuleErrorf("links a library %q which is not LL-NDK, "+
|
||||||
"VNDK-SP, or explicitly marked as 'double_loadable:true'. "+
|
"VNDK-SP, or explicitly marked as 'double_loadable:true'. "+
|
||||||
"(dependency: %s)", ctx.OtherModuleName(to), strings.Join(stringPath, " -> "))
|
"Dependency list: %s", ctx.OtherModuleName(to), ctx.GetPathString(false))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if module, ok := ctx.Module().(*Module); ok {
|
if module, ok := ctx.Module().(*Module); ok {
|
||||||
if lib, ok := module.linker.(*libraryDecorator); ok && lib.shared() {
|
if lib, ok := module.linker.(*libraryDecorator); ok && lib.shared() {
|
||||||
if lib.hasLLNDKStubs() || Bool(module.VendorProperties.Double_loadable) {
|
if lib.hasLLNDKStubs() {
|
||||||
ctx.WalkDeps(check)
|
ctx.WalkDeps(check)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2022,64 +2022,6 @@ func TestDoubleLoadableDepError(t *testing.T) {
|
|||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
// Check whether an error is emitted when a double_loadable lib depends on a non-double_loadable vendor_available lib.
|
|
||||||
testCcError(t, "module \".*\" variant \".*\": link.* \".*\" which is not LL-NDK, VNDK-SP, .*double_loadable", `
|
|
||||||
cc_library {
|
|
||||||
name: "libdoubleloadable",
|
|
||||||
vendor_available: true,
|
|
||||||
double_loadable: true,
|
|
||||||
shared_libs: ["libnondoubleloadable"],
|
|
||||||
}
|
|
||||||
|
|
||||||
cc_library {
|
|
||||||
name: "libnondoubleloadable",
|
|
||||||
vendor_available: true,
|
|
||||||
}
|
|
||||||
`)
|
|
||||||
|
|
||||||
// Check whether an error is emitted when a double_loadable lib depends on a non-double_loadable VNDK lib.
|
|
||||||
testCcError(t, "module \".*\" variant \".*\": link.* \".*\" which is not LL-NDK, VNDK-SP, .*double_loadable", `
|
|
||||||
cc_library {
|
|
||||||
name: "libdoubleloadable",
|
|
||||||
vendor_available: true,
|
|
||||||
double_loadable: true,
|
|
||||||
shared_libs: ["libnondoubleloadable"],
|
|
||||||
}
|
|
||||||
|
|
||||||
cc_library {
|
|
||||||
name: "libnondoubleloadable",
|
|
||||||
vendor_available: true,
|
|
||||||
product_available: true,
|
|
||||||
vndk: {
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
`)
|
|
||||||
|
|
||||||
// Check whether an error is emitted when a double_loadable VNDK depends on a non-double_loadable VNDK private lib.
|
|
||||||
testCcError(t, "module \".*\" variant \".*\": link.* \".*\" which is not LL-NDK, VNDK-SP, .*double_loadable", `
|
|
||||||
cc_library {
|
|
||||||
name: "libdoubleloadable",
|
|
||||||
vendor_available: true,
|
|
||||||
product_available: true,
|
|
||||||
vndk: {
|
|
||||||
enabled: true,
|
|
||||||
},
|
|
||||||
double_loadable: true,
|
|
||||||
shared_libs: ["libnondoubleloadable"],
|
|
||||||
}
|
|
||||||
|
|
||||||
cc_library {
|
|
||||||
name: "libnondoubleloadable",
|
|
||||||
vendor_available: true,
|
|
||||||
product_available: true,
|
|
||||||
vndk: {
|
|
||||||
enabled: true,
|
|
||||||
private: true,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
`)
|
|
||||||
|
|
||||||
// Check whether an error is emitted when a LLNDK depends on a non-double_loadable indirectly.
|
// Check whether an error is emitted when a LLNDK depends on a non-double_loadable indirectly.
|
||||||
testCcError(t, "module \".*\" variant \".*\": link.* \".*\" which is not LL-NDK, VNDK-SP, .*double_loadable", `
|
testCcError(t, "module \".*\" variant \".*\": link.* \".*\" which is not LL-NDK, VNDK-SP, .*double_loadable", `
|
||||||
cc_library {
|
cc_library {
|
||||||
@@ -2104,6 +2046,29 @@ func TestDoubleLoadableDepError(t *testing.T) {
|
|||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
// The error is not from 'client' but from 'libllndk'
|
||||||
|
testCcError(t, "module \"libllndk\".* links a library \"libnondoubleloadable\".*double_loadable", `
|
||||||
|
cc_library {
|
||||||
|
name: "client",
|
||||||
|
vendor_available: true,
|
||||||
|
double_loadable: true,
|
||||||
|
shared_libs: ["libllndk"],
|
||||||
|
}
|
||||||
|
cc_library {
|
||||||
|
name: "libllndk",
|
||||||
|
shared_libs: ["libnondoubleloadable"],
|
||||||
|
llndk_stubs: "libllndk.llndk",
|
||||||
|
}
|
||||||
|
llndk_library {
|
||||||
|
name: "libllndk.llndk",
|
||||||
|
symbol_file: "",
|
||||||
|
}
|
||||||
|
cc_library {
|
||||||
|
name: "libnondoubleloadable",
|
||||||
|
vendor_available: true,
|
||||||
|
}
|
||||||
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCheckVndkMembershipBeforeDoubleLoadable(t *testing.T) {
|
func TestCheckVndkMembershipBeforeDoubleLoadable(t *testing.T) {
|
||||||
|
Reference in New Issue
Block a user