Skip to content

Commit

Permalink
Auto merge of #58060 - andre-richter:master, r=nagisa
Browse files Browse the repository at this point in the history
targets: aarch64-unknown-none: Add +strict-align

On AArch64, an unaligned access causes a synchronous exception. In the current
state of the target, the compiler might generate unaligned accesses, see
rust-embedded/rust-raspberrypi-OS-tutorials#10.

Since this is a bare-metal target, it is possible that there is no exception
handling in place (yet) to recover from this case, causing a binary to just
silently fail.

Add `+strict-align` to avoid this case.
  • Loading branch information
bors committed Feb 2, 2019
2 parents 2efa31b + c4e4614 commit 4af96ae
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/librustc_target/spec/aarch64_unknown_none.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use super::{LldFlavor, LinkerFlavor, Target, TargetOptions, PanicStrategy};
pub fn target() -> Result<Target, String> {
let opts = TargetOptions {
linker: Some("rust-lld".to_owned()),
features: "+strict-align".to_string(),
executables: true,
relocation_model: "static".to_string(),
disable_redzone: true,
Expand Down

0 comments on commit 4af96ae

Please sign in to comment.