@@ -218,24 +218,26 @@ impl<'a> GccLinker<'a> {
218
218
}
219
219
220
220
impl < ' 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
+ }
223
225
fn link_rlib ( & mut self , lib : & Path ) { self . hint_static ( ) ; self . cmd . arg ( lib) ; }
224
226
fn include_path ( & mut self , path : & Path ) { self . cmd . arg ( "-L" ) . arg ( path) ; }
225
227
fn framework_path ( & mut self , path : & Path ) { self . cmd . arg ( "-F" ) . arg ( path) ; }
226
228
fn output_filename ( & mut self , path : & Path ) { self . cmd . arg ( "-o" ) . arg ( path) ; }
227
229
fn add_object ( & mut self , path : & Path ) { self . cmd . arg ( path) ; }
228
230
fn position_independent_executable ( & mut self ) { self . cmd . arg ( "-pie" ) ; }
229
231
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 " ) ; }
233
235
fn build_static_executable ( & mut self ) { self . cmd . arg ( "-static" ) ; }
234
236
fn args ( & mut self , args : & [ String ] ) { self . cmd . args ( args) ; }
235
237
236
238
fn link_rust_dylib ( & mut self , lib : & str , _path : & Path ) {
237
239
self . hint_dynamic ( ) ;
238
- self . cmd . arg ( "-l" ) . arg ( lib) ;
240
+ self . cmd . arg ( format ! ( "-l{}" , lib) ) ;
239
241
}
240
242
241
243
fn link_framework ( & mut self , framework : & str ) {
@@ -253,23 +255,22 @@ impl<'a> Linker for GccLinker<'a> {
253
255
self . hint_static ( ) ;
254
256
let target = & self . sess . target . target ;
255
257
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) ) ;
257
259
self . linker_arg ( "--no-whole-archive" ) ;
258
260
} else {
259
261
// -force_load is the macOS equivalent of --whole-archive, but it
260
262
// 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 ) ;
264
266
}
265
267
}
266
268
267
269
fn link_whole_rlib ( & mut self , lib : & Path ) {
268
270
self . hint_static ( ) ;
269
271
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) ;
273
274
} else {
274
275
self . linker_arg ( "--whole-archive" ) . cmd . arg ( lib) ;
275
276
self . linker_arg ( "--no-whole-archive" ) ;
@@ -294,8 +295,7 @@ impl<'a> Linker for GccLinker<'a> {
294
295
if self . sess . target . target . options . is_like_osx {
295
296
self . linker_arg ( "-dead_strip" ) ;
296
297
} 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" ) ;
299
299
300
300
// If we're building a dylib, we don't use --gc-sections because LLVM
301
301
// 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> {
369
369
// the right `-Wl,-install_name` with an `@rpath` in it.
370
370
if self . sess . opts . cg . rpath ||
371
371
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/" ) ;
373
374
v. push ( out_filename. file_name ( ) . unwrap ( ) ) ;
374
375
self . linker_arg ( & v) ;
375
376
}
@@ -448,7 +449,7 @@ impl<'a> Linker for GccLinker<'a> {
448
449
}
449
450
450
451
fn subsystem ( & mut self , subsystem : & str ) {
451
- self . linker_arg ( & format ! ( "--subsystem, {}" , subsystem) ) ;
452
+ self . linker_arg ( & format ! ( "--subsystem= {}" , subsystem) ) ;
452
453
}
453
454
454
455
fn finalize ( & mut self ) -> Command {
0 commit comments