@@ -110,6 +110,7 @@ pub trait Linker {
110110 fn debuginfo ( & mut self ) ;
111111 fn no_default_libraries ( & mut self ) ;
112112 fn build_dylib ( & mut self , out_filename : & Path ) ;
113+ fn build_static_executable ( & mut self ) ;
113114 fn args ( & mut self , args : & [ String ] ) ;
114115 fn export_symbols ( & mut self , tmpdir : & Path , crate_type : CrateType ) ;
115116 fn subsystem ( & mut self , subsystem : & str ) ;
@@ -179,6 +180,7 @@ impl<'a> Linker for GccLinker<'a> {
179180 fn position_independent_executable ( & mut self ) { self . cmd . arg ( "-pie" ) ; }
180181 fn partial_relro ( & mut self ) { self . linker_arg ( "-z,relro" ) ; }
181182 fn full_relro ( & mut self ) { self . linker_arg ( "-z,relro,-z,now" ) ; }
183+ fn build_static_executable ( & mut self ) { self . cmd . arg ( "-static" ) ; }
182184 fn args ( & mut self , args : & [ String ] ) { self . cmd . args ( args) ; }
183185
184186 fn link_rust_dylib ( & mut self , lib : & str , _path : & Path ) {
@@ -396,6 +398,10 @@ impl<'a> Linker for MsvcLinker<'a> {
396398 self . cmd . arg ( arg) ;
397399 }
398400
401+ fn build_static_executable ( & mut self ) {
402+ // noop
403+ }
404+
399405 fn gc_sections ( & mut self , _keep_metadata : bool ) {
400406 // MSVC's ICF (Identical COMDAT Folding) link optimization is
401407 // slow for Rust and thus we disable it by default when not in
@@ -683,6 +689,10 @@ impl<'a> Linker for EmLinker<'a> {
683689 bug ! ( "building dynamic library is unsupported on Emscripten" )
684690 }
685691
692+ fn build_static_executable ( & mut self ) {
693+ // noop
694+ }
695+
686696 fn export_symbols ( & mut self , _tmpdir : & Path , crate_type : CrateType ) {
687697 let symbols = & self . info . exports [ & crate_type] ;
688698
0 commit comments