@@ -78,9 +78,7 @@ impl LinkerInfo {
78
78
as Box < dyn Linker >
79
79
}
80
80
81
- LinkerFlavor :: L4Bender => {
82
- Box :: new ( L4Bender :: new ( cmd, sess) ) as Box < dyn Linker >
83
- } ,
81
+ LinkerFlavor :: L4Bender => Box :: new ( L4Bender :: new ( cmd, sess) ) as Box < dyn Linker > ,
84
82
LinkerFlavor :: Lld ( LldFlavor :: Wasm ) => {
85
83
Box :: new ( WasmLd :: new ( cmd, sess, self ) ) as Box < dyn Linker >
86
84
}
@@ -1296,10 +1294,10 @@ pub struct L4Bender<'a> {
1296
1294
}
1297
1295
1298
1296
impl < ' a > Linker for L4Bender < ' a > {
1299
- fn link_dylib ( & mut self , _lib : Symbol ) {
1300
- panic ! ( "dylibs not supported yet" )
1297
+ fn link_dylib ( & mut self , _lib : Symbol , _verbatim : bool , _as_needed : bool ) {
1298
+ bug ! ( "dylibs are not supported on L4Re" ) ;
1301
1299
}
1302
- fn link_staticlib ( & mut self , lib : Symbol ) {
1300
+ fn link_staticlib ( & mut self , lib : Symbol , _verbatim : bool ) {
1303
1301
self . hint_static ( ) ;
1304
1302
self . cmd . arg ( format ! ( "-PC{}" , lib) ) ;
1305
1303
}
@@ -1311,36 +1309,43 @@ impl<'a> Linker for L4Bender<'a> {
1311
1309
self . cmd . arg ( "-L" ) . arg ( path) ;
1312
1310
}
1313
1311
fn framework_path ( & mut self , _: & Path ) {
1314
- bug ! ( "Frameworks are not supported on L4Re!" ) ;
1315
- }
1316
- fn output_filename ( & mut self , path : & Path ) { self . cmd . arg ( "-o" ) . arg ( path) ; }
1317
- fn add_object ( & mut self , path : & Path ) { self . cmd . arg ( path) ; }
1318
- // not sure about pie on L4Re
1319
- fn position_independent_executable ( & mut self ) { }
1320
- fn no_position_independent_executable ( & mut self ) { }
1321
- fn full_relro ( & mut self ) { self . cmd . arg ( "-z,relro,-z,now" ) ; }
1322
- fn partial_relro ( & mut self ) { self . cmd . arg ( "-z,relro" ) ; }
1323
- fn no_relro ( & mut self ) { self . cmd . arg ( "-z,norelro" ) ; }
1324
- fn build_static_executable ( & mut self ) { self . cmd . arg ( "-static" ) ; }
1312
+ bug ! ( "frameworks are not supported on L4Re" ) ;
1313
+ }
1314
+ fn output_filename ( & mut self , path : & Path ) {
1315
+ self . cmd . arg ( "-o" ) . arg ( path) ;
1316
+ }
1317
+
1318
+ fn add_object ( & mut self , path : & Path ) {
1319
+ self . cmd . arg ( path) ;
1320
+ }
1321
+
1322
+ fn full_relro ( & mut self ) {
1323
+ self . cmd . arg ( "-z,relro,-z,now" ) ;
1324
+ }
1325
+
1326
+ fn partial_relro ( & mut self ) {
1327
+ self . cmd . arg ( "-z,relro" ) ;
1328
+ }
1329
+
1330
+ fn no_relro ( & mut self ) {
1331
+ self . cmd . arg ( "-z,norelro" ) ;
1332
+ }
1333
+
1325
1334
fn cmd ( & mut self ) -> & mut Command {
1326
1335
& mut self . cmd
1327
1336
}
1328
1337
1338
+ fn set_output_kind ( & mut self , _output_kind : LinkOutputKind , _out_filename : & Path ) { }
1339
+
1329
1340
fn link_rust_dylib ( & mut self , _: Symbol , _: & Path ) {
1330
1341
panic ! ( "Rust dylibs not supported" ) ;
1331
1342
}
1332
1343
1333
- fn link_framework ( & mut self , _ : Symbol ) {
1334
- bug ! ( "Frameworks not supported on L4Re. " ) ;
1344
+ fn link_framework ( & mut self , _framework : Symbol , _as_needed : bool ) {
1345
+ bug ! ( "frameworks not supported on L4Re" ) ;
1335
1346
}
1336
1347
1337
- // Here we explicitly ask that the entire archive is included into the
1338
- // result artifact. For more details see #15460, but the gist is that
1339
- // the linker will strip away any unused objects in the archive if we
1340
- // don't otherwise explicitly reference them. This can occur for
1341
- // libraries which are just providing bindings, libraries with generic
1342
- // functions, etc.
1343
- fn link_whole_staticlib ( & mut self , lib : Symbol , _: & [ PathBuf ] ) {
1348
+ fn link_whole_staticlib ( & mut self , lib : Symbol , _verbatim : bool , _search_path : & [ PathBuf ] ) {
1344
1349
self . hint_static ( ) ;
1345
1350
self . cmd . arg ( "--whole-archive" ) . arg ( format ! ( "-l{}" , lib) ) ;
1346
1351
self . cmd . arg ( "--no-whole-archive" ) ;
@@ -1357,17 +1362,22 @@ impl<'a> Linker for L4Bender<'a> {
1357
1362
}
1358
1363
}
1359
1364
1365
+ fn no_gc_sections ( & mut self ) {
1366
+ self . cmd . arg ( "--no-gc-sections" ) ;
1367
+ }
1368
+
1360
1369
fn optimize ( & mut self ) {
1361
1370
self . cmd . arg ( "-O2" ) ;
1362
1371
}
1363
1372
1364
- fn pgo_gen ( & mut self ) { }
1373
+ fn pgo_gen ( & mut self ) { }
1365
1374
1366
1375
fn debuginfo ( & mut self , strip : Strip ) {
1367
1376
match strip {
1368
1377
Strip :: None => { }
1369
1378
Strip :: Debuginfo => {
1370
- self . cmd ( ) . arg ( "--strip-debug" ) ; }
1379
+ self . cmd ( ) . arg ( "--strip-debug" ) ;
1380
+ }
1371
1381
Strip :: Symbols => {
1372
1382
self . cmd ( ) . arg ( "--strip-all" ) ;
1373
1383
}
@@ -1378,33 +1388,33 @@ impl<'a> Linker for L4Bender<'a> {
1378
1388
self . cmd . arg ( "-nostdlib" ) ;
1379
1389
}
1380
1390
1381
- fn build_dylib ( & mut self , _: & Path ) {
1382
- bug ! ( "not implemented" ) ;
1383
- }
1384
-
1385
1391
fn export_symbols ( & mut self , _: & Path , _: CrateType ) {
1386
1392
// ToDo, not implemented, copy from GCC
1393
+ self . sess . warn ( "exporting symbols not implemented yet for L4Bender" ) ;
1387
1394
return ;
1388
1395
}
1389
1396
1390
1397
fn subsystem ( & mut self , subsystem : & str ) {
1391
1398
self . cmd . arg ( & format ! ( "--subsystem,{}" , subsystem) ) ;
1392
1399
}
1393
1400
1394
- fn finalize ( & mut self ) {
1401
+ fn reset_per_library_state ( & mut self ) {
1395
1402
self . hint_static ( ) ; // Reset to default before returning the composed command line.
1396
1403
}
1397
1404
1398
- fn group_start ( & mut self ) { self . cmd . arg ( "--start-group" ) ; }
1399
- fn group_end ( & mut self ) { self . cmd . arg ( "--end-group" ) ; }
1400
- fn linker_plugin_lto ( & mut self ) {
1401
- // do nothing
1405
+ fn group_start ( & mut self ) {
1406
+ self . cmd . arg ( "--start-group" ) ;
1402
1407
}
1403
- fn control_flow_guard ( & mut self ) {
1404
- self . sess . warn ( "Windows Control Flow Guard is not supported by this linker." ) ;
1408
+
1409
+ fn group_end ( & mut self ) {
1410
+ self . cmd . arg ( "--end-group" ) ;
1405
1411
}
1406
1412
1407
- fn no_crt_objects ( & mut self ) { }
1413
+ fn linker_plugin_lto ( & mut self ) { }
1414
+
1415
+ fn control_flow_guard ( & mut self ) { }
1416
+
1417
+ fn no_crt_objects ( & mut self ) { }
1408
1418
}
1409
1419
1410
1420
impl < ' a > L4Bender < ' a > {
@@ -1415,11 +1425,7 @@ impl<'a> L4Bender<'a> {
1415
1425
1416
1426
cmd. arg ( "--" ) ; // separate direct l4-bender args from linker args
1417
1427
1418
- L4Bender {
1419
- cmd : cmd,
1420
- sess : sess,
1421
- hinted_static : false ,
1422
- }
1428
+ L4Bender { cmd : cmd, sess : sess, hinted_static : false }
1423
1429
}
1424
1430
1425
1431
/// This parses a shell-escaped string and unquotes the arguments. It doesn't attempt to
@@ -1435,7 +1441,7 @@ impl<'a> L4Bender<'a> {
1435
1441
' ' if !quoted => {
1436
1442
cmd. arg ( & arg) ;
1437
1443
arg. clear ( ) ;
1438
- } ,
1444
+ }
1439
1445
'"' | '\'' => quoted = !quoted,
1440
1446
_ => arg. push ( character) ,
1441
1447
} ;
0 commit comments