about summary refs log tree commit diff
path: root/src/librustc_target/spec
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_target/spec
parent7a4f059add44699af6d24abdcfd39f429dd54084 (diff)
downloadrust-cfe90ebfe3599bebf301dbac3e74ed557f7ecf24.tar.gz
rust-cfe90ebfe3599bebf301dbac3e74ed557f7ecf24.zip
linker: Pass `/NODEFAULTLIB` in a more regular way
Diffstat (limited to 'src/librustc_target/spec')
-rw-r--r--src/librustc_target/spec/uefi_base.rs3
-rw-r--r--src/librustc_target/spec/windows_msvc_base.rs10
-rw-r--r--src/librustc_target/spec/windows_uwp_msvc_base.rs10
3 files changed, 20 insertions, 3 deletions
diff --git a/src/librustc_target/spec/uefi_base.rs b/src/librustc_target/spec/uefi_base.rs
index 030eb12eb0e..6f5e1badfb6 100644
--- a/src/librustc_target/spec/uefi_base.rs
+++ b/src/librustc_target/spec/uefi_base.rs
@@ -23,9 +23,6 @@ pub fn opts() -> TargetOptions {
         // will fail if the compiler ever tries placing code on the stack (e.g., trampoline
         // constructs and alike).
         "/NXCOMPAT".to_string(),
-        // There is no runtime for UEFI targets, prevent them from being linked. UEFI targets
-        // must be freestanding.
-        "/nodefaultlib".to_string(),
         // Non-standard subsystems have no default entry-point in PE+ files. We have to define
         // one. "efi_main" seems to be a common choice amongst other implementations and the
         // spec.
diff --git a/src/librustc_target/spec/windows_msvc_base.rs b/src/librustc_target/spec/windows_msvc_base.rs
index 78567a4382b..dc56dd916ff 100644
--- a/src/librustc_target/spec/windows_msvc_base.rs
+++ b/src/librustc_target/spec/windows_msvc_base.rs
@@ -30,6 +30,16 @@ pub fn opts() -> TargetOptions {
         abi_return_struct_as_int: true,
         emit_debug_gdb_scripts: false,
         requires_uwtable: true,
+        // 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.
+        no_default_libraries: false,
 
         ..Default::default()
     }
diff --git a/src/librustc_target/spec/windows_uwp_msvc_base.rs b/src/librustc_target/spec/windows_uwp_msvc_base.rs
index 9497e525dd9..2c70ba7abe2 100644
--- a/src/librustc_target/spec/windows_uwp_msvc_base.rs
+++ b/src/librustc_target/spec/windows_uwp_msvc_base.rs
@@ -31,6 +31,16 @@ pub fn opts() -> TargetOptions {
         emit_debug_gdb_scripts: false,
         requires_uwtable: true,
         lld_flavor: LldFlavor::Link,
+        // 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.
+        no_default_libraries: false,
 
         ..Default::default()
     }