diff options
author | 2020-07-09 09:54:42 +0000 | |
---|---|---|
committer | 2020-07-09 09:54:42 +0000 | |
commit | fbcfff1a47cdba9c137d8b752f127f8efbfe7373 (patch) | |
tree | 94935a77d0ab62ab0caba004ba38900c4fc73c4a /cortex-m-rt | |
parent | d08f531dd5642507e7e26a0e9a4b521cddfd5bfc (diff) | |
parent | 37f58d93e707c458d8a3f19d34335e349dd6d9fb (diff) | |
download | cortex-m-fbcfff1a47cdba9c137d8b752f127f8efbfe7373.tar.gz cortex-m-fbcfff1a47cdba9c137d8b752f127f8efbfe7373.tar.zst cortex-m-fbcfff1a47cdba9c137d8b752f127f8efbfe7373.zip |
Merge #276
276: Replace __ONCE__ with Cargo links key r=jonas-schievink a=adamgreig
This would fix #275. We use the links key in cortex-m already [here](https://github.com/rust-embedded/cortex-m/blob/master/Cargo.toml#L16). See also https://github.com/rust-embedded/wg/issues/467.
Co-authored-by: Adam Greig <adam@adamgreig.com>
Diffstat (limited to 'cortex-m-rt')
-rw-r--r-- | cortex-m-rt/Cargo.toml | 1 | ||||
-rw-r--r-- | cortex-m-rt/src/lib.rs | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/cortex-m-rt/Cargo.toml b/cortex-m-rt/Cargo.toml index 8fd075f..f8f8342 100644 --- a/cortex-m-rt/Cargo.toml +++ b/cortex-m-rt/Cargo.toml @@ -14,6 +14,7 @@ readme = "README.md" repository = "https://github.com/rust-embedded/cortex-m-rt" version = "0.6.11" autoexamples = true +links = "cortex-m-rt" # Prevent multiple versions of cortex-m-rt being linked [dependencies] r0 = "1.0" diff --git a/cortex-m-rt/src/lib.rs b/cortex-m-rt/src/lib.rs index 4dabb29..ba50572 100644 --- a/cortex-m-rt/src/lib.rs +++ b/cortex-m-rt/src/lib.rs @@ -689,6 +689,10 @@ 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__: () = (); |