From af9f52fb4ac327240d949df220a5a51d8e73fb81 Mon Sep 17 00:00:00 2001 From: Ian McIntyre Date: Fri, 29 Sep 2023 16:15:09 -0400 Subject: Relax asserts for .rodata and .text offsets Haven't fully dug into this one, but GNU ld and LLVM lld have slightly different section positions when we cross from text to data. We can relax the asserts to show ordering without strictly requiring an offset. --- tests/inspect_elf.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/inspect_elf.rs b/tests/inspect_elf.rs index 5638801..34da382 100644 --- a/tests/inspect_elf.rs +++ b/tests/inspect_elf.rs @@ -360,10 +360,7 @@ fn baseline_teensy4(binary: &ImxrtBinary, dcd_at_runtime: u32) { vector_table.address + vector_table.size, "rodata LMA & VMA expected behind text" ); - assert_eq!( - binary.section_lma(".rodata"), - binary.section_lma(".text") + aligned(text.size, 16) - ); + assert!(binary.section_lma(".rodata") >= binary.section_lma(".text") + aligned(text.size, 4)); let data = binary.section(".data").unwrap(); assert_eq!( @@ -534,9 +531,8 @@ fn imxrt1170evk_cm7() { vector_table.address + vector_table.size, "rodata moved to DTCM behind vector table" ); - assert_eq!( - binary.section_lma(".rodata"), - 0x3000_2000 + vector_table.size + aligned(text.size, 16), + assert!( + binary.section_lma(".rodata") >= 0x3000_2000 + vector_table.size + aligned(text.size, 4), ); let data = binary.section(".data").unwrap(); -- cgit v1.2.3