diff options
author | Pirama Arumuga Nainar <pirama@google.com> | 2017-06-06 08:32:29 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-06-06 08:32:29 +0000 |
commit | 882ad4a5ab10ead211b818f40828d47957347587 (patch) | |
tree | 31cb465e96a971a6171f33205cbff36cf164009c | |
parent | 2bc53f65c24971625e45bd7f0ee74a65fae29e35 (diff) | |
parent | bec70a698fc5087601a61cc68238dd02b8a57c45 (diff) | |
download | prebuilts_clang_host_linux-x86-882ad4a5ab10ead211b818f40828d47957347587.tar.gz prebuilts_clang_host_linux-x86-882ad4a5ab10ead211b818f40828d47957347587.tar.bz2 prebuilts_clang_host_linux-x86-882ad4a5ab10ead211b818f40828d47957347587.zip |
Disable libFuzzer if LLVM_PREBUILTS_BASE is specified am: a303448c6d am: 55a42674a1 am: 67cf87c9c4
am: bec70a698f
Change-Id: I2e2a23b5babadbd58694e07eff45a3fa93d116f8
-rw-r--r-- | soong/libfuzzer.go | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/soong/libfuzzer.go b/soong/libfuzzer.go index a0ce14c1..81d75808 100644 --- a/soong/libfuzzer.go +++ b/soong/libfuzzer.go @@ -18,8 +18,10 @@ package libfuzzer import ( "path" + "path/filepath" "github.com/google/blueprint" + "github.com/google/blueprint/proptools" "android/soong/android" "android/soong/cc" @@ -36,7 +38,21 @@ func init() { } func libfuzzerPrebuiltLibraryStatic(ctx android.LoadHookContext) { - // Because of b/38393317, changing clang base dir is not allowed. + // Because of b/38393317, changing clang base dir is not allowed. Mark + // libFuzzer as disabled if LLVM_PREBUILTS_BASE is used to specify a + // different base dir other than $ANDROID_BUILD_TOP/prebuilts/clang/host + // (i.e. $CWD/..). libFuzzer would be unavailable only for the stage2 + // of the aosp-llvm build, where it is not needed. + var enableLibFuzzer bool + enableLibFuzzer = true + if prebuiltsBase := ctx.AConfig().Getenv("LLVM_PREBUILTS_BASE"); prebuiltsBase != "" { + prebuiltsBaseAbs, err1 := filepath.Abs(prebuiltsBase) + moduleBaseAbs, err2 := filepath.Abs("..") + if err1 == nil && err2 == nil && prebuiltsBaseAbs != moduleBaseAbs { + enableLibFuzzer = false + } + } + clangDir := path.Join( "./", ctx.AConfig().GetenvWithDefault("LLVM_PREBUILTS_VERSION", config.ClangDefaultVersion), @@ -47,6 +63,7 @@ func libfuzzerPrebuiltLibraryStatic(ctx android.LoadHookContext) { libDir := path.Join(clangDir, "lib64", "clang", releaseVersion, "lib", "linux") type props struct { + Enabled *bool Export_include_dirs []string Target struct { Android_arm struct { @@ -72,6 +89,7 @@ func libfuzzerPrebuiltLibraryStatic(ctx android.LoadHookContext) { p := &props{} + p.Enabled = proptools.BoolPtr(enableLibFuzzer) p.Export_include_dirs = []string{headerDir} p.Target.Android_arm.Srcs = []string{path.Join(libDir, "arm/libFuzzer.a")} p.Target.Android_arm64.Srcs = []string{path.Join(libDir, "aarch64/libFuzzer.a")} |