@@ -1923,8 +1923,24 @@ impl Step for Assemble { |
|
|
1923 |
1923 |
let src_libdir = builder.sysroot_libdir(build_compiler, host); |
1924 |
1924 |
for f in builder.read_dir(&src_libdir) { |
1925 |
1925 |
let filename = f.file_name().into_string().unwrap(); |
1926 |
|
-if (is_dylib(&filename) | |
|
1926 |
+ |
|
1927 |
+let is_proc_macro = proc_macros.contains(&filename); |
|
1928 |
+let is_dylib_or_debug = is_dylib(&filename) | |
|
1929 |
+ |
|
1930 |
+// If we link statically to stdlib, do not copy the libstd dynamic library file |
|
1931 |
+// FIXME: Also do this for Windows once incremental post-optimization stage0 tests |
|
1932 |
+// work without std.dll (see https://github.com/rust-lang/rust/pull/131188). |
|
1933 |
+let can_be_rustc_dynamic_dep = if builder |
|
1934 |
+.link_std_into_rustc_driver(target_compiler.host) |
|
1935 |
+ && !target_compiler.host.is_windows() |
1927 |
1936 |
{ |
|
1937 |
+let is_std = filename.starts_with("std-") | |
|
1938 |
+ !is_std |
|
1939 |
+} else { |
|
1940 |
+true |
|
1941 |
+}; |
|
1942 |
+ |
|
1943 |
+if is_dylib_or_debug && can_be_rustc_dynamic_dep && !is_proc_macro { |
1928 |
1944 |
builder.copy_link(&f.path(), &rustc_libdir.join(&filename)); |
1929 |
1945 |
} |
1930 |
1946 |
} |