(assembled: &asm_to_binary::AssembledOutput, addr: u64)
| 16 | } |
| 17 | |
| 18 | fn word_at_linked_address(assembled: &asm_to_binary::AssembledOutput, addr: u64) -> u32 { |
| 19 | let mut base = 0u64; |
| 20 | for section in assembled.sections_iter() { |
| 21 | let end = base + section.bytes.len() as u64; |
| 22 | if addr >= base && addr + 4 <= end { |
| 23 | let off = (addr - base) as usize; |
| 24 | return word_at(section.bytes, off); |
| 25 | } |
| 26 | base = end; |
| 27 | } |
| 28 | panic!("no linked section contains address {addr:#x}"); |
| 29 | } |
| 30 | |
| 31 | #[test] |
| 32 | fn links_two_objects_and_resolves_call_relocation() { |
no test coverage detected