Move fuzzer's CollectAllSharedDependencies into GenerateAndroidBuildActions
Make rust and cc fuzzers collect their shared libraries once in GenerateAndroidBuildActions and store it for later use by the packaging singleton. Also use android.OutputFileForModule to get the paths. Together this will fix fuzzers that depend on architecture specific prebuilt shared libraries that are missing a prebuilt for an architecture when building with AllowMissingDependencies. Bug: 250918230 Test: lunch aosp_riscv64-userdebug && m ALLOW_MISSING_DEPENDENCIES=true nothing Change-Id: I154a6f3a767c883e9fe7067003615db73ee78e2d
This commit is contained in:
@@ -379,42 +379,3 @@ func (s *FuzzPackager) PreallocateSlice(ctx android.MakeVarsContext, targets str
|
||||
sort.Strings(fuzzTargets)
|
||||
ctx.Strict(targets, strings.Join(fuzzTargets, " "))
|
||||
}
|
||||
|
||||
// CollectAllSharedDependencies performs a breadth-first search over the provided module's
|
||||
// dependencies using `visitDirectDeps` to enumerate all shared library
|
||||
// dependencies. We require breadth-first expansion, as otherwise we may
|
||||
// incorrectly use the core libraries (sanitizer runtimes, libc, libdl, etc.)
|
||||
// from a dependency. This may cause issues when dependencies have explicit
|
||||
// sanitizer tags, as we may get a dependency on an unsanitized libc, etc.
|
||||
func CollectAllSharedDependencies(ctx android.SingletonContext, module android.Module, unstrippedOutputFile func(module android.Module) android.Path, isValidSharedDependency func(dependency android.Module) bool) android.Paths {
|
||||
var fringe []android.Module
|
||||
|
||||
seen := make(map[string]bool)
|
||||
|
||||
// Enumerate the first level of dependencies, as we discard all non-library
|
||||
// modules in the BFS loop below.
|
||||
ctx.VisitDirectDeps(module, func(dep android.Module) {
|
||||
if isValidSharedDependency(dep) {
|
||||
fringe = append(fringe, dep)
|
||||
}
|
||||
})
|
||||
|
||||
var sharedLibraries android.Paths
|
||||
|
||||
for i := 0; i < len(fringe); i++ {
|
||||
module := fringe[i]
|
||||
if seen[module.Name()] {
|
||||
continue
|
||||
}
|
||||
seen[module.Name()] = true
|
||||
|
||||
sharedLibraries = append(sharedLibraries, unstrippedOutputFile(module))
|
||||
ctx.VisitDirectDeps(module, func(dep android.Module) {
|
||||
if isValidSharedDependency(dep) && !seen[dep.Name()] {
|
||||
fringe = append(fringe, dep)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return sharedLibraries
|
||||
}
|
||||
|
Reference in New Issue
Block a user