@@ -578,6 +578,7 @@ struct ModuleInfo<'a> {
578
578
config : & ' a ModuleConfig ,
579
579
symbols_cache : Option < FileReadInfo > ,
580
580
splits_cache : Option < FileReadInfo > ,
581
+ dep : Vec < Utf8NativePathBuf > ,
581
582
}
582
583
583
584
type ModuleMapByName < ' a > = BTreeMap < String , ModuleInfo < ' a > > ;
@@ -1055,9 +1056,11 @@ fn split_write_obj(
1055
1056
// Generate ldscript.lcf
1056
1057
let ldscript_template = if let Some ( template_path) = & module. config . ldscript_template {
1057
1058
let template_path = template_path. with_encoding ( ) ;
1058
- Some ( fs:: read_to_string ( & template_path) . with_context ( || {
1059
+ let template = fs:: read_to_string ( & template_path) . with_context ( || {
1059
1060
format ! ( "Failed to read linker script template '{}'" , template_path)
1060
- } ) ?)
1061
+ } ) ?;
1062
+ module. dep . push ( template_path) ;
1063
+ Some ( template)
1061
1064
} else {
1062
1065
None
1063
1066
} ;
@@ -1245,6 +1248,7 @@ fn split(args: SplitArgs) -> Result<()> {
1245
1248
config : & config. base ,
1246
1249
symbols_cache : result. symbols_cache ,
1247
1250
splits_cache : result. splits_cache ,
1251
+ dep : Default :: default ( ) ,
1248
1252
}
1249
1253
} ;
1250
1254
let mut function_count = dol. obj . symbols . by_kind ( ObjSymbolKind :: Function ) . count ( ) ;
@@ -1259,6 +1263,7 @@ fn split(args: SplitArgs) -> Result<()> {
1259
1263
config : & config. modules [ idx] ,
1260
1264
symbols_cache : result. symbols_cache ,
1261
1265
splits_cache : result. splits_cache ,
1266
+ dep : Default :: default ( ) ,
1262
1267
} ) ,
1263
1268
Entry :: Occupied ( _) => bail ! ( "Duplicate module name {}" , result. obj. name) ,
1264
1269
} ;
@@ -1440,6 +1445,10 @@ fn split(args: SplitArgs) -> Result<()> {
1440
1445
}
1441
1446
1442
1447
// Write dep file
1448
+ dep. extend ( dol. dep ) ;
1449
+ for module in modules. into_values ( ) {
1450
+ dep. extend ( module. dep ) ;
1451
+ }
1443
1452
{
1444
1453
let dep_path = args. out_dir . join ( "dep" ) ;
1445
1454
let mut dep_file = buf_writer ( & dep_path) ?;
0 commit comments