Skip to content

Commit

Permalink
Merge remote-tracking branch 'benma/compilerbug'
Browse files Browse the repository at this point in the history
  • Loading branch information
benma committed Jan 22, 2024
2 parents e36c6c6 + 8312c8f commit 89825f4
Showing 1 changed file with 13 additions and 0 deletions.
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

0 comments on commit 89825f4

Please sign in to comment.