about summary refs log tree commit diff
path: root/src/librustc_codegen_ssa
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2020-04-11 14:53:39 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2020-04-13 18:37:51 +0300
commitcfe90ebfe3599bebf301dbac3e74ed557f7ecf24 (patch)
tree42d420e9311756c9c6849511b7c6c68876a57de2 /src/librustc_codegen_ssa
parent7a4f059add44699af6d24abdcfd39f429dd54084 (diff)
linker: Pass `/NODEFAULTLIB` in a more regular way
Diffstat (limited to 'src/librustc_codegen_ssa')
-rw-r--r--src/librustc_codegen_ssa/back/link.rs9
-rw-r--r--src/librustc_codegen_ssa/back/linker.rs10
2 files changed, 3 insertions, 16 deletions
diff --git a/src/librustc_codegen_ssa/back/link.rs b/src/librustc_codegen_ssa/back/link.rs
index 5f7a1938a33..d58d9b91c73 100644
--- a/src/librustc_codegen_ssa/back/link.rs
+++ b/src/librustc_codegen_ssa/back/link.rs
@@ -1532,13 +1532,8 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>(
     cmd.debuginfo();
 
     // OBJECT-FILES-NO, AUDIT-ORDER
-    // We want to, by default, prevent the compiler from accidentally leaking in
-    // any system libraries, so we may explicitly ask linkers to not link to any
-    // libraries by default. Note that this does not happen for windows because
-    // windows pulls in some large number of libraries and I couldn't quite
-    // figure out which subset we wanted.
-    //
-    // This is all naturally configurable via the standard methods as well.
+    // 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.
     if !sess.opts.cg.default_linker_libraries.unwrap_or(false)
         && sess.target.target.options.no_default_libraries
     {
diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs
index 0baa37ae9f1..d8c5ddf586f 100644
--- a/src/librustc_codegen_ssa/back/linker.rs
+++ b/src/librustc_codegen_ssa/back/linker.rs
@@ -631,15 +631,7 @@ impl<'a> Linker for MsvcLinker<'a> {
     }
 
     fn no_default_libraries(&mut self) {
-        // Currently we don't pass the /NODEFAULTLIB flag to the linker on MSVC
-        // as there's been trouble in the past of linking the C++ standard
-        // library required by LLVM. This likely needs to happen one day, but
-        // in general Windows is also a more controlled environment than
-        // Unix, so it's not necessarily as critical that this be implemented.
-        //
-        // Note that there are also some licensing worries about statically
-        // linking some libraries which require a specific agreement, so it may
-        // not ever be possible for us to pass this flag.
+        self.cmd.arg("/NODEFAULTLIB");
     }
 
     fn include_path(&mut self, path: &Path) {