Skip to content

Commit

Permalink
Don't use map in dol diff and dol apply; remove common BSS hack
Browse files Browse the repository at this point in the history
  • Loading branch information
encounter committed Sep 10, 2023
1 parent 788ffb9 commit 18170a9
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "decomp-toolkit"
description = "Yet another GameCube/Wii decompilation toolkit."
authors = ["Luke Street <luke@street.dev>"]
license = "MIT OR Apache-2.0"
version = "0.4.1"
version = "0.4.2"
edition = "2021"
publish = false
build = "build.rs"
Expand Down
12 changes: 0 additions & 12 deletions src/cmd/dol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand All @@ -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)]
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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<ObjSymbol>)> = vec![];
for (orig_idx, orig_sym) in obj.symbols.iter().enumerate() {
// skip ABS for now
Expand Down
18 changes: 0 additions & 18 deletions src/util/split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,6 @@ pub fn split_obj(obj: &ObjInfo) -> Result<Vec<ObjInfo>> {

// 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)
Expand All @@ -911,23 +910,6 @@ pub fn split_obj(obj: &ObjInfo) -> Result<Vec<ObjInfo>> {
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(),
Expand Down

0 comments on commit 18170a9

Please sign in to comment.