diff options
author | 2018-09-17 20:48:03 +0200 | |
---|---|---|
committer | 2018-09-17 20:48:03 +0200 | |
commit | b87c3dc0ec870d8563f7dd6fde3f85794eeb722f (patch) | |
tree | e4e11d97118e805029ced5a6a5d23c39eedb340f | |
parent | 27501f88b8c6ae9746efea01416f5276e43171eb (diff) | |
download | cortex-m-b87c3dc0ec870d8563f7dd6fde3f85794eeb722f.tar.gz cortex-m-b87c3dc0ec870d8563f7dd6fde3f85794eeb722f.tar.zst cortex-m-b87c3dc0ec870d8563f7dd6fde3f85794eeb722f.zip |
link.x: EXTERN(__INTERRUPTS) must come before PROVIDED
or the user defined interrupts will be discarded when using fat LTO as seen
in #120
closes #120
-rw-r--r-- | cortex-m-rt/build.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cortex-m-rt/build.rs b/cortex-m-rt/build.rs index 8166b1b..a978146 100644 --- a/cortex-m-rt/build.rs +++ b/cortex-m-rt/build.rs @@ -24,6 +24,11 @@ fn main() { let mut f = if env::var_os("CARGO_FEATURE_DEVICE").is_some() { let mut f = File::create(out.join("link.x")).unwrap(); + f.write_all(link_x).unwrap(); + + // *IMPORTANT*: The weak aliases (i.e. `PROVIDED`) must come *after* `EXTERN(__INTERRUPTS)`. + // Otherwise the linker will ignore user defined interrupts and always populate the table + // with the weak aliases. writeln!( f, r#" @@ -31,7 +36,6 @@ fn main() { /* This will usually be provided by a device crate generated using svd2rust (see `device.x`) */ INCLUDE device.x"# ).unwrap(); - f.write_all(link_x).unwrap(); f } else { let mut f = File::create(out.join("link.x")).unwrap(); |