@@ -218,24 +218,26 @@ impl<'a> GccLinker<'a> {
218218}
219219
220220impl < ' a > Linker for GccLinker < ' a > {
221- fn link_dylib ( & mut self , lib : & str ) { self . hint_dynamic ( ) ; self . cmd . arg ( "-l" ) . arg ( lib) ; }
222- fn link_staticlib ( & mut self , lib : & str ) { self . hint_static ( ) ; self . cmd . arg ( "-l" ) . arg ( lib) ; }
221+ fn link_dylib ( & mut self , lib : & str ) { self . hint_dynamic ( ) ; self . cmd . arg ( format ! ( "-l{}" , lib) ) ; }
222+ fn link_staticlib ( & mut self , lib : & str ) {
223+ self . hint_static ( ) ; self . cmd . arg ( format ! ( "-l{}" , lib) ) ;
224+ }
223225 fn link_rlib ( & mut self , lib : & Path ) { self . hint_static ( ) ; self . cmd . arg ( lib) ; }
224226 fn include_path ( & mut self , path : & Path ) { self . cmd . arg ( "-L" ) . arg ( path) ; }
225227 fn framework_path ( & mut self , path : & Path ) { self . cmd . arg ( "-F" ) . arg ( path) ; }
226228 fn output_filename ( & mut self , path : & Path ) { self . cmd . arg ( "-o" ) . arg ( path) ; }
227229 fn add_object ( & mut self , path : & Path ) { self . cmd . arg ( path) ; }
228230 fn position_independent_executable ( & mut self ) { self . cmd . arg ( "-pie" ) ; }
229231 fn no_position_independent_executable ( & mut self ) { self . cmd . arg ( "-no-pie" ) ; }
230- fn full_relro ( & mut self ) { self . linker_arg ( "-z,relro,-z,now " ) ; }
231- fn partial_relro ( & mut self ) { self . linker_arg ( "-z,relro " ) ; }
232- fn no_relro ( & mut self ) { self . linker_arg ( "-z,norelro " ) ; }
232+ fn full_relro ( & mut self ) { self . linker_arg ( "-zrelro" ) ; self . linker_arg ( "-znow ") ; }
233+ fn partial_relro ( & mut self ) { self . linker_arg ( "-zrelro " ) ; }
234+ fn no_relro ( & mut self ) { self . linker_arg ( "-znorelro " ) ; }
233235 fn build_static_executable ( & mut self ) { self . cmd . arg ( "-static" ) ; }
234236 fn args ( & mut self , args : & [ String ] ) { self . cmd . args ( args) ; }
235237
236238 fn link_rust_dylib ( & mut self , lib : & str , _path : & Path ) {
237239 self . hint_dynamic ( ) ;
238- self . cmd . arg ( "-l" ) . arg ( lib) ;
240+ self . cmd . arg ( format ! ( "-l{}" , lib) ) ;
239241 }
240242
241243 fn link_framework ( & mut self , framework : & str ) {
@@ -253,23 +255,22 @@ impl<'a> Linker for GccLinker<'a> {
253255 self . hint_static ( ) ;
254256 let target = & self . sess . target . target ;
255257 if !target. options . is_like_osx {
256- self . linker_arg ( "--whole-archive" ) . cmd . arg ( "-l" ) . arg ( lib) ;
258+ self . linker_arg ( "--whole-archive" ) . cmd . arg ( format ! ( "-l{}" , lib) ) ;
257259 self . linker_arg ( "--no-whole-archive" ) ;
258260 } else {
259261 // -force_load is the macOS equivalent of --whole-archive, but it
260262 // involves passing the full path to the library to link.
261- let mut v = OsString :: from ( "-force_load, " ) ;
262- v . push ( & archive:: find_library ( lib, search_path, & self . sess ) ) ;
263- self . linker_arg ( & v ) ;
263+ self . linker_arg ( "-force_load" ) ;
264+ let lib = archive:: find_library ( lib, search_path, & self . sess ) ;
265+ self . linker_arg ( & lib ) ;
264266 }
265267 }
266268
267269 fn link_whole_rlib ( & mut self , lib : & Path ) {
268270 self . hint_static ( ) ;
269271 if self . sess . target . target . options . is_like_osx {
270- let mut v = OsString :: from ( "-force_load," ) ;
271- v. push ( lib) ;
272- self . linker_arg ( & v) ;
272+ self . linker_arg ( "-force_load" ) ;
273+ self . linker_arg ( & lib) ;
273274 } else {
274275 self . linker_arg ( "--whole-archive" ) . cmd . arg ( lib) ;
275276 self . linker_arg ( "--no-whole-archive" ) ;
@@ -294,8 +295,7 @@ impl<'a> Linker for GccLinker<'a> {
294295 if self . sess . target . target . options . is_like_osx {
295296 self . linker_arg ( "-dead_strip" ) ;
296297 } else if self . sess . target . target . options . is_like_solaris {
297- self . linker_arg ( "-z" ) ;
298- self . linker_arg ( "ignore" ) ;
298+ self . linker_arg ( "-zignore" ) ;
299299
300300 // If we're building a dylib, we don't use --gc-sections because LLVM
301301 // has already done the best it can do, and we also don't want to
@@ -369,7 +369,8 @@ impl<'a> Linker for GccLinker<'a> {
369369 // the right `-Wl,-install_name` with an `@rpath` in it.
370370 if self . sess . opts . cg . rpath ||
371371 self . sess . opts . debugging_opts . osx_rpath_install_name {
372- let mut v = OsString :: from ( "-install_name,@rpath/" ) ;
372+ self . linker_arg ( "-install_name" ) ;
373+ let mut v = OsString :: from ( "@rpath/" ) ;
373374 v. push ( out_filename. file_name ( ) . unwrap ( ) ) ;
374375 self . linker_arg ( & v) ;
375376 }
@@ -448,7 +449,7 @@ impl<'a> Linker for GccLinker<'a> {
448449 }
449450
450451 fn subsystem ( & mut self , subsystem : & str ) {
451- self . linker_arg ( & format ! ( "--subsystem, {}" , subsystem) ) ;
452+ self . linker_arg ( & format ! ( "--subsystem= {}" , subsystem) ) ;
452453 }
453454
454455 fn finalize ( & mut self ) -> Command {
0 commit comments