From 9c681557f506448fb92a58c9d3be57cd508e9309 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Fri, 30 May 2025 19:18:46 -0600 Subject: [PATCH] Write ldscript_template path to ouput depfile --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/cmd/dol.rs | 13 +++++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ec9ca26..bb2e99e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -348,7 +348,7 @@ dependencies = [ [[package]] name = "decomp-toolkit" -version = "1.5.1" +version = "1.5.2" dependencies = [ "aes", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index dade88b..3ef2afa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "decomp-toolkit" description = "Yet another GameCube/Wii decompilation toolkit." authors = ["Luke Street "] license = "MIT OR Apache-2.0" -version = "1.5.1" +version = "1.5.2" edition = "2021" publish = false repository = "https://github.com/encounter/decomp-toolkit" diff --git a/src/cmd/dol.rs b/src/cmd/dol.rs index 01c9d9d..9614d66 100644 --- a/src/cmd/dol.rs +++ b/src/cmd/dol.rs @@ -578,6 +578,7 @@ struct ModuleInfo<'a> { config: &'a ModuleConfig, symbols_cache: Option, splits_cache: Option, + dep: Vec, } type ModuleMapByName<'a> = BTreeMap>; @@ -1055,9 +1056,11 @@ fn split_write_obj( // Generate ldscript.lcf let ldscript_template = if let Some(template_path) = &module.config.ldscript_template { let template_path = template_path.with_encoding(); - Some(fs::read_to_string(&template_path).with_context(|| { + let template = fs::read_to_string(&template_path).with_context(|| { format!("Failed to read linker script template '{}'", template_path) - })?) + })?; + module.dep.push(template_path); + Some(template) } else { None }; @@ -1245,6 +1248,7 @@ fn split(args: SplitArgs) -> Result<()> { config: &config.base, symbols_cache: result.symbols_cache, splits_cache: result.splits_cache, + dep: Default::default(), } }; let mut function_count = dol.obj.symbols.by_kind(ObjSymbolKind::Function).count(); @@ -1259,6 +1263,7 @@ fn split(args: SplitArgs) -> Result<()> { config: &config.modules[idx], symbols_cache: result.symbols_cache, splits_cache: result.splits_cache, + dep: Default::default(), }), Entry::Occupied(_) => bail!("Duplicate module name {}", result.obj.name), }; @@ -1440,6 +1445,10 @@ fn split(args: SplitArgs) -> Result<()> { } // Write dep file + dep.extend(dol.dep); + for module in modules.into_values() { + dep.extend(module.dep); + } { let dep_path = args.out_dir.join("dep"); let mut dep_file = buf_writer(&dep_path)?;