Fix XEX split failures for unaligned data sections and jump tables #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two bugs that caused "Failed to write" errors during
dtk xex split:ObjRelocationsBefore (13 failures)
After (0 failures)
Bug #1: Relocation Address Alignment
Problem:
ObjRelocations::new()andinsert()forced 4-byte alignment viaaddress & !3. When splits start at unaligned addresses (e.g.,0x82F0ABD3), relocations at relative offset 1 were corrupted to offset 0, causing "Unaligned symbol entry" errors.Fix: Remove forced alignment. The
to_elf()method already handles alignment appropriately per relocation type (usingR_PPC_UADDR32for unaligned Absolute relocations).Files fixed: CharClip.s, StandardStream.s, PanelDir.s, LoadingPanel.s
Bug #2: Symbol Kind Persistence
Problem:
find_symbol_kind()ignoredSymbolEntryKind::Endentries. When a jump table (Object kind) ended in a Code section, the Object kind persisted and subsequent code was incorrectly processed as data, causing "Unsupported data relocation type PpcRel14/PpcRel24" errors.Fix: Process End entries first to reset kind to
Unknown, allowing the section default (Function for Code sections) to take effect.Files fixed: nuiimagecameraproperties.s, neuralnet.s, qwidoassl.s, modelfittingstage.s, msaudiodec.s, entropydec.s, entropydecpro.s, expand.s, win32_rrthreads.s
Test plan
cargo test relocations::tests)cargo test asm::tests)