diff options
| author | bors <bors@rust-lang.org> | 2021-01-24 23:04:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-01-24 23:04:15 +0000 |
| commit | d3163e96553ae8cb1fca0e62084b124e8b98310b (patch) | |
| tree | 8f0e190a1dd178971317e5cab80cc9ea453d6dd9 /compiler/rustc_codegen_ssa/src | |
| parent | 1d0d76f8dd4f5f6ecbeab575b87edaf1c9f56bb8 (diff) | |
| parent | 529f15f9b9c5bcd1d2a02e2fa74027a5c5a458de (diff) | |
| download | rust-d3163e96553ae8cb1fca0e62084b124e8b98310b.tar.gz rust-d3163e96553ae8cb1fca0e62084b124e8b98310b.zip | |
Auto merge of #81355 - jonas-schievink:rollup-vpaadij, r=jonas-schievink
Rollup of 14 pull requests Successful merges: - #75180 (Implement Error for &(impl Error)) - #78578 (Permit mutable references in all const contexts) - #79174 (Make std::future a re-export of core::future) - #79884 (Replace magic numbers with existing constants) - #80855 (Expand assert!(expr, args..) to include $crate for hygiene on 2021.) - #80933 (Fix sysroot option not being honored across rustc) - #81259 (Replace version_check dependency with own version parsing code) - #81264 (Add unstable option to control doctest run directory) - #81279 (Small refactor in typeck) - #81297 (Don't provide backend_optimization_level query for extern crates) - #81302 (Fix rendering of stabilization version for trait implementors) - #81310 (Do not mark unit variants as used when in path pattern) - #81320 (Make bad shlex parsing a pretty error) - #81338 (Clean up `dominators_given_rpo`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/link.rs | 28 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/base.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/lib.rs | 3 |
3 files changed, 23 insertions, 10 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index e51904f308d..72e049b6d74 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -885,9 +885,22 @@ fn link_sanitizers(sess: &Session, crate_type: CrateType, linker: &mut dyn Linke } fn link_sanitizer_runtime(sess: &Session, linker: &mut dyn Linker, name: &str) { - let default_sysroot = filesearch::get_or_default_sysroot(); - let default_tlib = - filesearch::make_target_lib_path(&default_sysroot, sess.opts.target_triple.triple()); + fn find_sanitizer_runtime(sess: &Session, filename: &String) -> PathBuf { + let session_tlib = + filesearch::make_target_lib_path(&sess.sysroot, sess.opts.target_triple.triple()); + let path = session_tlib.join(&filename); + if path.exists() { + return session_tlib; + } else { + let default_sysroot = filesearch::get_or_default_sysroot(); + let default_tlib = filesearch::make_target_lib_path( + &default_sysroot, + sess.opts.target_triple.triple(), + ); + return default_tlib; + } + } + let channel = option_env!("CFG_RELEASE_CHANNEL") .map(|channel| format!("-{}", channel)) .unwrap_or_default(); @@ -898,10 +911,11 @@ fn link_sanitizer_runtime(sess: &Session, linker: &mut dyn Linker, name: &str) { // LLVM will link to `@rpath/*.dylib`, so we need to specify an // rpath to the library as well (the rpath should be absolute, see // PR #41352 for details). - let libname = format!("rustc{}_rt.{}", channel, name); - let rpath = default_tlib.to_str().expect("non-utf8 component in path"); + let filename = format!("rustc{}_rt.{}", channel, name); + let path = find_sanitizer_runtime(&sess, &filename); + let rpath = path.to_str().expect("non-utf8 component in path"); linker.args(&["-Wl,-rpath", "-Xlinker", rpath]); - linker.link_dylib(Symbol::intern(&libname)); + linker.link_dylib(Symbol::intern(&filename)); } "aarch64-fuchsia" | "aarch64-unknown-linux-gnu" @@ -909,7 +923,7 @@ fn link_sanitizer_runtime(sess: &Session, linker: &mut dyn Linker, name: &str) { | "x86_64-unknown-freebsd" | "x86_64-unknown-linux-gnu" => { let filename = format!("librustc{}_rt.{}.a", channel, name); - let path = default_tlib.join(&filename); + let path = find_sanitizer_runtime(&sess, &filename).join(&filename); linker.link_whole_rlib(&path); } _ => {} diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs index 2ce5fe5ad50..b205ea9cf6c 100644 --- a/compiler/rustc_codegen_ssa/src/base.rs +++ b/compiler/rustc_codegen_ssa/src/base.rs @@ -783,7 +783,7 @@ impl CrateInfo { } } -pub fn provide_both(providers: &mut Providers) { +pub fn provide(providers: &mut Providers) { providers.backend_optimization_level = |tcx, cratenum| { let for_speed = match tcx.sess.opts.optimize { // If globally no optimisation is done, #[optimize] has no effect. diff --git a/compiler/rustc_codegen_ssa/src/lib.rs b/compiler/rustc_codegen_ssa/src/lib.rs index e27eac3f69b..0307117e1c8 100644 --- a/compiler/rustc_codegen_ssa/src/lib.rs +++ b/compiler/rustc_codegen_ssa/src/lib.rs @@ -160,13 +160,12 @@ pub struct CodegenResults { pub fn provide(providers: &mut Providers) { crate::back::symbol_export::provide(providers); - crate::base::provide_both(providers); + crate::base::provide(providers); crate::target_features::provide(providers); } pub fn provide_extern(providers: &mut Providers) { crate::back::symbol_export::provide_extern(providers); - crate::base::provide_both(providers); } /// Checks if the given filename ends with the `.rcgu.o` extension that `rustc` |
