diff options
author | 2018-08-12 15:23:49 -0400 | |
---|---|---|
committer | 2018-08-12 15:29:08 -0400 | |
commit | f3fa545b978a6d5d29d0bcdc78aca03518183bdc (patch) | |
tree | 785595fa2f2fae32d2653b6ec790da673efb00ed | |
parent | 06ce316ad44f6eaac497d43c392703e326b50944 (diff) | |
download | cortex-m-f3fa545b978a6d5d29d0bcdc78aca03518183bdc.tar.gz cortex-m-f3fa545b978a6d5d29d0bcdc78aca03518183bdc.tar.zst cortex-m-f3fa545b978a6d5d29d0bcdc78aca03518183bdc.zip |
Change the sentinel value for __pre_init to something other than 1
The sentinel value of 0, while nice, was being optimized out as the compiler
assumed that the function pointer would never be 0.
Signed-off-by: Gabriel Smith <ga29smith@gmail.com>
-rw-r--r-- | cortex-m-rt/link.x.in | 2 | ||||
-rw-r--r-- | cortex-m-rt/src/lib.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/cortex-m-rt/link.x.in b/cortex-m-rt/link.x.in index 02cdb32..c2511f7 100644 --- a/cortex-m-rt/link.x.in +++ b/cortex-m-rt/link.x.in @@ -54,7 +54,7 @@ EXTERN(__INTERRUPTS); /* `static` variable similar to `__EXCEPTIONS` */ /* # Pre-initialization function */ /* If the user overrides this using the `pre_init!` macro or by creating a `__pre_init` function, then the function this points to will be called before the RAM is initialized. */ -PROVIDE(__pre_init = 0); +PROVIDE(__pre_init = 1); /* # Sections */ SECTIONS diff --git a/cortex-m-rt/src/lib.rs b/cortex-m-rt/src/lib.rs index d73dc4f..31e4ea3 100644 --- a/cortex-m-rt/src/lib.rs +++ b/cortex-m-rt/src/lib.rs @@ -491,7 +491,7 @@ pub unsafe extern "C" fn Reset() -> ! { } let pre_init: unsafe extern "C" fn() = __pre_init; - if pre_init as usize != 0 { + if pre_init as usize != 1 { pre_init(); } |