File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ readme = "README.md"
14
14
repository = " https://github.com/rust-embedded/cortex-m-rt"
15
15
version = " 0.6.11"
16
16
autoexamples = true
17
+ links = " cortex-m-rt" # Prevent multiple versions of cortex-m-rt being linked
17
18
18
19
[dependencies ]
19
20
r0 = " 1.0"
Original file line number Diff line number Diff line change @@ -689,6 +689,10 @@ pub use macros::exception;
689
689
/// [rfc1414]: https://github.com/rust-lang/rfcs/blob/master/text/1414-rvalue_static_promotion.md
690
690
pub use macros:: pre_init;
691
691
692
+ // We export this static with an informative name so that if an application attempts to link
693
+ // two copies of cortex-m-rt together, linking will fail. We also declare a links key in
694
+ // Cargo.toml which is the more modern way to solve the same problem, but we have to keep
695
+ // __ONCE__ around to prevent linking with versions before the links key was added.
692
696
#[ export_name = "error: cortex-m-rt appears more than once in the dependency graph" ]
693
697
#[ doc( hidden) ]
694
698
pub static __ONCE__: ( ) = ( ) ;
You can’t perform that action at this time.
0 commit comments