Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 1 | // Copyright 2016 Google Inc. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package cc |
| 16 | |
| 17 | import ( |
Mitch Phillips | 4de896e | 2019-08-28 16:04:36 -0700 | [diff] [blame] | 18 | "path/filepath" |
Mitch Phillips | e1ee1a1 | 2019-10-17 19:20:41 -0700 | [diff] [blame] | 19 | "sort" |
Mitch Phillips | a0a5e19 | 2019-09-27 14:00:06 -0700 | [diff] [blame] | 20 | "strings" |
Mitch Phillips | 4de896e | 2019-08-28 16:04:36 -0700 | [diff] [blame] | 21 | |
Victor Chang | 00c144f | 2021-02-09 12:30:33 +0000 | [diff] [blame] | 22 | "github.com/google/blueprint/proptools" |
| 23 | |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 24 | "android/soong/android" |
| 25 | "android/soong/cc/config" |
hamzeh | c0a671f | 2021-07-22 12:05:08 -0700 | [diff] [blame] | 26 | "android/soong/fuzz" |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 27 | ) |
| 28 | |
| 29 | func init() { |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 30 | android.RegisterModuleType("cc_fuzz", LibFuzzFactory) |
Mitch Phillips | d3254b4 | 2019-09-24 13:03:28 -0700 | [diff] [blame] | 31 | android.RegisterSingletonType("cc_fuzz_packaging", fuzzPackagingFactory) |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | type FuzzProperties struct { |
Cory Barker | 9cfcf6d | 2022-07-22 17:22:02 +0000 | [diff] [blame] | 35 | FuzzFramework fuzz.Framework `blueprint:"mutated"` |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | type fuzzer struct { |
| 39 | Properties FuzzProperties |
| 40 | } |
| 41 | |
| 42 | func (fuzzer *fuzzer) flags(ctx ModuleContext, flags Flags) Flags { |
Cory Barker | 9cfcf6d | 2022-07-22 17:22:02 +0000 | [diff] [blame] | 43 | if fuzzer.Properties.FuzzFramework == fuzz.AFL { |
| 44 | flags.Local.CFlags = append(flags.Local.CFlags, []string{ |
| 45 | "-fsanitize-coverage=trace-pc-guard", |
| 46 | "-Wno-unused-result", |
| 47 | "-Wno-unused-parameter", |
| 48 | "-Wno-unused-function", |
| 49 | }...) |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | return flags |
| 53 | } |
| 54 | |
| 55 | func (fuzzer *fuzzer) props() []interface{} { |
| 56 | return []interface{}{&fuzzer.Properties} |
| 57 | } |
| 58 | |
| 59 | func fuzzMutatorDeps(mctx android.TopDownMutatorContext) { |
| 60 | currentModule, ok := mctx.Module().(*Module) |
| 61 | if !ok { |
| 62 | return |
| 63 | } |
| 64 | |
Cory Barker | 9cfcf6d | 2022-07-22 17:22:02 +0000 | [diff] [blame] | 65 | if currentModule.fuzzer == nil { |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 66 | return |
| 67 | } |
| 68 | |
| 69 | mctx.WalkDeps(func(child android.Module, parent android.Module) bool { |
| 70 | c, ok := child.(*Module) |
| 71 | if !ok { |
| 72 | return false |
| 73 | } |
| 74 | |
| 75 | if c.sanitize == nil { |
| 76 | return false |
| 77 | } |
| 78 | |
| 79 | isFuzzerPointer := c.sanitize.getSanitizerBoolPtr(Fuzzer) |
| 80 | if isFuzzerPointer == nil || !*isFuzzerPointer { |
| 81 | return false |
| 82 | } |
| 83 | |
| 84 | if c.fuzzer == nil { |
| 85 | return false |
| 86 | } |
| 87 | |
Cory Barker | 9cfcf6d | 2022-07-22 17:22:02 +0000 | [diff] [blame] | 88 | c.fuzzer.Properties.FuzzFramework = currentModule.fuzzer.Properties.FuzzFramework |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 89 | return true |
| 90 | }) |
| 91 | } |
| 92 | |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 93 | // cc_fuzz creates a host/device fuzzer binary. Host binaries can be found at |
| 94 | // $ANDROID_HOST_OUT/fuzz/, and device binaries can be found at /data/fuzz on |
| 95 | // your device, or $ANDROID_PRODUCT_OUT/data/fuzz in your build tree. |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 96 | func LibFuzzFactory() android.Module { |
Cory Barker | 9cfcf6d | 2022-07-22 17:22:02 +0000 | [diff] [blame] | 97 | module := NewFuzzer(android.HostAndDeviceSupported) |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 98 | return module.Init() |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | type fuzzBinary struct { |
| 102 | *binaryDecorator |
| 103 | *baseCompiler |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 104 | fuzzPackagedModule fuzz.FuzzPackagedModule |
hamzeh | 41ad881 | 2021-07-07 14:00:07 -0700 | [diff] [blame] | 105 | installedSharedDeps []string |
Colin Cross | 31d89b4 | 2022-10-04 16:35:39 -0700 | [diff] [blame] | 106 | sharedLibraries android.Paths |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 107 | } |
| 108 | |
Liz Kammer | be46fcc | 2021-11-01 15:32:43 -0400 | [diff] [blame] | 109 | func (fuzz *fuzzBinary) fuzzBinary() bool { |
| 110 | return true |
| 111 | } |
| 112 | |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 113 | func (fuzz *fuzzBinary) linkerProps() []interface{} { |
| 114 | props := fuzz.binaryDecorator.linkerProps() |
hamzeh | 41ad881 | 2021-07-07 14:00:07 -0700 | [diff] [blame] | 115 | props = append(props, &fuzz.fuzzPackagedModule.FuzzProperties) |
Cory Barker | 9cfcf6d | 2022-07-22 17:22:02 +0000 | [diff] [blame] | 116 | |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 117 | return props |
| 118 | } |
| 119 | |
| 120 | func (fuzz *fuzzBinary) linkerInit(ctx BaseModuleContext) { |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 121 | fuzz.binaryDecorator.linkerInit(ctx) |
| 122 | } |
| 123 | |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 124 | func (fuzzBin *fuzzBinary) linkerDeps(ctx DepsContext, deps Deps) Deps { |
Cory Barker | 9cfcf6d | 2022-07-22 17:22:02 +0000 | [diff] [blame] | 125 | if ctx.Config().Getenv("FUZZ_FRAMEWORK") == "AFL" { |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 126 | deps.HeaderLibs = append(deps.HeaderLibs, "libafl_headers") |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 127 | } else { |
| 128 | deps.StaticLibs = append(deps.StaticLibs, config.LibFuzzerRuntimeLibrary(ctx.toolchain())) |
Kris Alder | d406da1 | 2022-10-21 09:34:21 -0700 | [diff] [blame^] | 129 | // Fuzzers built with HWASAN should use the interceptors for better |
| 130 | // mutation based on signals in strcmp, memcpy, etc. This is only needed for |
| 131 | // fuzz targets, not generic HWASAN-ified binaries or libraries. |
| 132 | if module, ok := ctx.Module().(*Module); ok { |
| 133 | if module.IsSanitizerEnabled(Hwasan) { |
| 134 | deps.StaticLibs = append(deps.StaticLibs, config.LibFuzzerRuntimeInterceptors(ctx.toolchain())) |
| 135 | } |
| 136 | } |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 137 | } |
Cory Barker | 9cfcf6d | 2022-07-22 17:22:02 +0000 | [diff] [blame] | 138 | |
| 139 | deps = fuzzBin.binaryDecorator.linkerDeps(ctx, deps) |
| 140 | return deps |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | func (fuzz *fuzzBinary) linkerFlags(ctx ModuleContext, flags Flags) Flags { |
| 144 | flags = fuzz.binaryDecorator.linkerFlags(ctx, flags) |
Mitch Phillips | 1f7f54f | 2019-11-14 14:50:47 -0800 | [diff] [blame] | 145 | // RunPaths on devices isn't instantiated by the base linker. `../lib` for |
| 146 | // installed fuzz targets (both host and device), and `./lib` for fuzz |
| 147 | // target packages. |
Mitch Phillips | e1ee1a1 | 2019-10-17 19:20:41 -0700 | [diff] [blame] | 148 | flags.Local.LdFlags = append(flags.Local.LdFlags, `-Wl,-rpath,\$$ORIGIN/../lib`) |
Mitch Phillips | 1f7f54f | 2019-11-14 14:50:47 -0800 | [diff] [blame] | 149 | flags.Local.LdFlags = append(flags.Local.LdFlags, `-Wl,-rpath,\$$ORIGIN/lib`) |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 150 | |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 151 | return flags |
| 152 | } |
| 153 | |
Ivan Lozano | 39b0bf0 | 2021-10-14 12:22:09 -0400 | [diff] [blame] | 154 | // IsValidSharedDependency takes a module and determines if it is a unique shared library |
Mitch Phillips | e1ee1a1 | 2019-10-17 19:20:41 -0700 | [diff] [blame] | 155 | // that should be installed in the fuzz target output directories. This function |
| 156 | // returns true, unless: |
Colin Cross | d079e0b | 2022-08-16 10:27:33 -0700 | [diff] [blame] | 157 | // - The module is not an installable shared library, or |
| 158 | // - The module is a header or stub, or |
| 159 | // - The module is a prebuilt and its source is available, or |
| 160 | // - The module is a versioned member of an SDK snapshot. |
Ivan Lozano | 39b0bf0 | 2021-10-14 12:22:09 -0400 | [diff] [blame] | 161 | func IsValidSharedDependency(dependency android.Module) bool { |
Mitch Phillips | e1ee1a1 | 2019-10-17 19:20:41 -0700 | [diff] [blame] | 162 | // TODO(b/144090547): We should be parsing these modules using |
| 163 | // ModuleDependencyTag instead of the current brute-force checking. |
| 164 | |
Colin Cross | 31076b3 | 2020-10-23 17:22:06 -0700 | [diff] [blame] | 165 | linkable, ok := dependency.(LinkableInterface) |
| 166 | if !ok || !linkable.CcLibraryInterface() { |
| 167 | // Discard non-linkables. |
| 168 | return false |
| 169 | } |
| 170 | |
| 171 | if !linkable.Shared() { |
| 172 | // Discard static libs. |
| 173 | return false |
| 174 | } |
| 175 | |
Colin Cross | 31076b3 | 2020-10-23 17:22:06 -0700 | [diff] [blame] | 176 | if lib := moduleLibraryInterface(dependency); lib != nil && lib.buildStubs() && linkable.CcLibrary() { |
Mitch Phillips | f50bddb | 2019-11-12 14:03:31 -0800 | [diff] [blame] | 177 | // Discard stubs libs (only CCLibrary variants). Prebuilt libraries should not |
| 178 | // be excluded on the basis of they're not CCLibrary()'s. |
Mitch Phillips | e1ee1a1 | 2019-10-17 19:20:41 -0700 | [diff] [blame] | 179 | return false |
| 180 | } |
| 181 | |
Mitch Phillips | f50bddb | 2019-11-12 14:03:31 -0800 | [diff] [blame] | 182 | // We discarded module stubs libraries above, but the LLNDK prebuilts stubs |
| 183 | // libraries must be handled differently - by looking for the stubDecorator. |
| 184 | // Discard LLNDK prebuilts stubs as well. |
| 185 | if ccLibrary, isCcLibrary := dependency.(*Module); isCcLibrary { |
| 186 | if _, isLLndkStubLibrary := ccLibrary.linker.(*stubDecorator); isLLndkStubLibrary { |
| 187 | return false |
| 188 | } |
Victor Chang | 00c144f | 2021-02-09 12:30:33 +0000 | [diff] [blame] | 189 | // Discard installable:false libraries because they are expected to be absent |
| 190 | // in runtime. |
Colin Cross | 1bc9412 | 2021-10-28 13:25:54 -0700 | [diff] [blame] | 191 | if !proptools.BoolDefault(ccLibrary.Installable(), true) { |
Victor Chang | 00c144f | 2021-02-09 12:30:33 +0000 | [diff] [blame] | 192 | return false |
| 193 | } |
Mitch Phillips | f50bddb | 2019-11-12 14:03:31 -0800 | [diff] [blame] | 194 | } |
| 195 | |
Martin Stjernholm | 02460ab | 2020-10-06 02:36:43 +0100 | [diff] [blame] | 196 | // If the same library is present both as source and a prebuilt we must pick |
| 197 | // only one to avoid a conflict. Always prefer the source since the prebuilt |
| 198 | // probably won't be built with sanitizers enabled. |
Paul Duffin | f7c99f5 | 2021-04-28 10:41:21 +0100 | [diff] [blame] | 199 | if prebuilt := android.GetEmbeddedPrebuilt(dependency); prebuilt != nil && prebuilt.SourceExists() { |
Martin Stjernholm | 02460ab | 2020-10-06 02:36:43 +0100 | [diff] [blame] | 200 | return false |
| 201 | } |
| 202 | |
| 203 | // Discard versioned members of SDK snapshots, because they will conflict with |
| 204 | // unversioned ones. |
| 205 | if sdkMember, ok := dependency.(android.SdkAware); ok && !sdkMember.ContainingSdk().Unversioned() { |
| 206 | return false |
| 207 | } |
| 208 | |
Mitch Phillips | e1ee1a1 | 2019-10-17 19:20:41 -0700 | [diff] [blame] | 209 | return true |
| 210 | } |
| 211 | |
| 212 | func sharedLibraryInstallLocation( |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 213 | libraryPath android.Path, isHost bool, fuzzDir string, archString string) string { |
Mitch Phillips | e1ee1a1 | 2019-10-17 19:20:41 -0700 | [diff] [blame] | 214 | installLocation := "$(PRODUCT_OUT)/data" |
| 215 | if isHost { |
| 216 | installLocation = "$(HOST_OUT)" |
| 217 | } |
| 218 | installLocation = filepath.Join( |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 219 | installLocation, fuzzDir, archString, "lib", libraryPath.Base()) |
Mitch Phillips | e1ee1a1 | 2019-10-17 19:20:41 -0700 | [diff] [blame] | 220 | return installLocation |
| 221 | } |
| 222 | |
Mitch Phillips | 0bf9713 | 2020-03-06 09:38:12 -0800 | [diff] [blame] | 223 | // Get the device-only shared library symbols install directory. |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 224 | func sharedLibrarySymbolsInstallLocation(libraryPath android.Path, fuzzDir string, archString string) string { |
| 225 | return filepath.Join("$(PRODUCT_OUT)/symbols/data/", fuzzDir, archString, "/lib/", libraryPath.Base()) |
Mitch Phillips | 0bf9713 | 2020-03-06 09:38:12 -0800 | [diff] [blame] | 226 | } |
| 227 | |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 228 | func (fuzzBin *fuzzBinary) install(ctx ModuleContext, file android.Path) { |
| 229 | installBase := "fuzz" |
Mitch Phillips | 4e4ab8a | 2019-09-13 17:32:50 -0700 | [diff] [blame] | 230 | |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 231 | fuzzBin.binaryDecorator.baseInstaller.dir = filepath.Join( |
| 232 | installBase, ctx.Target().Arch.ArchType.String(), ctx.ModuleName()) |
| 233 | fuzzBin.binaryDecorator.baseInstaller.dir64 = filepath.Join( |
| 234 | installBase, ctx.Target().Arch.ArchType.String(), ctx.ModuleName()) |
| 235 | fuzzBin.binaryDecorator.baseInstaller.install(ctx, file) |
| 236 | |
| 237 | fuzzBin.fuzzPackagedModule.Corpus = android.PathsForModuleSrc(ctx, fuzzBin.fuzzPackagedModule.FuzzProperties.Corpus) |
Colin Cross | f1a035e | 2020-11-16 17:32:30 -0800 | [diff] [blame] | 238 | builder := android.NewRuleBuilder(pctx, ctx) |
Mitch Phillips | 8a2bc0b | 2019-10-17 15:04:01 -0700 | [diff] [blame] | 239 | intermediateDir := android.PathForModuleOut(ctx, "corpus") |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 240 | for _, entry := range fuzzBin.fuzzPackagedModule.Corpus { |
Mitch Phillips | 8a2bc0b | 2019-10-17 15:04:01 -0700 | [diff] [blame] | 241 | builder.Command().Text("cp"). |
| 242 | Input(entry). |
| 243 | Output(intermediateDir.Join(ctx, entry.Base())) |
| 244 | } |
Colin Cross | f1a035e | 2020-11-16 17:32:30 -0800 | [diff] [blame] | 245 | builder.Build("copy_corpus", "copy corpus") |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 246 | fuzzBin.fuzzPackagedModule.CorpusIntermediateDir = intermediateDir |
Mitch Phillips | 8a2bc0b | 2019-10-17 15:04:01 -0700 | [diff] [blame] | 247 | |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 248 | fuzzBin.fuzzPackagedModule.Data = android.PathsForModuleSrc(ctx, fuzzBin.fuzzPackagedModule.FuzzProperties.Data) |
Colin Cross | f1a035e | 2020-11-16 17:32:30 -0800 | [diff] [blame] | 249 | builder = android.NewRuleBuilder(pctx, ctx) |
Tri Vo | ad172d8 | 2019-11-27 13:45:45 -0800 | [diff] [blame] | 250 | intermediateDir = android.PathForModuleOut(ctx, "data") |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 251 | for _, entry := range fuzzBin.fuzzPackagedModule.Data { |
Tri Vo | ad172d8 | 2019-11-27 13:45:45 -0800 | [diff] [blame] | 252 | builder.Command().Text("cp"). |
| 253 | Input(entry). |
| 254 | Output(intermediateDir.Join(ctx, entry.Rel())) |
| 255 | } |
Colin Cross | f1a035e | 2020-11-16 17:32:30 -0800 | [diff] [blame] | 256 | builder.Build("copy_data", "copy data") |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 257 | fuzzBin.fuzzPackagedModule.DataIntermediateDir = intermediateDir |
Tri Vo | ad172d8 | 2019-11-27 13:45:45 -0800 | [diff] [blame] | 258 | |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 259 | if fuzzBin.fuzzPackagedModule.FuzzProperties.Dictionary != nil { |
| 260 | fuzzBin.fuzzPackagedModule.Dictionary = android.PathForModuleSrc(ctx, *fuzzBin.fuzzPackagedModule.FuzzProperties.Dictionary) |
| 261 | if fuzzBin.fuzzPackagedModule.Dictionary.Ext() != ".dict" { |
Mitch Phillips | 4e4ab8a | 2019-09-13 17:32:50 -0700 | [diff] [blame] | 262 | ctx.PropertyErrorf("dictionary", |
| 263 | "Fuzzer dictionary %q does not have '.dict' extension", |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 264 | fuzzBin.fuzzPackagedModule.Dictionary.String()) |
Mitch Phillips | 4e4ab8a | 2019-09-13 17:32:50 -0700 | [diff] [blame] | 265 | } |
| 266 | } |
Kris Alder | f979ee3 | 2019-10-22 10:52:01 -0700 | [diff] [blame] | 267 | |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 268 | if fuzzBin.fuzzPackagedModule.FuzzProperties.Fuzz_config != nil { |
Kris Alder | db97af4 | 2019-10-30 10:17:04 -0700 | [diff] [blame] | 269 | configPath := android.PathForModuleOut(ctx, "config").Join(ctx, "config.json") |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 270 | android.WriteFileRule(ctx, configPath, fuzzBin.fuzzPackagedModule.FuzzProperties.Fuzz_config.String()) |
| 271 | fuzzBin.fuzzPackagedModule.Config = configPath |
Kris Alder | f979ee3 | 2019-10-22 10:52:01 -0700 | [diff] [blame] | 272 | } |
Mitch Phillips | e1ee1a1 | 2019-10-17 19:20:41 -0700 | [diff] [blame] | 273 | |
| 274 | // Grab the list of required shared libraries. |
Muhammad Haseeb Ahmad | 431ddf9 | 2022-10-20 00:55:58 +0000 | [diff] [blame] | 275 | fuzzBin.sharedLibraries, _ = CollectAllSharedDependencies(ctx) |
Colin Cross | dc809f9 | 2019-11-20 15:58:32 -0800 | [diff] [blame] | 276 | |
Colin Cross | 31d89b4 | 2022-10-04 16:35:39 -0700 | [diff] [blame] | 277 | for _, lib := range fuzzBin.sharedLibraries { |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 278 | fuzzBin.installedSharedDeps = append(fuzzBin.installedSharedDeps, |
Mitch Phillips | e1ee1a1 | 2019-10-17 19:20:41 -0700 | [diff] [blame] | 279 | sharedLibraryInstallLocation( |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 280 | lib, ctx.Host(), installBase, ctx.Arch().ArchType.String())) |
Mitch Phillips | 0bf9713 | 2020-03-06 09:38:12 -0800 | [diff] [blame] | 281 | |
| 282 | // Also add the dependency on the shared library symbols dir. |
| 283 | if !ctx.Host() { |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 284 | fuzzBin.installedSharedDeps = append(fuzzBin.installedSharedDeps, |
| 285 | sharedLibrarySymbolsInstallLocation(lib, installBase, ctx.Arch().ArchType.String())) |
Mitch Phillips | 0bf9713 | 2020-03-06 09:38:12 -0800 | [diff] [blame] | 286 | } |
Mitch Phillips | e1ee1a1 | 2019-10-17 19:20:41 -0700 | [diff] [blame] | 287 | } |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 288 | } |
| 289 | |
Cory Barker | 9cfcf6d | 2022-07-22 17:22:02 +0000 | [diff] [blame] | 290 | func NewFuzzer(hod android.HostOrDeviceSupported) *Module { |
Liz Kammer | be46fcc | 2021-11-01 15:32:43 -0400 | [diff] [blame] | 291 | module, binary := newBinary(hod, false) |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 292 | baseInstallerPath := "fuzz" |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 293 | |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 294 | binary.baseInstaller = NewBaseInstaller(baseInstallerPath, baseInstallerPath, InstallInData) |
Ivan Lozano | 3968d8f | 2020-12-14 11:27:52 -0500 | [diff] [blame] | 295 | module.sanitize.SetSanitizer(Fuzzer, true) |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 296 | |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 297 | fuzzBin := &fuzzBinary{ |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 298 | binaryDecorator: binary, |
| 299 | baseCompiler: NewBaseCompiler(), |
| 300 | } |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 301 | module.compiler = fuzzBin |
| 302 | module.linker = fuzzBin |
| 303 | module.installer = fuzzBin |
Colin Cross | eec9b28 | 2019-07-18 16:20:52 -0700 | [diff] [blame] | 304 | |
Cory Barker | 9cfcf6d | 2022-07-22 17:22:02 +0000 | [diff] [blame] | 305 | module.fuzzer.Properties.FuzzFramework = fuzz.LibFuzzer |
| 306 | |
Colin Cross | eec9b28 | 2019-07-18 16:20:52 -0700 | [diff] [blame] | 307 | // The fuzzer runtime is not present for darwin host modules, disable cc_fuzz modules when targeting darwin. |
| 308 | android.AddLoadHook(module, func(ctx android.LoadHookContext) { |
Alex Light | 71123ec | 2019-07-24 13:34:19 -0700 | [diff] [blame] | 309 | disableDarwinAndLinuxBionic := struct { |
Colin Cross | eec9b28 | 2019-07-18 16:20:52 -0700 | [diff] [blame] | 310 | Target struct { |
| 311 | Darwin struct { |
| 312 | Enabled *bool |
| 313 | } |
Alex Light | 71123ec | 2019-07-24 13:34:19 -0700 | [diff] [blame] | 314 | Linux_bionic struct { |
| 315 | Enabled *bool |
| 316 | } |
Colin Cross | eec9b28 | 2019-07-18 16:20:52 -0700 | [diff] [blame] | 317 | } |
| 318 | }{} |
Alex Light | 71123ec | 2019-07-24 13:34:19 -0700 | [diff] [blame] | 319 | disableDarwinAndLinuxBionic.Target.Darwin.Enabled = BoolPtr(false) |
| 320 | disableDarwinAndLinuxBionic.Target.Linux_bionic.Enabled = BoolPtr(false) |
| 321 | ctx.AppendProperties(&disableDarwinAndLinuxBionic) |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 322 | |
Cory Barker | 9cfcf6d | 2022-07-22 17:22:02 +0000 | [diff] [blame] | 323 | targetFramework := fuzz.GetFramework(ctx, fuzz.Cc) |
| 324 | if !fuzz.IsValidFrameworkForModule(targetFramework, fuzz.Cc, fuzzBin.fuzzPackagedModule.FuzzProperties.Fuzzing_frameworks) { |
| 325 | ctx.Module().Disable() |
| 326 | return |
| 327 | } |
| 328 | |
| 329 | if targetFramework == fuzz.AFL { |
| 330 | fuzzBin.baseCompiler.Properties.Srcs = append(fuzzBin.baseCompiler.Properties.Srcs, ":aflpp_driver", ":afl-compiler-rt") |
| 331 | module.fuzzer.Properties.FuzzFramework = fuzz.AFL |
| 332 | } |
| 333 | }) |
Cory Barker | 74aea6c | 2022-08-08 15:55:12 +0000 | [diff] [blame] | 334 | |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 335 | return module |
| 336 | } |
Mitch Phillips | d3254b4 | 2019-09-24 13:03:28 -0700 | [diff] [blame] | 337 | |
| 338 | // Responsible for generating GNU Make rules that package fuzz targets into |
| 339 | // their architecture & target/host specific zip file. |
hamzeh | 41ad881 | 2021-07-07 14:00:07 -0700 | [diff] [blame] | 340 | type ccFuzzPackager struct { |
hamzeh | c0a671f | 2021-07-22 12:05:08 -0700 | [diff] [blame] | 341 | fuzz.FuzzPackager |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 342 | fuzzPackagingArchModules string |
| 343 | fuzzTargetSharedDepsInstallPairs string |
| 344 | allFuzzTargetsName string |
Mitch Phillips | d3254b4 | 2019-09-24 13:03:28 -0700 | [diff] [blame] | 345 | } |
| 346 | |
| 347 | func fuzzPackagingFactory() android.Singleton { |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 348 | |
| 349 | fuzzPackager := &ccFuzzPackager{ |
| 350 | fuzzPackagingArchModules: "SOONG_FUZZ_PACKAGING_ARCH_MODULES", |
| 351 | fuzzTargetSharedDepsInstallPairs: "FUZZ_TARGET_SHARED_DEPS_INSTALL_PAIRS", |
| 352 | allFuzzTargetsName: "ALL_FUZZ_TARGETS", |
| 353 | } |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 354 | return fuzzPackager |
Mitch Phillips | d3254b4 | 2019-09-24 13:03:28 -0700 | [diff] [blame] | 355 | } |
| 356 | |
hamzeh | 41ad881 | 2021-07-07 14:00:07 -0700 | [diff] [blame] | 357 | func (s *ccFuzzPackager) GenerateBuildActions(ctx android.SingletonContext) { |
Mitch Phillips | d3254b4 | 2019-09-24 13:03:28 -0700 | [diff] [blame] | 358 | // Map between each architecture + host/device combination, and the files that |
| 359 | // need to be packaged (in the tuple of {source file, destination folder in |
| 360 | // archive}). |
hamzeh | c0a671f | 2021-07-22 12:05:08 -0700 | [diff] [blame] | 361 | archDirs := make(map[fuzz.ArchOs][]fuzz.FileToZip) |
Mitch Phillips | d3254b4 | 2019-09-24 13:03:28 -0700 | [diff] [blame] | 362 | |
Mitch Phillips | e1ee1a1 | 2019-10-17 19:20:41 -0700 | [diff] [blame] | 363 | // List of individual fuzz targets, so that 'make fuzz' also installs the targets |
| 364 | // to the correct output directories as well. |
hamzeh | 41ad881 | 2021-07-07 14:00:07 -0700 | [diff] [blame] | 365 | s.FuzzTargets = make(map[string]bool) |
Mitch Phillips | e1ee1a1 | 2019-10-17 19:20:41 -0700 | [diff] [blame] | 366 | |
Ivan Lozano | 39b0bf0 | 2021-10-14 12:22:09 -0400 | [diff] [blame] | 367 | // Map tracking whether each shared library has an install rule to avoid duplicate install rules from |
| 368 | // multiple fuzzers that depend on the same shared library. |
| 369 | sharedLibraryInstalled := make(map[string]bool) |
| 370 | |
Mitch Phillips | d3254b4 | 2019-09-24 13:03:28 -0700 | [diff] [blame] | 371 | ctx.VisitAllModules(func(module android.Module) { |
Mitch Phillips | d3254b4 | 2019-09-24 13:03:28 -0700 | [diff] [blame] | 372 | ccModule, ok := module.(*Module) |
hamzeh | 41ad881 | 2021-07-07 14:00:07 -0700 | [diff] [blame] | 373 | if !ok || ccModule.Properties.PreventInstall { |
| 374 | return |
| 375 | } |
| 376 | |
| 377 | // Discard non-fuzz targets. |
hamzeh | c0a671f | 2021-07-22 12:05:08 -0700 | [diff] [blame] | 378 | if ok := fuzz.IsValid(ccModule.FuzzModule); !ok { |
Mitch Phillips | d3254b4 | 2019-09-24 13:03:28 -0700 | [diff] [blame] | 379 | return |
| 380 | } |
Mitch Phillips | e1ee1a1 | 2019-10-17 19:20:41 -0700 | [diff] [blame] | 381 | |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 382 | sharedLibsInstallDirPrefix := "lib" |
Mitch Phillips | d3254b4 | 2019-09-24 13:03:28 -0700 | [diff] [blame] | 383 | fuzzModule, ok := ccModule.compiler.(*fuzzBinary) |
Cory Barker | 9cfcf6d | 2022-07-22 17:22:02 +0000 | [diff] [blame] | 384 | if !ok { |
Mitch Phillips | d3254b4 | 2019-09-24 13:03:28 -0700 | [diff] [blame] | 385 | return |
| 386 | } |
| 387 | |
Mitch Phillips | d3254b4 | 2019-09-24 13:03:28 -0700 | [diff] [blame] | 388 | hostOrTargetString := "target" |
| 389 | if ccModule.Host() { |
| 390 | hostOrTargetString = "host" |
| 391 | } |
| 392 | |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 393 | fpm := fuzz.FuzzPackagedModule{} |
| 394 | if ok { |
| 395 | fpm = fuzzModule.fuzzPackagedModule |
| 396 | } |
| 397 | |
| 398 | intermediatePath := "fuzz" |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 399 | |
Mitch Phillips | d3254b4 | 2019-09-24 13:03:28 -0700 | [diff] [blame] | 400 | archString := ccModule.Arch().ArchType.String() |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 401 | archDir := android.PathForIntermediates(ctx, intermediatePath, hostOrTargetString, archString) |
hamzeh | c0a671f | 2021-07-22 12:05:08 -0700 | [diff] [blame] | 402 | archOs := fuzz.ArchOs{HostOrTarget: hostOrTargetString, Arch: archString, Dir: archDir.String()} |
Mitch Phillips | d3254b4 | 2019-09-24 13:03:28 -0700 | [diff] [blame] | 403 | |
hamzeh | c0a671f | 2021-07-22 12:05:08 -0700 | [diff] [blame] | 404 | var files []fuzz.FileToZip |
Colin Cross | f1a035e | 2020-11-16 17:32:30 -0800 | [diff] [blame] | 405 | builder := android.NewRuleBuilder(pctx, ctx) |
Mitch Phillips | 2edbe8e | 2019-11-13 08:36:07 -0800 | [diff] [blame] | 406 | |
hamzeh | 41ad881 | 2021-07-07 14:00:07 -0700 | [diff] [blame] | 407 | // Package the corpus, data, dict and config into a zipfile. |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 408 | files = s.PackageArtifacts(ctx, module, fpm, archDir, builder) |
Tri Vo | ad172d8 | 2019-11-27 13:45:45 -0800 | [diff] [blame] | 409 | |
Ivan Lozano | 39b0bf0 | 2021-10-14 12:22:09 -0400 | [diff] [blame] | 410 | // Package shared libraries |
Colin Cross | 31d89b4 | 2022-10-04 16:35:39 -0700 | [diff] [blame] | 411 | files = append(files, GetSharedLibsToZip(fuzzModule.sharedLibraries, ccModule, &s.FuzzPackager, archString, sharedLibsInstallDirPrefix, &sharedLibraryInstalled)...) |
Mitch Phillips | e1ee1a1 | 2019-10-17 19:20:41 -0700 | [diff] [blame] | 412 | |
Mitch Phillips | d3254b4 | 2019-09-24 13:03:28 -0700 | [diff] [blame] | 413 | // The executable. |
Colin Cross | 31d89b4 | 2022-10-04 16:35:39 -0700 | [diff] [blame] | 414 | files = append(files, fuzz.FileToZip{android.OutputFileForModule(ctx, ccModule, "unstripped"), ""}) |
Mitch Phillips | d3254b4 | 2019-09-24 13:03:28 -0700 | [diff] [blame] | 415 | |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 416 | archDirs[archOs], ok = s.BuildZipFile(ctx, module, fpm, files, builder, archDir, archString, hostOrTargetString, archOs, archDirs) |
hamzeh | 41ad881 | 2021-07-07 14:00:07 -0700 | [diff] [blame] | 417 | if !ok { |
| 418 | return |
Mitch Phillips | d3254b4 | 2019-09-24 13:03:28 -0700 | [diff] [blame] | 419 | } |
| 420 | }) |
| 421 | |
Cory Barker | 9cfcf6d | 2022-07-22 17:22:02 +0000 | [diff] [blame] | 422 | s.CreateFuzzPackage(ctx, archDirs, fuzz.Cc, pctx) |
Mitch Phillips | a0a5e19 | 2019-09-27 14:00:06 -0700 | [diff] [blame] | 423 | } |
Mitch Phillips | d3254b4 | 2019-09-24 13:03:28 -0700 | [diff] [blame] | 424 | |
hamzeh | 41ad881 | 2021-07-07 14:00:07 -0700 | [diff] [blame] | 425 | func (s *ccFuzzPackager) MakeVars(ctx android.MakeVarsContext) { |
| 426 | packages := s.Packages.Strings() |
Mitch Phillips | e1ee1a1 | 2019-10-17 19:20:41 -0700 | [diff] [blame] | 427 | sort.Strings(packages) |
Ivan Lozano | 39b0bf0 | 2021-10-14 12:22:09 -0400 | [diff] [blame] | 428 | sort.Strings(s.FuzzPackager.SharedLibInstallStrings) |
Mitch Phillips | a0a5e19 | 2019-09-27 14:00:06 -0700 | [diff] [blame] | 429 | // TODO(mitchp): Migrate this to use MakeVarsContext::DistForGoal() when it's |
| 430 | // ready to handle phony targets created in Soong. In the meantime, this |
| 431 | // exports the phony 'fuzz' target and dependencies on packages to |
| 432 | // core/main.mk so that we can use dist-for-goals. |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 433 | |
| 434 | ctx.Strict(s.fuzzPackagingArchModules, strings.Join(packages, " ")) |
| 435 | |
| 436 | ctx.Strict(s.fuzzTargetSharedDepsInstallPairs, |
Ivan Lozano | 39b0bf0 | 2021-10-14 12:22:09 -0400 | [diff] [blame] | 437 | strings.Join(s.FuzzPackager.SharedLibInstallStrings, " ")) |
Mitch Phillips | e1ee1a1 | 2019-10-17 19:20:41 -0700 | [diff] [blame] | 438 | |
| 439 | // Preallocate the slice of fuzz targets to minimise memory allocations. |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 440 | s.PreallocateSlice(ctx, s.allFuzzTargetsName) |
Mitch Phillips | d3254b4 | 2019-09-24 13:03:28 -0700 | [diff] [blame] | 441 | } |
Ivan Lozano | 39b0bf0 | 2021-10-14 12:22:09 -0400 | [diff] [blame] | 442 | |
| 443 | // GetSharedLibsToZip finds and marks all the transiently-dependent shared libraries for |
| 444 | // packaging. |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 445 | func GetSharedLibsToZip(sharedLibraries android.Paths, module LinkableInterface, s *fuzz.FuzzPackager, archString string, destinationPathPrefix string, sharedLibraryInstalled *map[string]bool) []fuzz.FileToZip { |
Ivan Lozano | 39b0bf0 | 2021-10-14 12:22:09 -0400 | [diff] [blame] | 446 | var files []fuzz.FileToZip |
| 447 | |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 448 | fuzzDir := "fuzz" |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 449 | |
Ivan Lozano | 39b0bf0 | 2021-10-14 12:22:09 -0400 | [diff] [blame] | 450 | for _, library := range sharedLibraries { |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 451 | files = append(files, fuzz.FileToZip{library, destinationPathPrefix}) |
Ivan Lozano | 39b0bf0 | 2021-10-14 12:22:09 -0400 | [diff] [blame] | 452 | |
| 453 | // For each architecture-specific shared library dependency, we need to |
| 454 | // install it to the output directory. Setup the install destination here, |
| 455 | // which will be used by $(copy-many-files) in the Make backend. |
| 456 | installDestination := sharedLibraryInstallLocation( |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 457 | library, module.Host(), fuzzDir, archString) |
Ivan Lozano | 39b0bf0 | 2021-10-14 12:22:09 -0400 | [diff] [blame] | 458 | if (*sharedLibraryInstalled)[installDestination] { |
| 459 | continue |
| 460 | } |
| 461 | (*sharedLibraryInstalled)[installDestination] = true |
| 462 | |
| 463 | // Escape all the variables, as the install destination here will be called |
| 464 | // via. $(eval) in Make. |
| 465 | installDestination = strings.ReplaceAll( |
| 466 | installDestination, "$", "$$") |
| 467 | s.SharedLibInstallStrings = append(s.SharedLibInstallStrings, |
| 468 | library.String()+":"+installDestination) |
| 469 | |
| 470 | // Ensure that on device, the library is also reinstalled to the /symbols/ |
| 471 | // dir. Symbolized DSO's are always installed to the device when fuzzing, but |
| 472 | // we want symbolization tools (like `stack`) to be able to find the symbols |
| 473 | // in $ANDROID_PRODUCT_OUT/symbols automagically. |
| 474 | if !module.Host() { |
Cory Barker | a1da26f | 2022-06-07 20:12:06 +0000 | [diff] [blame] | 475 | symbolsInstallDestination := sharedLibrarySymbolsInstallLocation(library, fuzzDir, archString) |
Ivan Lozano | 39b0bf0 | 2021-10-14 12:22:09 -0400 | [diff] [blame] | 476 | symbolsInstallDestination = strings.ReplaceAll(symbolsInstallDestination, "$", "$$") |
| 477 | s.SharedLibInstallStrings = append(s.SharedLibInstallStrings, |
| 478 | library.String()+":"+symbolsInstallDestination) |
| 479 | } |
| 480 | } |
| 481 | return files |
| 482 | } |
Colin Cross | 31d89b4 | 2022-10-04 16:35:39 -0700 | [diff] [blame] | 483 | |
| 484 | // CollectAllSharedDependencies search over the provided module's dependencies using |
| 485 | // VisitDirectDeps and WalkDeps to enumerate all shared library dependencies. |
| 486 | // VisitDirectDeps is used first to avoid incorrectly using the core libraries (sanitizer |
| 487 | // runtimes, libc, libdl, etc.) from a dependency. This may cause issues when dependencies |
| 488 | // have explicit sanitizer tags, as we may get a dependency on an unsanitized libc, etc. |
Muhammad Haseeb Ahmad | 431ddf9 | 2022-10-20 00:55:58 +0000 | [diff] [blame] | 489 | func CollectAllSharedDependencies(ctx android.ModuleContext) (android.Paths, []android.Module) { |
Colin Cross | 31d89b4 | 2022-10-04 16:35:39 -0700 | [diff] [blame] | 490 | seen := make(map[string]bool) |
| 491 | recursed := make(map[string]bool) |
Muhammad Haseeb Ahmad | 431ddf9 | 2022-10-20 00:55:58 +0000 | [diff] [blame] | 492 | deps := []android.Module{} |
Colin Cross | 31d89b4 | 2022-10-04 16:35:39 -0700 | [diff] [blame] | 493 | |
| 494 | var sharedLibraries android.Paths |
| 495 | |
| 496 | // Enumerate the first level of dependencies, as we discard all non-library |
| 497 | // modules in the BFS loop below. |
| 498 | ctx.VisitDirectDeps(func(dep android.Module) { |
| 499 | if !IsValidSharedDependency(dep) { |
| 500 | return |
| 501 | } |
| 502 | if seen[ctx.OtherModuleName(dep)] { |
| 503 | return |
| 504 | } |
| 505 | seen[ctx.OtherModuleName(dep)] = true |
Muhammad Haseeb Ahmad | 431ddf9 | 2022-10-20 00:55:58 +0000 | [diff] [blame] | 506 | deps = append(deps, dep) |
Colin Cross | 31d89b4 | 2022-10-04 16:35:39 -0700 | [diff] [blame] | 507 | sharedLibraries = append(sharedLibraries, android.OutputFileForModule(ctx, dep, "unstripped")) |
| 508 | }) |
| 509 | |
| 510 | ctx.WalkDeps(func(child, parent android.Module) bool { |
| 511 | if !IsValidSharedDependency(child) { |
| 512 | return false |
| 513 | } |
| 514 | if !seen[ctx.OtherModuleName(child)] { |
| 515 | seen[ctx.OtherModuleName(child)] = true |
Muhammad Haseeb Ahmad | 431ddf9 | 2022-10-20 00:55:58 +0000 | [diff] [blame] | 516 | deps = append(deps, child) |
Colin Cross | 31d89b4 | 2022-10-04 16:35:39 -0700 | [diff] [blame] | 517 | sharedLibraries = append(sharedLibraries, android.OutputFileForModule(ctx, child, "unstripped")) |
| 518 | } |
| 519 | |
| 520 | if recursed[ctx.OtherModuleName(child)] { |
| 521 | return false |
| 522 | } |
| 523 | recursed[ctx.OtherModuleName(child)] = true |
| 524 | return true |
| 525 | }) |
| 526 | |
Muhammad Haseeb Ahmad | 431ddf9 | 2022-10-20 00:55:58 +0000 | [diff] [blame] | 527 | return sharedLibraries, deps |
Colin Cross | 31d89b4 | 2022-10-04 16:35:39 -0700 | [diff] [blame] | 528 | } |