]> git.lizzy.rs Git - rust.git/commitdiff
targets: aarch64-unknown-none: Add +strict-align
authorAndre Richter <andre.o.richter@gmail.com>
Fri, 1 Feb 2019 21:11:40 +0000 (22:11 +0100)
committerAndre Richter <andre.o.richter@gmail.com>
Fri, 1 Feb 2019 21:11:40 +0000 (22:11 +0100)
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.

src/librustc_target/spec/aarch64_unknown_none.rs

index 3440a4f8752dba6635100f46f19d39622973d37c..8c02bc61088b48ca8e66ea99f533e887dfedfa0b 100644 (file)
@@ -11,6 +11,7 @@
 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,