Skip to content

Commit faaffae

Browse files
authored
Merge pull request #965 from Ddystopia/master
fix: add #[used] for autogenerated __INTERRUTS static
2 parents aeada2e + 840ced9 commit faaffae

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
77

88
## [Unreleased]
99

10+
- Add `#[used]` to the generated interrupt vector table statics so they are not
11+
dropped by the linker with lto
1012
- Improve documentation for RISC-V settings file
1113
- Use marker struct instead of address in `Periph` with `PeripheralSpec` trait
1214
- Add `--skip-peripherals-struct` flag to skip generating the `Peripherals`

src/generate/interrupt.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ pub fn render(
154154
#[doc(hidden)]
155155
#link_section_attr
156156
#nomangle
157+
#[used]
157158
pub static __INTERRUPTS: [Vector; #num_of_interrupts] = [
158159
#elements
159160
];
@@ -228,6 +229,7 @@ pub fn render(
228229
#[doc(hidden)]
229230
#link_section_attr
230231
#nomangle
232+
#[used]
231233
pub static __EXTERNAL_INTERRUPTS: [Vector; #num_of_interrupts] = [
232234
#elements
233235
];
@@ -263,6 +265,7 @@ pub fn render(
263265
#[doc(hidden)]
264266
#link_section_attr
265267
#nomangle
268+
#[used]
266269
pub static __INTERRUPTS: [Vector; #num_of_interrupts] = [
267270
#elements
268271
];

0 commit comments

Comments
 (0)