@@ -649,10 +649,6 @@ impl Build {
649649 self . ar . get ( & target) . map ( |p| & * * p)
650650 }
651651
652- fn linker ( & self , target : Interned < String > ) -> Option < & Path > {
653- self . config . target_config . get ( & target) . and_then ( |c| c. linker . as_ref ( ) . map ( |p| & * * p) )
654- }
655-
656652 /// Returns the path to the C++ compiler for the target specified.
657653 fn cxx ( & self , target : Interned < String > ) -> Result < & Path , String > {
658654 match self . cxx . get ( & target) {
@@ -663,24 +659,16 @@ impl Build {
663659 }
664660 }
665661
666- /// Returns flags to pass to the compiler to generate code for `target`.
667- fn rustc_flags ( & self , target : Interned < String > ) -> Vec < String > {
668- // New flags should be added here with great caution!
669- //
670- // It's quite unfortunate to **require** flags to generate code for a
671- // target, so it should only be passed here if absolutely necessary!
672- // Most default configuration should be done through target specs rather
673- // than an entry here.
674-
675- let mut base = Vec :: new ( ) ;
676- if let Some ( linker) = self . linker ( target) {
677- // If linker was explictly provided, force it on all the compiled Rust code.
678- base. push ( format ! ( "-Clinker={}" , linker. display( ) ) ) ;
679- } else if target != self . config . build && !target. contains ( "msvc" ) &&
680- !target. contains ( "emscripten" ) {
681- base. push ( format ! ( "-Clinker={}" , self . cc( target) . display( ) ) ) ;
662+ /// Returns the path to the linker for the given target if it needs to be overriden.
663+ fn linker ( & self , target : Interned < String > ) -> Option < & Path > {
664+ if let Some ( config) = self . config . target_config . get ( & target) {
665+ config. linker . as_ref ( ) . map ( |p| & * * p)
666+ } else if target != self . config . build &&
667+ !target. contains ( "msvc" ) && !target. contains ( "emscripten" ) {
668+ Some ( self . cc ( target) )
669+ } else {
670+ None
682671 }
683- base
684672 }
685673
686674 /// Returns if this target should statically link the C runtime, if specified
0 commit comments