@@ -110,6 +110,7 @@ pub trait Linker {
110
110
fn debuginfo ( & mut self ) ;
111
111
fn no_default_libraries ( & mut self ) ;
112
112
fn build_dylib ( & mut self , out_filename : & Path ) ;
113
+ fn build_static_executable ( & mut self ) ;
113
114
fn args ( & mut self , args : & [ String ] ) ;
114
115
fn export_symbols ( & mut self , tmpdir : & Path , crate_type : CrateType ) ;
115
116
fn subsystem ( & mut self , subsystem : & str ) ;
@@ -179,6 +180,7 @@ impl<'a> Linker for GccLinker<'a> {
179
180
fn position_independent_executable ( & mut self ) { self . cmd . arg ( "-pie" ) ; }
180
181
fn partial_relro ( & mut self ) { self . linker_arg ( "-z,relro" ) ; }
181
182
fn full_relro ( & mut self ) { self . linker_arg ( "-z,relro,-z,now" ) ; }
183
+ fn build_static_executable ( & mut self ) { self . cmd . arg ( "-static" ) ; }
182
184
fn args ( & mut self , args : & [ String ] ) { self . cmd . args ( args) ; }
183
185
184
186
fn link_rust_dylib ( & mut self , lib : & str , _path : & Path ) {
@@ -396,6 +398,10 @@ impl<'a> Linker for MsvcLinker<'a> {
396
398
self . cmd . arg ( arg) ;
397
399
}
398
400
401
+ fn build_static_executable ( & mut self ) {
402
+ // noop
403
+ }
404
+
399
405
fn gc_sections ( & mut self , _keep_metadata : bool ) {
400
406
// MSVC's ICF (Identical COMDAT Folding) link optimization is
401
407
// slow for Rust and thus we disable it by default when not in
@@ -683,6 +689,10 @@ impl<'a> Linker for EmLinker<'a> {
683
689
bug ! ( "building dynamic library is unsupported on Emscripten" )
684
690
}
685
691
692
+ fn build_static_executable ( & mut self ) {
693
+ // noop
694
+ }
695
+
686
696
fn export_symbols ( & mut self , _tmpdir : & Path , crate_type : CrateType ) {
687
697
let symbols = & self . info . exports [ & crate_type] ;
688
698
0 commit comments