about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-06-08 22:15:19 +0200
committerGitHub <noreply@github.com>2020-06-08 22:15:19 +0200
commitfdaeb0ff12eb5a7d7c310aaad95eef84f2cdce86 (patch)
treee0c03f185afb94a3093b9c9bd2d22d4818f8bf54 /src
parent31a1858a73f26be75a8c7b4189b03f47a68bf9a1 (diff)
parent8cf85bc0dcabcf99775f2b9a7fa2191caea7f164 (diff)
downloadrust-fdaeb0ff12eb5a7d7c310aaad95eef84f2cdce86.tar.gz
rust-fdaeb0ff12eb5a7d7c310aaad95eef84f2cdce86.zip
Rollup merge of #73138 - eggyal:macos-linker-strip, r=petrochenkov
Use shorthand linker strip arguments in order to support MacOS

Per discussion from https://github.com/rust-lang/rust/issues/72110#issuecomment-636609419 onward, the current `-Z strip` options aren't supported by the MacOS linker, but I think only because it doesn't support the longhand arguments `--strip-debug` and `--strip-all`.

This PR switches to using the shorthand arguments `-s` and `-S` instead, which (I believe) are supported by all GCC linkers.
Diffstat (limited to 'src')
-rw-r--r--src/librustc_codegen_ssa/back/linker.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs
index d9fed998c92..b17c3678207 100644
--- a/src/librustc_codegen_ssa/back/linker.rs
+++ b/src/librustc_codegen_ssa/back/linker.rs
@@ -481,10 +481,12 @@ impl<'a> Linker for GccLinker<'a> {
         match strip {
             Strip::None => {}
             Strip::Debuginfo => {
-                self.linker_arg("--strip-debug");
+                // MacOS linker does not support longhand argument --strip-debug
+                self.linker_arg("-S");
             }
             Strip::Symbols => {
-                self.linker_arg("--strip-all");
+                // MacOS linker does not support longhand argument --strip-all
+                self.linker_arg("-s");
             }
         }
     }