Don't use map in `dol diff` and `dol apply`; remove common BSS hack
This commit is contained in:
parent
788ffb9e17
commit
18170a96a2
|
@ -307,7 +307,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "decomp-toolkit"
|
name = "decomp-toolkit"
|
||||||
version = "0.4.1"
|
version = "0.4.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"ar",
|
"ar",
|
||||||
|
|
|
@ -3,7 +3,7 @@ name = "decomp-toolkit"
|
||||||
description = "Yet another GameCube/Wii decompilation toolkit."
|
description = "Yet another GameCube/Wii decompilation toolkit."
|
||||||
authors = ["Luke Street <luke@street.dev>"]
|
authors = ["Luke Street <luke@street.dev>"]
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
version = "0.4.1"
|
version = "0.4.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
publish = false
|
publish = false
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
|
|
@ -115,9 +115,6 @@ pub struct DiffArgs {
|
||||||
#[argp(positional)]
|
#[argp(positional)]
|
||||||
/// linked ELF
|
/// linked ELF
|
||||||
elf_file: PathBuf,
|
elf_file: PathBuf,
|
||||||
#[argp(positional)]
|
|
||||||
/// map file
|
|
||||||
map_file: PathBuf,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(FromArgs, PartialEq, Eq, Debug)]
|
#[derive(FromArgs, PartialEq, Eq, Debug)]
|
||||||
|
@ -130,9 +127,6 @@ pub struct ApplyArgs {
|
||||||
#[argp(positional)]
|
#[argp(positional)]
|
||||||
/// linked ELF
|
/// linked ELF
|
||||||
elf_file: PathBuf,
|
elf_file: PathBuf,
|
||||||
#[argp(positional)]
|
|
||||||
/// map file
|
|
||||||
map_file: PathBuf,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(FromArgs, PartialEq, Eq, Debug)]
|
#[derive(FromArgs, PartialEq, Eq, Debug)]
|
||||||
|
@ -1226,9 +1220,6 @@ fn diff(args: DiffArgs) -> Result<()> {
|
||||||
log::info!("Loading {}", args.elf_file.display());
|
log::info!("Loading {}", args.elf_file.display());
|
||||||
let mut linked_obj = process_elf(&args.elf_file)?;
|
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
|
for orig_sym in obj
|
||||||
.symbols
|
.symbols
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -1380,9 +1371,6 @@ fn apply(args: ApplyArgs) -> Result<()> {
|
||||||
log::info!("Loading {}", args.elf_file.display());
|
log::info!("Loading {}", args.elf_file.display());
|
||||||
let mut linked_obj = process_elf(&args.elf_file)?;
|
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<ObjSymbol>)> = vec![];
|
let mut replacements: Vec<(SymbolIndex, Option<ObjSymbol>)> = vec![];
|
||||||
for (orig_idx, orig_sym) in obj.symbols.iter().enumerate() {
|
for (orig_idx, orig_sym) in obj.symbols.iter().enumerate() {
|
||||||
// skip ABS for now
|
// skip ABS for now
|
||||||
|
|
|
@ -890,7 +890,6 @@ pub fn split_obj(obj: &ObjInfo) -> Result<Vec<ObjInfo>> {
|
||||||
|
|
||||||
// Add section symbols
|
// Add section symbols
|
||||||
let out_section_idx = file.sections.next_section_index();
|
let out_section_idx = file.sections.next_section_index();
|
||||||
let mut comm_addr = current_address;
|
|
||||||
for (symbol_idx, symbol) in obj
|
for (symbol_idx, symbol) in obj
|
||||||
.symbols
|
.symbols
|
||||||
.for_section_range(section_index, current_address.address..=file_end.address)
|
.for_section_range(section_index, current_address.address..=file_end.address)
|
||||||
|
@ -911,23 +910,6 @@ pub fn split_obj(obj: &ObjInfo) -> Result<Vec<ObjInfo>> {
|
||||||
continue;
|
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 {
|
symbol_idxs[symbol_idx] = Some(file.symbols.add_direct(ObjSymbol {
|
||||||
name: symbol.name.clone(),
|
name: symbol.name.clone(),
|
||||||
demangled_name: symbol.demangled_name.clone(),
|
demangled_name: symbol.demangled_name.clone(),
|
||||||
|
|
Loading…
Reference in New Issue