about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAndre Richter <andre.o.richter@gmail.com>2019-02-01 22:11:40 +0100
committerAndre Richter <andre.o.richter@gmail.com>2019-02-01 22:11:40 +0100
commitc4e46140f6a295d2d668ccc5bf25858233b11cbb (patch)
tree2aa33e64d46940e104b823e7927bfe8ea4218fef /src
parent23d8d0c319c37287657280bde61816d297f966d8 (diff)
downloadrust-c4e46140f6a295d2d668ccc5bf25858233b11cbb.tar.gz
rust-c4e46140f6a295d2d668ccc5bf25858233b11cbb.zip
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
https://github.com/rust-embedded/rust-raspi3-tutorial/issues/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.
Diffstat (limited to 'src')
-rw-r--r--src/librustc_target/spec/aarch64_unknown_none.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/librustc_target/spec/aarch64_unknown_none.rs b/src/librustc_target/spec/aarch64_unknown_none.rs
index 3440a4f8752..8c02bc61088 100644
--- a/src/librustc_target/spec/aarch64_unknown_none.rs
+++ b/src/librustc_target/spec/aarch64_unknown_none.rs
@@ -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,