Adjust the double loadable check

The check no longer tracks private dependencies like stubImplDepTag and
staticVariantTag. It also doesn't do the check for double_loadable
libraries that are not depended on by a LLNDK library.

Bug: N/A
Test: m
Test: add 'double_loadable: true, gen_trace: true` to an aidl_interface
module. The build doesn't break.

Change-Id: Iccd1a9d445a48d03c373708ba1bdd34b9a7f152d
This commit is contained in:
Jiyong Park
2021-01-14 14:26:06 +09:00
parent 66f7fdd1c8
commit 0474e1f677
2 changed files with 40 additions and 65 deletions

View File

@@ -2323,10 +2323,18 @@ func checkDoubleLoadableLibraries(ctx android.TopDownMutatorContext) {
return false
}
// These dependencies are not excercised at runtime. Tracking these will give us
// false negative, so skip.
depTag := ctx.OtherModuleDependencyTag(child)
if IsHeaderDepTag(depTag) {
return false
}
if depTag == staticVariantTag {
return false
}
if depTag == stubImplDepTag {
return false
}
// Even if target lib has no vendor variant, keep checking dependency
// graph in case it depends on vendor_available or product_available
@@ -2335,22 +2343,24 @@ func checkDoubleLoadableLibraries(ctx android.TopDownMutatorContext) {
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
}
var stringPath []string
for _, m := range ctx.GetWalkPath() {
stringPath = append(stringPath, m.Name())
}
ctx.ModuleErrorf("links a library %q which is not LL-NDK, "+
"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
}
if module, ok := ctx.Module().(*Module); ok {
if lib, ok := module.linker.(*libraryDecorator); ok && lib.shared() {
if lib.hasLLNDKStubs() || Bool(module.VendorProperties.Double_loadable) {
if lib.hasLLNDKStubs() {
ctx.WalkDeps(check)
}
}