Skip to content

Commit 788ffb9

Browse files
committed
Fix empty .lcf FORCEACTIVE with symbols_known
1 parent 6abe6cc commit 788ffb9

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "decomp-toolkit"
33
description = "Yet another GameCube/Wii decompilation toolkit."
44
authors = ["Luke Street <luke@street.dev>"]
55
license = "MIT OR Apache-2.0"
6-
version = "0.4.0"
6+
version = "0.4.1"
77
edition = "2021"
88
publish = false
99
build = "build.rs"

src/cmd/dol.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ fn info(args: InfoArgs) -> Result<()> {
441441

442442
type ModuleMap<'a> = BTreeMap<u32, (&'a ModuleConfig, ObjInfo)>;
443443

444-
fn update_symbols(obj: &mut ObjInfo, modules: &ModuleMap<'_>) -> Result<()> {
444+
fn update_symbols(obj: &mut ObjInfo, modules: &ModuleMap<'_>, create_symbols: bool) -> Result<()> {
445445
log::debug!("Updating symbols for module {}", obj.module_id);
446446

447447
// Find all references to this module from other modules
@@ -482,7 +482,7 @@ fn update_symbols(obj: &mut ObjInfo, modules: &ModuleMap<'_>) -> Result<()> {
482482
symbol.name
483483
);
484484
obj.symbols.flags(symbol_index).set_force_active(true);
485-
} else {
485+
} else if create_symbols {
486486
// Add label
487487
log::trace!(
488488
"Creating label in section {} at {:#010X}",
@@ -942,13 +942,11 @@ fn split(args: SplitArgs) -> Result<()> {
942942
let module_ids = modules.keys().cloned().collect_vec();
943943

944944
// Create any missing symbols (referenced from other modules) and set FORCEACTIVE
945-
if !config.symbols_known {
946-
update_symbols(&mut obj, &modules)?;
947-
for &module_id in &module_ids {
948-
let (module_config, mut module_obj) = modules.remove(&module_id).unwrap();
949-
update_symbols(&mut module_obj, &modules)?;
950-
modules.insert(module_id, (module_config, module_obj));
951-
}
945+
update_symbols(&mut obj, &modules, !config.symbols_known)?;
946+
for &module_id in &module_ids {
947+
let (module_config, mut module_obj) = modules.remove(&module_id).unwrap();
948+
update_symbols(&mut module_obj, &modules, !config.symbols_known)?;
949+
modules.insert(module_id, (module_config, module_obj));
952950
}
953951

954952
// Create relocations to symbols in other modules

src/util/map.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ impl StateMachine {
272272
if symbol.name.starts_with('.') // ...rodata.0
273273
|| symbol.name.starts_with('@') // @123
274274
|| symbol.name.starts_with("__sinit")
275+
|| symbol.name.contains('$') // local$1234
275276
|| symbol_occurrences.get(&symbol.name).cloned().unwrap_or(0) > 1
276277
{
277278
symbol.visibility = SymbolVisibility::Local;

0 commit comments

Comments
 (0)