File tree Expand file tree Collapse file tree 5 files changed +23
-19
lines changed
librustc_codegen_ssa/back Expand file tree Collapse file tree 5 files changed +23
-19
lines changed Original file line number Diff line number Diff line change @@ -1532,13 +1532,8 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>(
15321532 cmd. debuginfo ( ) ;
15331533
15341534 // OBJECT-FILES-NO, AUDIT-ORDER
1535- // We want to, by default, prevent the compiler from accidentally leaking in
1536- // any system libraries, so we may explicitly ask linkers to not link to any
1537- // libraries by default. Note that this does not happen for windows because
1538- // windows pulls in some large number of libraries and I couldn't quite
1539- // figure out which subset we wanted.
1540- //
1541- // This is all naturally configurable via the standard methods as well.
1535+ // We want to prevent the compiler from accidentally leaking in any system libraries,
1536+ // so by default we tell linkers not to link to any default libraries.
15421537 if !sess. opts . cg . default_linker_libraries . unwrap_or ( false )
15431538 && sess. target . target . options . no_default_libraries
15441539 {
Original file line number Diff line number Diff line change @@ -631,15 +631,7 @@ impl<'a> Linker for MsvcLinker<'a> {
631631 }
632632
633633 fn no_default_libraries ( & mut self ) {
634- // Currently we don't pass the /NODEFAULTLIB flag to the linker on MSVC
635- // as there's been trouble in the past of linking the C++ standard
636- // library required by LLVM. This likely needs to happen one day, but
637- // in general Windows is also a more controlled environment than
638- // Unix, so it's not necessarily as critical that this be implemented.
639- //
640- // Note that there are also some licensing worries about statically
641- // linking some libraries which require a specific agreement, so it may
642- // not ever be possible for us to pass this flag.
634+ self . cmd . arg ( "/NODEFAULTLIB" ) ;
643635 }
644636
645637 fn include_path ( & mut self , path : & Path ) {
Original file line number Diff line number Diff line change @@ -23,9 +23,6 @@ pub fn opts() -> TargetOptions {
2323 // will fail if the compiler ever tries placing code on the stack (e.g., trampoline
2424 // constructs and alike).
2525 "/NXCOMPAT" . to_string( ) ,
26- // There is no runtime for UEFI targets, prevent them from being linked. UEFI targets
27- // must be freestanding.
28- "/nodefaultlib" . to_string( ) ,
2926 // Non-standard subsystems have no default entry-point in PE+ files. We have to define
3027 // one. "efi_main" seems to be a common choice amongst other implementations and the
3128 // spec.
Original file line number Diff line number Diff line change @@ -30,6 +30,16 @@ pub fn opts() -> TargetOptions {
3030 abi_return_struct_as_int : true ,
3131 emit_debug_gdb_scripts : false ,
3232 requires_uwtable : true ,
33+ // Currently we don't pass the /NODEFAULTLIB flag to the linker on MSVC
34+ // as there's been trouble in the past of linking the C++ standard
35+ // library required by LLVM. This likely needs to happen one day, but
36+ // in general Windows is also a more controlled environment than
37+ // Unix, so it's not necessarily as critical that this be implemented.
38+ //
39+ // Note that there are also some licensing worries about statically
40+ // linking some libraries which require a specific agreement, so it may
41+ // not ever be possible for us to pass this flag.
42+ no_default_libraries : false ,
3343
3444 ..Default :: default ( )
3545 }
Original file line number Diff line number Diff line change @@ -31,6 +31,16 @@ pub fn opts() -> TargetOptions {
3131 emit_debug_gdb_scripts : false ,
3232 requires_uwtable : true ,
3333 lld_flavor : LldFlavor :: Link ,
34+ // Currently we don't pass the /NODEFAULTLIB flag to the linker on MSVC
35+ // as there's been trouble in the past of linking the C++ standard
36+ // library required by LLVM. This likely needs to happen one day, but
37+ // in general Windows is also a more controlled environment than
38+ // Unix, so it's not necessarily as critical that this be implemented.
39+ //
40+ // Note that there are also some licensing worries about statically
41+ // linking some libraries which require a specific agreement, so it may
42+ // not ever be possible for us to pass this flag.
43+ no_default_libraries : false ,
3444
3545 ..Default :: default ( )
3646 }
You can’t perform that action at this time.
0 commit comments