From 00c144f930629dd2a14af74d68fc5c047ff74d8f Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Tue, 9 Feb 2021 12:30:33 +0000 Subject: [PATCH] Non-installable module should not be installed into a fuzzer .zip package libicu_* fuzzer depends on installable cc modules and non-installable cc modules with the same name, because the non-installable modules are stubs used in the compile-time, and shouldn't be used in runtime. Bug: 175583039 Test: make haiku dist Test: Run 2 arbitrary binaries from out/dist/fuzz-target-x86_64.zip on device Test: Run 2 arbitrary binaries from out/dist/fuzz-host-x86_64.zip on host Change-Id: I0ecf24bb83e3985da3b8f393adab8c87ab7400c6 --- cc/fuzz.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cc/fuzz.go b/cc/fuzz.go index d7da5abea..9fe5b17f5 100644 --- a/cc/fuzz.go +++ b/cc/fuzz.go @@ -20,6 +20,8 @@ import ( "sort" "strings" + "github.com/google/blueprint/proptools" + "android/soong/android" "android/soong/cc/config" ) @@ -172,7 +174,7 @@ func collectAllSharedDependencies(ctx android.SingletonContext, module android.M // This function takes a module and determines if it is a unique shared library // that should be installed in the fuzz target output directories. This function // returns true, unless: -// - The module is not a shared library, or +// - The module is not an installable shared library, or // - The module is a header, stub, or vendor-linked library, or // - The module is a prebuilt and its source is available, or // - The module is a versioned member of an SDK snapshot. @@ -209,6 +211,11 @@ func isValidSharedDependency(dependency android.Module) bool { if _, isLLndkStubLibrary := ccLibrary.linker.(*stubDecorator); isLLndkStubLibrary { return false } + // Discard installable:false libraries because they are expected to be absent + // in runtime. + if !proptools.BoolDefault(ccLibrary.Properties.Installable, true) { + return false + } } // If the same library is present both as source and a prebuilt we must pick