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 | 36 |
1 files changed, 18 insertions, 18 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 407d701bad..0ba0921f59 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 | |||
@@ -24,13 +24,12 @@ diff --git a/compiler/rustc/src/main.rs b/compiler/rustc/src/main.rs | |||
24 | index e9a7397557..29766fc9d8 100644 | 24 | index e9a7397557..29766fc9d8 100644 |
25 | --- a/compiler/rustc/src/main.rs | 25 | --- a/compiler/rustc/src/main.rs |
26 | +++ b/compiler/rustc/src/main.rs | 26 | +++ b/compiler/rustc/src/main.rs |
27 | @@ -1,6 +1,3 @@ | 27 | @@ -1,5 +1,3 @@ |
28 | -// We need this feature as it changes `dylib` linking behavior and allows us to link to `rustc_driver`. | 28 | -// We need this feature as it changes `dylib` linking behavior and allows us to link to `rustc_driver`. |
29 | -#![feature(rustc_private)] | 29 | -#![feature(rustc_private)] |
30 | - | 30 | // Several crates are depended upon but unused so that they are present in the sysroot |
31 | // A note about jemalloc: rustc uses jemalloc when built for CI and | 31 | #![expect(unused_crate_dependencies)] |
32 | // distribution. The obvious way to do this is with the `#[global_allocator]` | 32 | |
33 | // mechanism. However, for complicated reasons (see | ||
34 | diff --git a/compiler/rustc_metadata/src/dependency_format.rs b/compiler/rustc_metadata/src/dependency_format.rs | 33 | diff --git a/compiler/rustc_metadata/src/dependency_format.rs b/compiler/rustc_metadata/src/dependency_format.rs |
35 | index 39fa23766b..51d86b4009 100644 | 34 | index 39fa23766b..51d86b4009 100644 |
36 | --- a/compiler/rustc_metadata/src/dependency_format.rs | 35 | --- a/compiler/rustc_metadata/src/dependency_format.rs |
@@ -44,10 +43,11 @@ index 39fa23766b..51d86b4009 100644 | |||
44 | use rustc_hir::def_id::CrateNum; | 43 | use rustc_hir::def_id::CrateNum; |
45 | use rustc_middle::bug; | 44 | use rustc_middle::bug; |
46 | use rustc_middle::middle::dependency_format::{Dependencies, DependencyList, Linkage}; | 45 | use rustc_middle::middle::dependency_format::{Dependencies, DependencyList, Linkage}; |
47 | @@ -162,43 +162,18 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList { | 46 | @@ -161,44 +161,19 @@ fn calculate_type(tcx: TyCtxt<'_>, ty: CrateType) -> DependencyList { |
47 | } | ||
48 | Linkage::Dynamic | Linkage::IncludedFromDylib => {} | 48 | Linkage::Dynamic | Linkage::IncludedFromDylib => {} |
49 | } | 49 | } |
50 | 50 | - | |
51 | - let all_dylibs = || { | 51 | - let all_dylibs = || { |
52 | - tcx.crates(()).iter().filter(|&&cnum| { | 52 | - tcx.crates(()).iter().filter(|&&cnum| { |
53 | - !tcx.dep_kind(cnum).macros_only() && tcx.used_crate_source(cnum).dylib.is_some() | 53 | - !tcx.dep_kind(cnum).macros_only() && tcx.used_crate_source(cnum).dylib.is_some() |
@@ -56,7 +56,7 @@ index 39fa23766b..51d86b4009 100644 | |||
56 | - | 56 | - |
57 | - let mut upstream_in_dylibs = FxHashSet::default(); | 57 | - let mut upstream_in_dylibs = FxHashSet::default(); |
58 | - | 58 | - |
59 | - if tcx.features().rustc_private { | 59 | - if tcx.features().rustc_private() { |
60 | - // We need this to prevent users of `rustc_driver` from linking dynamically to `std` | 60 | - // We need this to prevent users of `rustc_driver` from linking dynamically to `std` |
61 | - // which does not work as `std` is also statically linked into `rustc_driver`. | 61 | - // which does not work as `std` is also statically linked into `rustc_driver`. |
62 | - | 62 | - |
@@ -85,7 +85,7 @@ index 39fa23766b..51d86b4009 100644 | |||
85 | + if tcx.dep_kind(cnum).macros_only() { | 85 | + if tcx.dep_kind(cnum).macros_only() { |
86 | continue; | 86 | continue; |
87 | } | 87 | } |
88 | - | 88 | |
89 | let name = tcx.crate_name(cnum); | 89 | let name = tcx.crate_name(cnum); |
90 | + let src = tcx.used_crate_source(cnum); | 90 | + let src = tcx.used_crate_source(cnum); |
91 | + if src.dylib.is_some() { | 91 | + if src.dylib.is_some() { |
@@ -139,11 +139,11 @@ index d04e2fbeb7..011c289d93 100644 | |||
139 | if let Some(crate_name) = crate_name { | 139 | if let Some(crate_name) = crate_name { |
140 | if let Some(target) = env::var_os("RUSTC_TIME") { | 140 | if let Some(target) = env::var_os("RUSTC_TIME") { |
141 | if target == "all" | 141 | if target == "all" |
142 | diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs | 142 | diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs |
143 | index ff0d1f3a72..b2c9602e57 100644 | 143 | index 0688a1d689..066e6bf53f 100644 |
144 | --- a/src/bootstrap/src/core/builder.rs | 144 | --- a/src/bootstrap/src/core/builder/cargo.rs |
145 | +++ b/src/bootstrap/src/core/builder.rs | 145 | +++ b/src/bootstrap/src/core/builder/cargo.rs |
146 | @@ -2201,7 +2201,7 @@ impl<'a> Builder<'a> { | 146 | @@ -1146,7 +1146,7 @@ impl Builder<'_> { |
147 | // When we build Rust dylibs they're all intended for intermediate | 147 | // When we build Rust dylibs they're all intended for intermediate |
148 | // 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 |
149 | // linking all deps statically into the dylib. | 149 | // linking all deps statically into the dylib. |
@@ -200,13 +200,13 @@ diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/c | |||
200 | index 27bbc8bd8f..a6fc4df2eb 100644 | 200 | index 27bbc8bd8f..a6fc4df2eb 100644 |
201 | --- a/src/bootstrap/src/core/build_steps/compile.rs | 201 | --- a/src/bootstrap/src/core/build_steps/compile.rs |
202 | +++ b/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 { | 203 | @@ -1940,24 +1940,8 @@ impl Step for Assemble { |
204 | let src_libdir = builder.sysroot_libdir(build_compiler, host); | 204 | let src_libdir = builder.sysroot_target_libdir(build_compiler, host); |
205 | for f in builder.read_dir(&src_libdir) { | 205 | for f in builder.read_dir(&src_libdir) { |
206 | let filename = f.file_name().into_string().unwrap(); | 206 | let filename = f.file_name().into_string().unwrap(); |
207 | - | 207 | - |
208 | - let is_proc_macro = proc_macros.contains(&filename); | 208 | - let is_proc_macro = proc_macros.contains(&filename); |
209 | - let is_dylib_or_debug = is_dylib(&filename) || is_debug_info(&filename); | 209 | - let is_dylib_or_debug = is_dylib(&f.path()) || is_debug_info(&filename); |
210 | - | 210 | - |
211 | - // If we link statically to stdlib, do not copy the libstd dynamic library file | 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 | 212 | - // FIXME: Also do this for Windows once incremental post-optimization stage0 tests |
@@ -214,7 +214,7 @@ index 27bbc8bd8f..a6fc4df2eb 100644 | |||
214 | - let can_be_rustc_dynamic_dep = if builder | 214 | - let can_be_rustc_dynamic_dep = if builder |
215 | - .link_std_into_rustc_driver(target_compiler.host) | 215 | - .link_std_into_rustc_driver(target_compiler.host) |
216 | - && !target_compiler.host.is_windows() | 216 | - && !target_compiler.host.is_windows() |
217 | + if (is_dylib(&filename) || is_debug_info(&filename)) && !proc_macros.contains(&filename) | 217 | + if (is_dylib(Path::new(&filename)) || is_debug_info(&filename)) && !proc_macros.contains(&filename) |
218 | { | 218 | { |
219 | - let is_std = filename.starts_with("std-") || filename.starts_with("libstd-"); | 219 | - let is_std = filename.starts_with("std-") || filename.starts_with("libstd-"); |
220 | - !is_std | 220 | - !is_std |