diff options
author | 2018-09-17 19:27:06 +0000 | |
---|---|---|
committer | 2018-09-17 19:27:06 +0000 | |
commit | 403d8881ac3be806b519dedf107f6038d220bb59 (patch) | |
tree | 1d4eb8331a0da2951cefda2556b88c1f28057120 /cortex-m-rt/build.rs | |
parent | 9aaea565ca58ea735e1fb91281680816d91c5fa5 (diff) | |
parent | b87c3dc0ec870d8563f7dd6fde3f85794eeb722f (diff) | |
download | cortex-m-403d8881ac3be806b519dedf107f6038d220bb59.tar.gz cortex-m-403d8881ac3be806b519dedf107f6038d220bb59.tar.zst cortex-m-403d8881ac3be806b519dedf107f6038d220bb59.zip |
Merge #121
121: link.x: EXTERN(__INTERRUPTS) must come before PROVIDED r=therealprof a=japaric
or the user defined interrupts will be discarded when using fat LTO as seen
in #120
fixes #120
r? @rust-embedded/cortex-m (anyone)
Co-authored-by: Jorge Aparicio <jorge@japaric.io>
Diffstat (limited to 'cortex-m-rt/build.rs')
-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(); |