Skip to content

Commit 52d5185

Browse files
committed
add global label to traps
1 parent 245179f commit 52d5185

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

riscv-rt/macros/src/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,21 +370,18 @@ fn interrupt(args: TokenStream, input: TokenStream, _arch: RiscvArch) -> TokenSt
370370
}
371371

372372
// XXX should we blacklist other attributes?
373-
let attrs = f.attrs;
374-
let ident = f.sig.ident;
373+
let ident = &f.sig.ident;
375374
let export_name = format!("{:#}", ident);
376-
let block = f.block;
377375

378376
#[cfg(not(feature = "v-trap"))]
379377
let start_trap = proc_macro2::TokenStream::new();
380378
#[cfg(feature = "v-trap")]
381-
let start_trap = v_trap::start_interrupt_trap_asm(&ident, _arch);
379+
let start_trap = v_trap::start_interrupt_trap_asm(ident, _arch);
382380

383381
quote!(
384382
#start_trap
385383
#[export_name = #export_name]
386-
#(#attrs)*
387-
pub unsafe fn #ident() #block
384+
#f
388385
)
389386
.into()
390387
}
@@ -443,6 +440,7 @@ mod v_trap {
443440
core::arch::global_asm!(
444441
\".section .trap, \\\"ax\\\"
445442
.align {width}
443+
.global _start_{function}_trap
446444
_start_{function}_trap:
447445
addi sp, sp, - {TRAP_SIZE} * {width}
448446
{store}

0 commit comments

Comments
 (0)