File tree 2 files changed +10
-3
lines changed
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,6 @@ fn main() {
95
95
// When statically linking `std` into `rustc_driver`, remove `-C prefer-dynamic`
96
96
if env:: var ( "RUSTC_LINK_STD_INTO_RUSTC_DRIVER" ) . unwrap ( ) == "1"
97
97
&& crate_name == Some ( "rustc_driver" )
98
- && stage != "0"
99
98
{
100
99
if let Some ( pos) = args. iter ( ) . enumerate ( ) . position ( |( i, a) | {
101
100
a == "-C" && args. get ( i + 1 ) . map ( |a| a == "prefer-dynamic" ) . unwrap_or ( false )
Original file line number Diff line number Diff line change @@ -1848,8 +1848,16 @@ impl Step for Assemble {
1848
1848
let src_libdir = builder. sysroot_libdir ( build_compiler, host) ;
1849
1849
for f in builder. read_dir ( & src_libdir) {
1850
1850
let filename = f. file_name ( ) . into_string ( ) . unwrap ( ) ;
1851
- if ( is_dylib ( & filename) || is_debug_info ( & filename) ) && !proc_macros. contains ( & filename)
1852
- {
1851
+
1852
+ let is_proc_macro = proc_macros. contains ( & filename) ;
1853
+ let is_dylib_or_debug = is_dylib ( & filename) || is_debug_info ( & filename) ;
1854
+
1855
+ // If we link statically to stdlib, do not copy the libstd dynamic library file
1856
+ let is_std = filename. starts_with ( "std-" ) || filename. starts_with ( "libstd-" ) ;
1857
+ let can_be_rustc_dynamic_dep =
1858
+ !( is_std && builder. link_std_into_rustc_driver ( target_compiler. host ) ) ;
1859
+
1860
+ if is_dylib_or_debug && can_be_rustc_dynamic_dep && !is_proc_macro {
1853
1861
builder. copy_link ( & f. path ( ) , & rustc_libdir. join ( & filename) ) ;
1854
1862
}
1855
1863
}
You can’t perform that action at this time.
0 commit comments