summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Wu <[email protected]>2023-01-16 16:23:08 -0500
committerAlan Wu <[email protected]>2023-01-16 17:32:15 -0500
commit14fe7a081a8260bbbfc7929a14ec4187faaa3c25 (patch)
tree32fafdd560634b9a1b2345796df1d167f4271dab
parentb5725959184d6306b2ede1f16c9dd3dff4b2740c (diff)
YJIT: Use ThinLTO for Rust parts in release mode
This reduces the code size of libyjit.a by a lot. On darwin it went from 23 MiB to 12 MiB for me. I chose ThinLTO over fat LTO for the relatively fast build time; in case we need to debug release-build-only problems it won't be painful.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7134
-rw-r--r--common.mk1
-rw-r--r--yjit/Cargo.toml2
2 files changed, 3 insertions, 0 deletions
diff --git a/common.mk b/common.mk
index ac627181e0..9dd35eebc2 100644
--- a/common.mk
+++ b/common.mk
@@ -225,6 +225,7 @@ YJIT_RUSTC_ARGS = --crate-name=yjit \
--crate-type=staticlib \
--edition=2021 \
-g \
+ -C lto=thin \
-C opt-level=3 \
-C overflow-checks=on \
'--out-dir=$(CARGO_TARGET_DIR)/release/' \
diff --git a/yjit/Cargo.toml b/yjit/Cargo.toml
index 18b1d10bd8..d2d54edc78 100644
--- a/yjit/Cargo.toml
+++ b/yjit/Cargo.toml
@@ -45,3 +45,5 @@ opt-level = 3
overflow-checks = true
# Generate debug info
debug = true
+# Use ThinLTO. Much smaller output for a small amount of build time increase.
+lto = "thin"