diff options
author | 2022-01-03 11:43:50 +0100 | |
---|---|---|
committer | 2022-01-04 17:40:04 +0100 | |
commit | 68d7f83096379b18bc7610cd064eaf7b8e03608a (patch) | |
tree | bee4c38b6e11a88a5daef84908677a21108ef260 /cortex-m-semihosting/src | |
parent | 19125ac052fcba1d67de39be3292e34bd6c6d0f4 (diff) | |
download | cortex-m-68d7f83096379b18bc7610cd064eaf7b8e03608a.tar.gz cortex-m-68d7f83096379b18bc7610cd064eaf7b8e03608a.tar.zst cortex-m-68d7f83096379b18bc7610cd064eaf7b8e03608a.zip |
macros: Don't use Option in singleton!()
As detailed in rust-embedded/cortex-m#364, niche optimization of the
`Option` used in the `singleton!()` macro can lead to the initial value
of the static to contain non-zero bits. This in turn leads to the whole
static being moved from `.bss` to `.data` which means it eats up flash
space for no reason. Especially if the singleton stores a particularly
large type, this can be quite problematic.
Prevent this by using an explicit boolean flag instead of the `Option`
type. This is not quite as nice but at least there is no chance for the
`singleton!()` to end up in `.data`...
Diffstat (limited to 'cortex-m-semihosting/src')
0 files changed, 0 insertions, 0 deletions