From 0459f0a4c09f7a9f42d252f7fa2046f30295d8b8 Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Fri, 7 Jan 2022 07:41:13 +1100 Subject: [PATCH] cargo-build-bpf: don't set -C linker on windows (#22314) * cargo-build-bpf: don't set -C linker on windows Since we're now linking using rust-lld (https://github.com/solana-labs/rust/commit/87ba5c61a5fe7f6fc5b74298127592dd0bc38389) which is guaranteed to always be in the sysroot, hardcoding the linker path shouldn't be needed anymore. * Update Cargo.lock --- sdk/cargo-build-bpf/src/main.rs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/sdk/cargo-build-bpf/src/main.rs b/sdk/cargo-build-bpf/src/main.rs index 99163a823e..d2559777d9 100644 --- a/sdk/cargo-build-bpf/src/main.rs +++ b/sdk/cargo-build-bpf/src/main.rs @@ -516,17 +516,11 @@ 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")); - if let Ok(mut rustflags) = env::var("RUSTFLAGS") { - if cfg!(windows) && !rustflags.contains("-C linker=") { - let ld_path = llvm_bin.join("ld.lld"); - rustflags = format!("{} -C linker={}", rustflags, ld_path.display()); - } - - if config.verbose { - println!("RUSTFLAGS={}", rustflags); - } - - env::set_var("RUSTFLAGS", rustflags); + if config.verbose { + println!( + "RUSTFLAGS={}", + env::var("RUSTFLAGS").ok().as_deref().unwrap_or("") + ); }; let cargo_build = PathBuf::from("cargo");