From 9c2108667bcfa1cb827a870fc33336ca3ab41c91 Mon Sep 17 00:00:00 2001 From: Liz Kammer Date: Mon, 12 Apr 2021 18:52:29 -0400 Subject: [PATCH] rust_fuzzer: add toolchain libraries if non-empty Test: bp2build Test: m nothing Fixes: 185163319 Change-Id: Id8b8e5b21b71f949fa8fa27f8c8cc4aba00c1f7d --- rust/fuzz.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rust/fuzz.go b/rust/fuzz.go index 6035e68ab..6b0a943f2 100644 --- a/rust/fuzz.go +++ b/rust/fuzz.go @@ -70,10 +70,12 @@ func (fuzzer *fuzzDecorator) compilerFlags(ctx ModuleContext, flags Flags) Flags } func (fuzzer *fuzzDecorator) compilerDeps(ctx DepsContext, deps Deps) Deps { - deps.StaticLibs = append(deps.StaticLibs, - config.LibFuzzerRuntimeLibrary(ctx.toolchain())) - deps.SharedLibs = append(deps.SharedLibs, - config.LibclangRuntimeLibrary(ctx.toolchain(), "asan")) + if libFuzzerRuntimeLibrary := config.LibFuzzerRuntimeLibrary(ctx.toolchain()); libFuzzerRuntimeLibrary != "" { + deps.StaticLibs = append(deps.StaticLibs, libFuzzerRuntimeLibrary) + } + if libclangRuntimeLibrary := config.LibclangRuntimeLibrary(ctx.toolchain(), "asan"); libclangRuntimeLibrary != "" { + deps.SharedLibs = append(deps.SharedLibs, libclangRuntimeLibrary) + } deps.SharedLibs = append(deps.SharedLibs, "libc++") deps.Rlibs = append(deps.Rlibs, "liblibfuzzer_sys")