mirror of
https://github.com/encounter/objdiff.git
synced 2026-07-10 12:18:36 -07:00
Add support for R_ARM_THM_PC8 and R_ARM_THM_PC11 (#342)
* Add support for `R_ARM_THM_JUMP8` and `R_ARM_THM_JUMP11` * Fix `scan_instructions_internal` when reading 2-bytes instruction
This commit is contained in:
@@ -57,6 +57,31 @@ fn combine_text_sections() {
|
||||
insta::assert_snapshot!(output);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "arm")]
|
||||
fn thumb_short_data_mapping() {
|
||||
// When a .2byte directive is used in Thumb code, the assembler emits
|
||||
// $d/$t mapping symbols for a 2-byte data region. The disassembler must
|
||||
// not read 4 bytes as a .word when the next mapping symbol limits the
|
||||
// data region to 2 bytes.
|
||||
let diff_config = diff::DiffObjConfig::default();
|
||||
let obj = obj::read::parse(
|
||||
include_object!("data/arm/code_1_vblank.o"),
|
||||
&diff_config,
|
||||
diff::DiffSide::Base,
|
||||
)
|
||||
.unwrap();
|
||||
let symbol_idx = obj.symbols.iter().position(|s| s.name == "VBlankDMA_Level1").unwrap();
|
||||
let diff = diff::code::no_diff_code(&obj, symbol_idx, &diff_config).unwrap();
|
||||
let output = common::display_diff(&obj, &diff, symbol_idx, &diff_config);
|
||||
// .2byte data followed by Thumb code must not be merged into a 4-byte .word
|
||||
assert!(
|
||||
!output.contains(".word"),
|
||||
"2-byte data regions should not be decoded as 4-byte .word values.\n\
|
||||
The disassembler must respect mapping symbol boundaries."
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "arm")]
|
||||
fn trim_trailing_hword() {
|
||||
|
||||
Reference in New Issue
Block a user