about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-11-16 09:14:16 +0900
committerGitHub <noreply@github.com>2021-11-16 09:14:16 +0900
commita0dc4abe987edc3ef52b0dc89c50e5e13b3cdbe3 (patch)
tree60e546a54cf8156d99c32bf90c650162ebf3b8fd /compiler/rustc_codegen_ssa
parentc44455af1de0e8775660ae95538a967f9c8af4ce (diff)
parente35b7bbdf8bf9939be5bcbaef781b95e8c93b6e1 (diff)
downloadrust-a0dc4abe987edc3ef52b0dc89c50e5e13b3cdbe3.tar.gz
rust-a0dc4abe987edc3ef52b0dc89c50e5e13b3cdbe3.zip
Rollup merge of #90058 - joshtriplett:stabilize-strip, r=wesleywiser
Stabilize -Z strip as -C strip

Leave -Z strip available temporarily as an alias, to avoid breaking
cargo until cargo transitions to using -C strip.
Diffstat (limited to 'compiler/rustc_codegen_ssa')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/link.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs
index 1ba0c4fa05b..638b2a7b5a9 100644
--- a/compiler/rustc_codegen_ssa/src/back/link.rs
+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
@@ -1034,8 +1034,10 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>(
         SplitDebuginfo::Packed => link_dwarf_object(sess, &out_filename),
     }
 
+    let strip = strip_value(sess);
+
     if sess.target.is_like_osx {
-        match sess.opts.debugging_opts.strip {
+        match strip {
             Strip::Debuginfo => strip_symbols_in_osx(sess, &out_filename, Some("-S")),
             Strip::Symbols => strip_symbols_in_osx(sess, &out_filename, None),
             Strip::None => {}
@@ -1043,6 +1045,14 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>(
     }
 }
 
+// Temporarily support both -Z strip and -C strip
+fn strip_value(sess: &Session) -> Strip {
+    match (sess.opts.debugging_opts.strip, sess.opts.cg.strip) {
+        (s, Strip::None) => s,
+        (_, s) => s,
+    }
+}
+
 fn strip_symbols_in_osx<'a>(sess: &'a Session, out_filename: &Path, option: Option<&str>) {
     let mut cmd = Command::new("strip");
     if let Some(option) = option {
@@ -2014,7 +2024,7 @@ fn add_order_independent_options(
     cmd.optimize();
 
     // Pass debuginfo and strip flags down to the linker.
-    cmd.debuginfo(sess.opts.debugging_opts.strip);
+    cmd.debuginfo(strip_value(sess));
 
     // We want to prevent the compiler from accidentally leaking in any system libraries,
     // so by default we tell linkers not to link to any default libraries.