From 18170a96a2ea352b7a45fa29d515e84c5854ba85 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sun, 10 Sep 2023 02:20:08 -0400 Subject: [PATCH] Don't use map in `dol diff` and `dol apply`; remove common BSS hack --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/cmd/dol.rs | 12 ------------ src/util/split.rs | 18 ------------------ 4 files changed, 2 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d5ca81c..1e0116c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -307,7 +307,7 @@ dependencies = [ [[package]] name = "decomp-toolkit" -version = "0.4.1" +version = "0.4.2" dependencies = [ "anyhow", "ar", diff --git a/Cargo.toml b/Cargo.toml index 76c4996..0d274a5 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 = "0.4.1" +version = "0.4.2" edition = "2021" publish = false build = "build.rs" diff --git a/src/cmd/dol.rs b/src/cmd/dol.rs index 5a26be4..522f067 100644 --- a/src/cmd/dol.rs +++ b/src/cmd/dol.rs @@ -115,9 +115,6 @@ pub struct DiffArgs { #[argp(positional)] /// linked ELF elf_file: PathBuf, - #[argp(positional)] - /// map file - map_file: PathBuf, } #[derive(FromArgs, PartialEq, Eq, Debug)] @@ -130,9 +127,6 @@ pub struct ApplyArgs { #[argp(positional)] /// linked ELF elf_file: PathBuf, - #[argp(positional)] - /// map file - map_file: PathBuf, } #[derive(FromArgs, PartialEq, Eq, Debug)] @@ -1226,9 +1220,6 @@ fn diff(args: DiffArgs) -> Result<()> { log::info!("Loading {}", args.elf_file.display()); let mut linked_obj = process_elf(&args.elf_file)?; - log::info!("Loading {}", args.map_file.display()); - apply_map_file(&args.map_file, &mut linked_obj)?; - for orig_sym in obj .symbols .iter() @@ -1380,9 +1371,6 @@ fn apply(args: ApplyArgs) -> Result<()> { log::info!("Loading {}", args.elf_file.display()); let mut linked_obj = process_elf(&args.elf_file)?; - log::info!("Loading {}", args.map_file.display()); - apply_map_file(&args.map_file, &mut linked_obj)?; - let mut replacements: Vec<(SymbolIndex, Option)> = vec![]; for (orig_idx, orig_sym) in obj.symbols.iter().enumerate() { // skip ABS for now diff --git a/src/util/split.rs b/src/util/split.rs index 633b6b8..20bcbd9 100644 --- a/src/util/split.rs +++ b/src/util/split.rs @@ -890,7 +890,6 @@ pub fn split_obj(obj: &ObjInfo) -> Result> { // Add section symbols let out_section_idx = file.sections.next_section_index(); - let mut comm_addr = current_address; for (symbol_idx, symbol) in obj .symbols .for_section_range(section_index, current_address.address..=file_end.address) @@ -911,23 +910,6 @@ pub fn split_obj(obj: &ObjInfo) -> Result> { continue; } - if split.common && symbol.address as u32 > comm_addr.address { - // HACK: Add padding for common bug - file.symbols.add_direct(ObjSymbol { - name: format!("pad_{:010X}", comm_addr), - demangled_name: None, - address: 0, - section: None, - size: symbol.address - comm_addr.address as u64, - size_known: true, - flags: ObjSymbolFlagSet(ObjSymbolFlags::Common.into()), - kind: ObjSymbolKind::Object, - align: Some(4), - data_kind: Default::default(), - })?; - } - comm_addr.address = (symbol.address + symbol.size) as u32; - symbol_idxs[symbol_idx] = Some(file.symbols.add_direct(ObjSymbol { name: symbol.name.clone(), demangled_name: symbol.demangled_name.clone(),