Prevent duplication of RUSTFLAGS settings in cargo-build-bpf subprocesses (#18576)

This commit is contained in:
Dmitri Makarov 2021-07-10 18:24:26 -07:00 committed by GitHub
parent 918b5c28b2
commit cf9a4575ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -433,7 +433,13 @@ fn build_bpf_package(config: &Config, target_directory: &Path, package: &cargo_m
env::set_var("OBJDUMP", llvm_bin.join("llvm-objdump"));
env::set_var("OBJCOPY", llvm_bin.join("llvm-objcopy"));
let rustflags = match env::var("RUSTFLAGS") {
Ok(rf) => rf + &" -C lto=no".to_string(),
Ok(rf) => {
if rf.contains("-C lto=no") {
rf
} else {
rf + &" -C lto=no".to_string()
}
}
_ => "-C lto=no".to_string(),
};
if config.verbose {