Skip to content

Commit 9dfdbb9

Browse files
committed
Fix v1-2 REL alignment regression
Alignment after section data and before relocations / import table is exclusive to REL v3.
1 parent c403931 commit 9dfdbb9

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
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 <[email protected]>"]
55
license = "MIT OR Apache-2.0"
6-
version = "0.9.5"
6+
version = "0.9.6"
77
edition = "2021"
88
publish = false
99
repository = "https://github.com/encounter/decomp-toolkit"

src/util/rel.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -853,8 +853,10 @@ where
853853
offset = (offset + align) & !align;
854854
offset += section.size() as u32;
855855
}
856-
// Align to 4 after section data
857-
offset = (offset + 3) & !3;
856+
if info.version >= 3 {
857+
// Align to 4 after section data
858+
offset = (offset + 3) & !3;
859+
}
858860

859861
fn do_relocation_layout(
860862
relocations: &[RelReloc],
@@ -1047,8 +1049,8 @@ where
10471049
}
10481050
w.write_all(&section_data)?;
10491051
}
1050-
// Align to 4 after section data
1051-
{
1052+
if info.version >= 3 {
1053+
// Align to 4 after section data
10521054
let position = w.stream_position()?;
10531055
w.write_all(&vec![0u8; calculate_padding(position, 4) as usize])?;
10541056
}

0 commit comments

Comments
 (0)