diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2019-08-15 13:58:30 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2019-09-23 09:34:44 -0700 |
| commit | 1bec962f4687eacb09bf12955c93f6edfd6efee8 (patch) | |
| tree | 0f93684dee34871681c4e400c0fdd0d51d6bafa3 /src/bootstrap/bin | |
| parent | b82d86ed60e92ad9e0aa14fc52db25d0b9d23440 (diff) | |
| download | rust-1bec962f4687eacb09bf12955c93f6edfd6efee8.tar.gz rust-1bec962f4687eacb09bf12955c93f6edfd6efee8.zip | |
bootstrap: Remove need for `RUSTC_RPATH` variable
Diffstat (limited to 'src/bootstrap/bin')
| -rw-r--r-- | src/bootstrap/bin/rustc.rs | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index c6ac03baefd..8be70c5a287 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -184,54 +184,6 @@ fn main() { cmd.arg("-C").arg(format!("codegen-units={}", s)); } - // Dealing with rpath here is a little special, so let's go into some - // detail. First off, `-rpath` is a linker option on Unix platforms - // which adds to the runtime dynamic loader path when looking for - // dynamic libraries. We use this by default on Unix platforms to ensure - // that our nightlies behave the same on Windows, that is they work out - // of the box. This can be disabled, of course, but basically that's why - // we're gated on RUSTC_RPATH here. - // - // Ok, so the astute might be wondering "why isn't `-C rpath` used - // here?" and that is indeed a good question to task. This codegen - // option is the compiler's current interface to generating an rpath. - // Unfortunately it doesn't quite suffice for us. The flag currently - // takes no value as an argument, so the compiler calculates what it - // should pass to the linker as `-rpath`. This unfortunately is based on - // the **compile time** directory structure which when building with - // Cargo will be very different than the runtime directory structure. - // - // All that's a really long winded way of saying that if we use - // `-Crpath` then the executables generated have the wrong rpath of - // something like `$ORIGIN/deps` when in fact the way we distribute - // rustc requires the rpath to be `$ORIGIN/../lib`. - // - // So, all in all, to set up the correct rpath we pass the linker - // argument manually via `-C link-args=-Wl,-rpath,...`. Plus isn't it - // fun to pass a flag to a tool to pass a flag to pass a flag to a tool - // to change a flag in a binary? - if env::var("RUSTC_RPATH") == Ok("true".to_string()) { - let rpath = if target.contains("apple") { - - // Note that we need to take one extra step on macOS to also pass - // `-Wl,-instal_name,@rpath/...` to get things to work right. To - // do that we pass a weird flag to the compiler to get it to do - // so. Note that this is definitely a hack, and we should likely - // flesh out rpath support more fully in the future. - cmd.arg("-Z").arg("osx-rpath-install-name"); - Some("-Wl,-rpath,@loader_path/../lib") - } else if !target.contains("windows") && - !target.contains("wasm32") && - !target.contains("fuchsia") { - Some("-Wl,-rpath,$ORIGIN/../lib") - } else { - None - }; - if let Some(rpath) = rpath { - cmd.arg("-C").arg(format!("link-args={}", rpath)); - } - } - if let Ok(map) = env::var("RUSTC_DEBUGINFO_MAP") { cmd.arg("--remap-path-prefix").arg(&map); } |
