Create strict aligned code for OpenBSD/arm64.
authorBrad Smith <brad@comstyle.com>
Sun, 16 Aug 2020 10:50:50 +0000 (06:50 -0400)
committerBrad Smith <brad@comstyle.com>
Sun, 16 Aug 2020 11:14:34 +0000 (07:14 -0400)
clang/lib/Driver/ToolChains/Arch/AArch64.cpp
clang/test/Driver/arm-alignment.c

index 43959f5..ce7c534 100644 (file)
@@ -376,9 +376,11 @@ fp16_fml_fallthrough:
       D.Diag(diag::err_drv_invalid_sve_vector_bits);
 
   if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access,
-                               options::OPT_munaligned_access))
+                               options::OPT_munaligned_access)) {
     if (A->getOption().matches(options::OPT_mno_unaligned_access))
       Features.push_back("+strict-align");
+  } else if (Triple.isOSOpenBSD())
+    Features.push_back("+strict-align");
 
   if (Args.hasArg(options::OPT_ffixed_x1))
     Features.push_back("+reserve-x1");
index e0b4946..b2bc8a3 100644 (file)
@@ -80,6 +80,9 @@
 // RUN: %clang -target aarch64-none-gnueabi -mkernel -mno-unaligned-access -### %s 2> %t
 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
 
+// RUN: %clang -target aarch64-unknown-openbsd -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
+
 // CHECK-ALIGNED-ARM: "-target-feature" "+strict-align"
 // CHECK-ALIGNED-AARCH64: "-target-feature" "+strict-align"