[llvm-branch-commits] [clang] c2f52e2 - Create strict aligned code for OpenBSD/arm64.
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Aug 18 03:49:39 PDT 2020
Author: Brad Smith
Date: 2020-08-18T12:47:26+02:00
New Revision: c2f52e2c1288b00eae528825fb92668b1f3df732
URL: https://github.com/llvm/llvm-project/commit/c2f52e2c1288b00eae528825fb92668b1f3df732
DIFF: https://github.com/llvm/llvm-project/commit/c2f52e2c1288b00eae528825fb92668b1f3df732.diff
LOG: Create strict aligned code for OpenBSD/arm64.
(cherry picked from commit 44613bbec88be9e86b8c52c4f40bb1b1ab48d84c)
Added:
Modified:
clang/lib/Driver/ToolChains/Arch/AArch64.cpp
clang/test/Driver/arm-alignment.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
index 487c50dfc4663..dd4545d6c48fa 100644
--- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -370,9 +370,11 @@ void aarch64::getAArch64TargetFeatures(const Driver &D,
V8_6Pos = Features.insert(std::next(V8_6Pos), {"+i8mm", "+bf16"});
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");
diff --git a/clang/test/Driver/arm-alignment.c b/clang/test/Driver/arm-alignment.c
index e0b4946d0a4b1..b2bc8a35dfc6f 100644
--- a/clang/test/Driver/arm-alignment.c
+++ b/clang/test/Driver/arm-alignment.c
@@ -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"
More information about the llvm-branch-commits
mailing list