diff options
Diffstat (limited to 'community/rust/minimize-rpath.patch')
-rw-r--r-- | community/rust/minimize-rpath.patch | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/community/rust/minimize-rpath.patch b/community/rust/minimize-rpath.patch index 1f6682ae26..8d3be50cbe 100644 --- a/community/rust/minimize-rpath.patch +++ b/community/rust/minimize-rpath.patch @@ -9,7 +9,7 @@ and skip it there. --- a/src/librustc_codegen_llvm/back/rpath.rs +++ b/src/librustc_codegen_llvm/back/rpath.rs -@@ -69,14 +69,15 @@ +@@ -59,13 +59,14 @@ debug!(" {:?}", libpath.display()); } @@ -21,15 +21,14 @@ and skip it there. // as long as they maintain the relative relationship to the // crates they depend on. - let rel_rpaths = get_rpaths_relative_to_output(config, libs); -+ let rel_rpaths = get_rpaths_relative_to_output(config, libs, &fallback_rpaths); - +- - // And a final backup rpath to the global library location. - let fallback_rpaths = vec![get_install_prefix_rpath(config)]; -- ++ let rel_rpaths = get_rpaths_relative_to_output(config, libs, &fallback_rpaths); + fn log_rpaths(desc: &str, rpaths: &[String]) { debug!("{} rpaths:", desc); - for rpath in rpaths { -@@ -96,11 +97,13 @@ +@@ -87,11 +88,13 @@ } fn get_rpaths_relative_to_output(config: &mut RPathConfig, @@ -46,14 +45,13 @@ and skip it there. // Mac doesn't appear to support $ORIGIN let prefix = if config.is_like_osx { "@loader_path" -@@ -114,10 +117,18 @@ +@@ -105,10 +108,16 @@ let mut output = cwd.join(&config.out_filename); output.pop(); let output = fs::canonicalize(&output).unwrap_or(output); - let relative = path_relative_from(&lib, &output).unwrap_or_else(|| - panic!("couldn't create relative path from {:?} to {:?}", output, lib)); -+ - // FIXME (#9639): This needs to handle non-utf8 paths +- // FIXME (#9639): This needs to handle non-utf8 paths - format!("{}/{}", prefix, relative.to_str().expect("non-utf8 component in path")) + let libpath = lib.to_str().expect("non-utf8 component in path").to_string(); + if omit.contains(&libpath) { @@ -68,7 +66,7 @@ and skip it there. } // This routine is adapted from the *old* Path's `path_relative_from` -@@ -239,6 +249,7 @@ +@@ -227,6 +236,7 @@ #[test] fn test_rpath_relative() { if cfg!(target_os = "macos") { @@ -76,7 +74,7 @@ and skip it there. let config = &mut RPathConfig { used_crates: Vec::new(), has_rpath: true, -@@ -248,9 +259,11 @@ +@@ -236,9 +246,11 @@ get_install_prefix_lib_path: &mut || panic!(), }; let res = get_rpath_relative_to_output(config, @@ -89,7 +87,7 @@ and skip it there. let config = &mut RPathConfig { used_crates: Vec::new(), out_filename: PathBuf::from("bin/rustc"), -@@ -260,7 +273,8 @@ +@@ -248,7 +260,8 @@ linker_is_gnu: true, }; let res = get_rpath_relative_to_output(config, @@ -99,3 +97,4 @@ and skip it there. assert_eq!(res, "$ORIGIN/../lib"); } } + |