Skip to content

Commit 6e25c8e

Browse files
committed
Revert "Build rustc and codegen backends with -Zno-embed-metadata"
This reverts commit b6605c3.
1 parent b6605c3 commit 6e25c8e

2 files changed

Lines changed: 9 additions & 14 deletions

File tree

src/bootstrap/src/core/build_steps/compile.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,15 +1185,13 @@ impl Step for Rustc {
11851185
{
11861186
// jemalloc_sys and rustc_public_bridge are not linked into librustc_driver.so,
11871187
// so we need to distribute them as rlib to be able to use them.
1188-
if filename.ends_with(".rlib") {
1189-
return true;
1190-
}
1188+
filename.ends_with(".rlib")
1189+
} else {
1190+
// Distribute the rest of the rustc crates as rmeta files only to reduce
1191+
// the tarball sizes by about 50%. The object files are linked into
1192+
// librustc_driver.so, so it is still possible to link against them.
1193+
filename.ends_with(".rmeta")
11911194
}
1192-
1193-
// Distribute the rest of the rustc crates as rmeta files only to reduce
1194-
// the tarball sizes by about 50%. The object files are linked into
1195-
// librustc_driver.so, so it is still possible to link against them.
1196-
filename.ends_with(".rmeta")
11971195
})),
11981196
);
11991197

@@ -1734,7 +1732,7 @@ impl Step for GccCodegenBackend {
17341732

17351733
let _guard =
17361734
builder.msg(Kind::Build, "codegen backend gcc", Mode::Codegen, build_compiler, host);
1737-
let files = run_cargo(builder, cargo, vec![], &stamp, vec![], ArtifactKeepMode::OnlyDylib);
1735+
let files = run_cargo(builder, cargo, vec![], &stamp, vec![], ArtifactKeepMode::OnlyRlib);
17381736

17391737
GccCodegenBackendOutput {
17401738
stamp: write_codegen_backend_stamp(stamp, files, builder.config.dry_run()),
@@ -1810,7 +1808,7 @@ impl Step for CraneliftCodegenBackend {
18101808
build_compiler,
18111809
target,
18121810
);
1813-
let files = run_cargo(builder, cargo, vec![], &stamp, vec![], ArtifactKeepMode::OnlyDylib);
1811+
let files = run_cargo(builder, cargo, vec![], &stamp, vec![], ArtifactKeepMode::OnlyRlib);
18141812
write_codegen_backend_stamp(stamp, files, builder.config.dry_run())
18151813
}
18161814

@@ -2644,8 +2642,6 @@ pub fn add_to_sysroot(
26442642
/// build stamp, and thus be included in dist archives and copied into sysroots by default.
26452643
/// Note that some kinds of artifacts are copied automatically (e.g. native libraries).
26462644
pub enum ArtifactKeepMode {
2647-
/// Only keep .so files, ignore .rlib and .rmeta files
2648-
OnlyDylib,
26492645
/// Only keep .rlib files, ignore .rmeta files
26502646
OnlyRlib,
26512647
/// Only keep .rmeta files, ignore .rlib files
@@ -2708,7 +2704,6 @@ pub fn run_cargo(
27082704
true
27092705
} else {
27102706
match &artifact_keep_mode {
2711-
ArtifactKeepMode::OnlyDylib => false,
27122707
ArtifactKeepMode::OnlyRlib => filename.ends_with(".rlib"),
27132708
ArtifactKeepMode::OnlyRmeta => filename.ends_with(".rmeta"),
27142709
ArtifactKeepMode::BothRlibAndRmeta => {

src/bootstrap/src/core/builder/cargo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ impl Builder<'_> {
10951095
// Enable usage of unstable features
10961096
cargo.env("RUSTC_BOOTSTRAP", "1");
10971097

1098-
if matches!(mode, Mode::Std | Mode::Rustc | Mode::Codegen) {
1098+
if matches!(mode, Mode::Std) {
10991099
cargo.arg("-Zno-embed-metadata");
11001100
}
11011101

0 commit comments

Comments
 (0)