()
| 29 | // Test that `la a0, label` expands to correct auipc + addi |
| 30 | let tokens = vec![ |
| 31 | RvInstruction::Directive("\t.text".to_owned()), |
| 32 | RvInstruction::Pseudo(PseudoInstruction::La { |
| 33 | rd: 10, // a0 |
| 34 | symbol: "my_label".to_owned(), |
| 35 | }), |
| 36 | RvInstruction::Label("my_label".to_owned()), |
| 37 | RvInstruction::Real(asm_to_binary::real::RealInstruction::Addi( |
| 38 | asm_to_binary::riscv::rv64i::Addi::new(0, 0, 0), |
| 39 | )), |
| 40 | ]; |
| 41 | |
| 42 | let output = Assembler::assemble(&tokens).expect("la relocation should assemble"); |
| 43 | assert!(output.has_symbol("my_label")); |
| 44 | } |
| 45 | |
| 46 | #[test] |
| 47 | fn test_tail_pseudo_relocation() { |
| 48 | // Test that `tail target` expands to correct auipc + jalr |
| 49 | let tokens = vec![ |
| 50 | RvInstruction::Directive("\t.text".to_owned()), |
| 51 | RvInstruction::Pseudo(PseudoInstruction::Tail { |
| 52 | symbol: "end_func".to_owned(), |
| 53 | }), |
nothing calls this directly
no outgoing calls
no test coverage detected