Skip to content

Commit e4e41b7

Browse files
committed
Use -Zno-embed-metadata for the codegen backend and sysroot
This saves about 10MB on the dist size and about 240MB on the build dir size.
1 parent 0b05e69 commit e4e41b7

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

build_system/build_backend.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ pub(crate) fn build_backend(
4343

4444
cmd.arg("--release");
4545

46+
cmd.arg("-Zno-embed-metadata");
47+
4648
eprintln!("[BUILD] rustc_codegen_cranelift");
4749
crate::utils::spawn_and_wait(cmd);
4850

build_system/build_sysroot.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ fn build_clif_sysroot_for_triple(
242242
build_cmd.arg("--release");
243243
build_cmd.arg("--features").arg("backtrace panic-unwind");
244244
build_cmd.arg(format!("-Zroot-dir={}", STDLIB_SRC.to_path(dirs).display()));
245+
build_cmd.arg("-Zno-embed-metadata");
245246
build_cmd.env("CARGO_PROFILE_RELEASE_DEBUG", "true");
246247
build_cmd.env("__CARGO_DEFAULT_LIB_METADATA", "cg_clif");
247248
if compiler.triple.contains("apple") {
@@ -256,7 +257,7 @@ fn build_clif_sysroot_for_triple(
256257
for entry in fs::read_dir(build_dir.join("deps")).unwrap() {
257258
let entry = entry.unwrap();
258259
if let Some(ext) = entry.path().extension() {
259-
if ext == "rmeta" || ext == "d" || ext == "dSYM" || ext == "clif" {
260+
if ext == "d" || ext == "dSYM" || ext == "clif" {
260261
continue;
261262
}
262263
} else {

0 commit comments

Comments
 (0)