Build a minimal assembled program: _start calls main, main returns 42.
()
| 35 | .try_into() |
| 36 | .expect("ELF field should have the expected width"), |
| 37 | ) |
| 38 | } |
| 39 | fn u64_le(buf: &[u8], off: usize) -> u64 { |
| 40 | u64::from_le_bytes( |
| 41 | buf[off..off + 8] |
| 42 | .try_into() |
| 43 | .expect("ELF field should have the expected width"), |
| 44 | ) |
| 45 | } |
| 46 | |
| 47 | // Build a minimal program: _start calls main, main returns 42. |
| 48 | fn minimal_tokens() -> Vec<RvInstruction> { |
| 49 | let a7: u8 = 17; |
| 50 | let a0: u8 = 10; |
| 51 | let ra: u8 = 1; |
| 52 | |
| 53 | vec![ |
| 54 | RvInstruction::Directive(".text".to_owned()), |
| 55 | RvInstruction::Label("_start".to_owned()), |
| 56 | RvInstruction::Pseudo(PseudoInstruction::Call { |
| 57 | symbol: "main".to_owned(), |
| 58 | }), |
| 59 | RvInstruction::Pseudo(PseudoInstruction::Li { rd: a7, imm: 93 }), |
| 60 | RvInstruction::Real(RealInstruction::Ecall(Ecall)), |
| 61 | RvInstruction::Label("main".to_owned()), |
no outgoing calls
no test coverage detected