Skip to content

Commit

Permalink
[build][rust] Disable mutable-noalias in rust builds
Browse files Browse the repository at this point in the history
It was recently discovered that mutable-noalias can lead to
miscompilations (see rust-lang/rust#84958).
This CL disables that optimization for all rust builds.

Bug: 76184
Tests: Manually reviewed basic functionality on devices, relying on CI
for broader coverage

Change-Id: I6555e38c74270cba0d4741b7826ac1705b123010
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/526741
Commit-Queue: Paul Faria <paulfaria@google.com>
Reviewed-by: Adam Perry <adamperry@google.com>
Reviewed-by: Tyler Mandry <tmandry@google.com>
  • Loading branch information
Nashenas88 authored and CQ Bot committed May 10, 2021
1 parent 8456e08 commit 914bdaf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion build/config/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ is_efi_toolchain =
shlib_toolchain = "${toolchain_variant.base}${toolchain_variant.suffix}-shared"

# Prepend the prefix configs, if any, before the default ones.
default_common_binary_configs = toolchain_variant.prefix_configs
default_common_binary_configs =
toolchain_variant.prefix_configs + [
# TODO(fxbug.dev/76297) Remove this to re-enable mutable-noalias.
"//build/config/rust:no_mutable_noalias",
]

# Note that Zircon toolchains and non-Zircon ones have a very different set
# of default configs for all target types.
Expand Down
5 changes: 5 additions & 0 deletions build/config/rust/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ config("v0_symbol_mangling") {
}
}

# TODO(fxbug.dev/76297) Remove this to re-enable mutable-noalias.
config("no_mutable_noalias") {
rustflags = [ "-Zmutable-noalias=off" ]
}

config("allow_unknown_lints") {
rustflags = [ "-Aunknown-lints" ]
}
Expand Down

0 comments on commit 914bdaf

Please sign in to comment.