[clang] 44613bb - Create strict aligned code for OpenBSD/arm64.
Brad Smith via cfe-commits
cfe-commits at lists.llvm.org
Sun Aug 16 04:15:05 PDT 2020
Author: Brad Smith
Date: 2020-08-16T07:14:34-04:00
New Revision: 44613bbec88be9e86b8c52c4f40bb1b1ab48d84c
URL: https://github.com/llvm/llvm-project/commit/44613bbec88be9e86b8c52c4f40bb1b1ab48d84c
DIFF: https://github.com/llvm/llvm-project/commit/44613bbec88be9e86b8c52c4f40bb1b1ab48d84c.diff
LOG: Create strict aligned code for OpenBSD/arm64.
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 43959f5abe43..ce7c5348a4d5 100644
--- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -376,9 +376,11 @@ void aarch64::getAArch64TargetFeatures(const Driver &D,
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");
diff --git a/clang/test/Driver/arm-alignment.c b/clang/test/Driver/arm-alignment.c
index e0b4946d0a4b..b2bc8a35dfc6 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 cfe-commits
mailing list