aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt/src/lib.rs
diff options
context:
space:
mode:
authorGravatar Adam Greig <adam@adamgreig.com> 2020-07-09 02:34:47 +0100
committerGravatar Adam Greig <adam@adamgreig.com> 2020-07-09 02:34:47 +0100
commit37f58d93e707c458d8a3f19d34335e349dd6d9fb (patch)
tree45fdfd8cbdea4bea6c10010b252fb30232efc06e /cortex-m-rt/src/lib.rs
parentf10a81030055d85c49d7cc5c9124942debbc949e (diff)
downloadcortex-m-37f58d93e707c458d8a3f19d34335e349dd6d9fb.tar.gz
cortex-m-37f58d93e707c458d8a3f19d34335e349dd6d9fb.tar.zst
cortex-m-37f58d93e707c458d8a3f19d34335e349dd6d9fb.zip
Keep __ONCE__ for backcompat
Diffstat (limited to '')
-rw-r--r--cortex-m-rt/src/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/cortex-m-rt/src/lib.rs b/cortex-m-rt/src/lib.rs
index 08037d2..13f41f4 100644
--- a/cortex-m-rt/src/lib.rs
+++ b/cortex-m-rt/src/lib.rs
@@ -689,6 +689,14 @@ pub use macros::exception;
/// [rfc1414]: https://github.com/rust-lang/rfcs/blob/master/text/1414-rvalue_static_promotion.md
pub use macros::pre_init;
+// We export this static with an informative name so that if an application attempts to link
+// two copies of cortex-m-rt together, linking will fail. We also declare a links key in
+// Cargo.toml which is the more modern way to solve the same problem, but we have to keep
+// __ONCE__ around to prevent linking with versions before the links key was added.
+#[export_name = "error: cortex-m-rt appears more than once in the dependency graph"]
+#[doc(hidden)]
+pub static __ONCE__: () = ();
+
/// Registers stacked (pushed onto the stack) during an exception.
#[derive(Clone, Copy)]
#[repr(C)]