rust_fuzzer: add toolchain libraries if non-empty

Test: bp2build
Test: m nothing
Fixes: 185163319
Change-Id: Id8b8e5b21b71f949fa8fa27f8c8cc4aba00c1f7d
This commit is contained in:
Liz Kammer 2021-04-12 18:52:29 -04:00
parent 8e1c08cda6
commit 9c2108667b
1 changed files with 6 additions and 4 deletions

View File

@ -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")