diff options
Diffstat (limited to 'meta/recipes-devtools/rust/files/revert-link-std-statically-in-rustc_driver-feature.patch')
-rw-r--r-- | meta/recipes-devtools/rust/files/revert-link-std-statically-in-rustc_driver-feature.patch | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/meta/recipes-devtools/rust/files/revert-link-std-statically-in-rustc_driver-feature.patch b/meta/recipes-devtools/rust/files/revert-link-std-statically-in-rustc_driver-feature.patch index 257883ef60..407d701bad 100644 --- a/meta/recipes-devtools/rust/files/revert-link-std-statically-in-rustc_driver-feature.patch +++ b/meta/recipes-devtools/rust/files/revert-link-std-statically-in-rustc_driver-feature.patch | |||
@@ -104,7 +104,7 @@ diff --git a/src/bootstrap/src/bin/rustc.rs b/src/bootstrap/src/bin/rustc.rs | |||
104 | index d04e2fbeb7..011c289d93 100644 | 104 | index d04e2fbeb7..011c289d93 100644 |
105 | --- a/src/bootstrap/src/bin/rustc.rs | 105 | --- a/src/bootstrap/src/bin/rustc.rs |
106 | +++ b/src/bootstrap/src/bin/rustc.rs | 106 | +++ b/src/bootstrap/src/bin/rustc.rs |
107 | @@ -89,25 +89,6 @@ fn main() { | 107 | @@ -89,24 +89,6 @@ fn main() { |
108 | rustc_real | 108 | rustc_real |
109 | }; | 109 | }; |
110 | 110 | ||
@@ -114,7 +114,6 @@ index d04e2fbeb7..011c289d93 100644 | |||
114 | - // When statically linking `std` into `rustc_driver`, remove `-C prefer-dynamic` | 114 | - // When statically linking `std` into `rustc_driver`, remove `-C prefer-dynamic` |
115 | - if env::var("RUSTC_LINK_STD_INTO_RUSTC_DRIVER").unwrap() == "1" | 115 | - if env::var("RUSTC_LINK_STD_INTO_RUSTC_DRIVER").unwrap() == "1" |
116 | - && crate_name == Some("rustc_driver") | 116 | - && crate_name == Some("rustc_driver") |
117 | - && stage != "0" | ||
118 | - { | 117 | - { |
119 | - if let Some(pos) = args.iter().enumerate().position(|(i, a)| { | 118 | - if let Some(pos) = args.iter().enumerate().position(|(i, a)| { |
120 | - a == "-C" && args.get(i + 1).map(|a| a == "prefer-dynamic").unwrap_or(false) | 119 | - a == "-C" && args.get(i + 1).map(|a| a == "prefer-dynamic").unwrap_or(false) |
@@ -130,7 +129,7 @@ index d04e2fbeb7..011c289d93 100644 | |||
130 | let mut cmd = match env::var_os("RUSTC_WRAPPER_REAL") { | 129 | let mut cmd = match env::var_os("RUSTC_WRAPPER_REAL") { |
131 | Some(wrapper) if !wrapper.is_empty() => { | 130 | Some(wrapper) if !wrapper.is_empty() => { |
132 | let mut cmd = Command::new(wrapper); | 131 | let mut cmd = Command::new(wrapper); |
133 | @@ -118,6 +99,9 @@ fn main() { | 132 | @@ -117,6 +99,9 @@ fn main() { |
134 | }; | 133 | }; |
135 | cmd.args(&args).env(dylib_path_var(), env::join_paths(&dylib_path).unwrap()); | 134 | cmd.args(&args).env(dylib_path_var(), env::join_paths(&dylib_path).unwrap()); |
136 | 135 | ||
@@ -144,7 +143,7 @@ diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder. | |||
144 | index ff0d1f3a72..b2c9602e57 100644 | 143 | index ff0d1f3a72..b2c9602e57 100644 |
145 | --- a/src/bootstrap/src/core/builder.rs | 144 | --- a/src/bootstrap/src/core/builder.rs |
146 | +++ b/src/bootstrap/src/core/builder.rs | 145 | +++ b/src/bootstrap/src/core/builder.rs |
147 | @@ -2153,7 +2153,7 @@ impl<'a> Builder<'a> { | 146 | @@ -2201,7 +2201,7 @@ impl<'a> Builder<'a> { |
148 | // When we build Rust dylibs they're all intended for intermediate | 147 | // When we build Rust dylibs they're all intended for intermediate |
149 | // usage, so make sure we pass the -Cprefer-dynamic flag instead of | 148 | // usage, so make sure we pass the -Cprefer-dynamic flag instead of |
150 | // linking all deps statically into the dylib. | 149 | // linking all deps statically into the dylib. |
@@ -197,3 +196,33 @@ index b8b0432aa9..b5bd71e015 100644 | |||
197 | use std::env; | 196 | use std::env; |
198 | use std::io::stdout; | 197 | use std::io::stdout; |
199 | use std::path::{Path, PathBuf}; | 198 | use std::path::{Path, PathBuf}; |
199 | diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs | ||
200 | index 27bbc8bd8f..a6fc4df2eb 100644 | ||
201 | --- a/src/bootstrap/src/core/build_steps/compile.rs | ||
202 | +++ b/src/bootstrap/src/core/build_steps/compile.rs | ||
203 | @@ -1934,24 +1934,8 @@ impl Step for Assemble { | ||
204 | let src_libdir = builder.sysroot_libdir(build_compiler, host); | ||
205 | for f in builder.read_dir(&src_libdir) { | ||
206 | let filename = f.file_name().into_string().unwrap(); | ||
207 | - | ||
208 | - let is_proc_macro = proc_macros.contains(&filename); | ||
209 | - let is_dylib_or_debug = is_dylib(&filename) || is_debug_info(&filename); | ||
210 | - | ||
211 | - // If we link statically to stdlib, do not copy the libstd dynamic library file | ||
212 | - // FIXME: Also do this for Windows once incremental post-optimization stage0 tests | ||
213 | - // work without std.dll (see https://github.com/rust-lang/rust/pull/131188). | ||
214 | - let can_be_rustc_dynamic_dep = if builder | ||
215 | - .link_std_into_rustc_driver(target_compiler.host) | ||
216 | - && !target_compiler.host.is_windows() | ||
217 | + if (is_dylib(&filename) || is_debug_info(&filename)) && !proc_macros.contains(&filename) | ||
218 | { | ||
219 | - let is_std = filename.starts_with("std-") || filename.starts_with("libstd-"); | ||
220 | - !is_std | ||
221 | - } else { | ||
222 | - true | ||
223 | - }; | ||
224 | - | ||
225 | - if is_dylib_or_debug && can_be_rustc_dynamic_dep && !is_proc_macro { | ||
226 | builder.copy_link(&f.path(), &rustc_libdir.join(&filename)); | ||
227 | } | ||
228 | } | ||