Add support for R_ARM_V4BX (#377)

This commit is contained in:
Bruno Macabeus
2026-07-10 06:28:01 +01:00
committed by GitHub
parent 0fe4fadbc3
commit 2fdba8842e
3 changed files with 26 additions and 0 deletions
+16
View File
@@ -82,6 +82,22 @@ fn thumb_short_data_mapping() {
);
}
#[test]
#[cfg(feature = "arm")]
fn read_arm_v4bx() {
// R_ARM_V4BX relocations mark `bx` instructions so the linker can optionally
// rewrite them for ARMv4 interworking.
let diff_config = diff::DiffObjConfig::default();
let obj =
obj::read::parse(include_object!("data/arm/v4bx.o"), &diff_config, diff::DiffSide::Base)
.unwrap();
let symbol_idx = obj.symbols.iter().position(|s| s.name == "v4bx_func").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);
// The `bx lr` still disassembles normally; the V4BX hint is simply dropped.
assert!(output.contains("bx"), "expected a `bx` instruction, got:\n{output}");
}
#[test]
#[cfg(feature = "arm")]
fn trim_trailing_hword() {
Binary file not shown.