about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/back/linker.rs
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2022-02-11 15:08:35 +0800
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2022-03-30 23:53:21 +0300
commit1004783ef9bdcf006f0ed33badacf83a5934feb2 (patch)
tree9db8e33f5809076953c29ae6e7bc569266f48130 /compiler/rustc_codegen_ssa/src/back/linker.rs
parentbb5c437a2ce9ccf2204c974300c5ea9eb32d3635 (diff)
downloadrust-1004783ef9bdcf006f0ed33badacf83a5934feb2.tar.gz
rust-1004783ef9bdcf006f0ed33badacf83a5934feb2.zip
Stabilize native library modifier syntax and the `whole-archive` modifier specifically
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/back/linker.rs')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/linker.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs
index a838787381d..3a66bfafaf3 100644
--- a/compiler/rustc_codegen_ssa/src/back/linker.rs
+++ b/compiler/rustc_codegen_ssa/src/back/linker.rs
@@ -186,6 +186,9 @@ pub trait Linker {
     fn no_crt_objects(&mut self);
     fn no_default_libraries(&mut self);
     fn export_symbols(&mut self, tmpdir: &Path, crate_type: CrateType, symbols: &[String]);
+    fn exported_symbol_means_used_symbol(&self) -> bool {
+        true
+    }
     fn subsystem(&mut self, subsystem: &str);
     fn group_start(&mut self);
     fn group_end(&mut self);
@@ -724,6 +727,10 @@ impl<'a> Linker for GccLinker<'a> {
         }
     }
 
+    fn exported_symbol_means_used_symbol(&self) -> bool {
+        self.sess.target.is_like_windows || self.sess.target.is_like_osx
+    }
+
     fn subsystem(&mut self, subsystem: &str) {
         self.linker_arg("--subsystem");
         self.linker_arg(&subsystem);
@@ -1471,6 +1478,10 @@ impl<'a> Linker for L4Bender<'a> {
         return;
     }
 
+    fn exported_symbol_means_used_symbol(&self) -> bool {
+        false
+    }
+
     fn subsystem(&mut self, subsystem: &str) {
         self.cmd.arg(&format!("--subsystem {}", subsystem));
     }