Skip to content

Commit d1ed78d

Browse files
committed
Add no_mangle to ensure interrupt vectors aren't removed by rustc
The code appears to have been broken in rust-lang/rust#30830. This commit uses no_mangle as a work-around, since that's special-cased by the compiler and always kept. A more proper solution would be to re-export the necessary symbols in the final crate, which should also ensure that they're kept. This would either introduce a platform dependency in the main crate, or require a restructuring of the code so that the kernel binary is produced by the platform code.
1 parent c85d8d4 commit d1ed78d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/chips/sam4l/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ extern {
6464
}
6565

6666
#[link_section=".vectors"]
67+
#[no_mangle] // Ensures that the symbol is kept until the final binary
6768
pub static BASE_VECTORS: [unsafe extern fn(); 16] = [
6869
_estack, reset_handler,
6970
/* NMI */ unhandled_interrupt,
@@ -81,6 +82,7 @@ pub static BASE_VECTORS: [unsafe extern fn(); 16] = [
8182
];
8283

8384
#[link_section=".vectors"]
85+
#[no_mangle] // Ensures that the symbol is kept until the final binary
8486
pub static IRQS: [unsafe extern fn(); 80] = [generic_isr; 80];
8587

8688
#[no_mangle]

0 commit comments

Comments
 (0)