Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust: add workaround for potential compiler bug #1158

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,19 @@ endif()
# See https://github.com/rust-bitcoin/rust-secp256k1/tree/7c8270a8506e31731e540fab7ee1abde1f48314e/secp256k1-sys#linking-to-external-symbols
set(RUSTFLAGS "${RUSTFLAGS} --cfg=rust_secp_no_symbol_renaming")

# Apply workaround for a potential miscompilation bug:
# See
# - https://github.com/rust-embedded/cortex-m/discussions/503
# - https://github.com/rust-lang/rust/issues/118867
# We have not observed any abnormal behavior even though we fulfil all the criteria to be affected
# (opt-level='z', thumbv7em-none-eabi target, Rust toolchain 1.74.0 being >= 1.73.0), but we apply
# the workaround just in case.
#
# This increases the binary size of the `make firmware` (Multi) build by 11568 bytes at the time of
# adding this workaround. This can be removed again once the issue above is fixed and we have
# updated to a Rust toolchain that contains the fix.
set(RUSTFLAGS "${RUSTFLAGS} -Cllvm-args=--enable-machine-outliner=never")

if(CMAKE_CROSSCOMPILING)
set(RUST_TARGET_ARCH thumbv7em-none-eabi)
set(RUST_TARGET_ARCH_DIR ${RUST_TARGET_ARCH})
Expand Down
Loading