Skip to content

Commit 44613bb

Browse files
committed
Create strict aligned code for OpenBSD/arm64.
1 parent c27baa5 commit 44613bb

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

clang/lib/Driver/ToolChains/Arch/AArch64.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,11 @@ void aarch64::getAArch64TargetFeatures(const Driver &D,
376376
D.Diag(diag::err_drv_invalid_sve_vector_bits);
377377

378378
if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access,
379-
options::OPT_munaligned_access))
379+
options::OPT_munaligned_access)) {
380380
if (A->getOption().matches(options::OPT_mno_unaligned_access))
381381
Features.push_back("+strict-align");
382+
} else if (Triple.isOSOpenBSD())
383+
Features.push_back("+strict-align");
382384

383385
if (Args.hasArg(options::OPT_ffixed_x1))
384386
Features.push_back("+reserve-x1");

clang/test/Driver/arm-alignment.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@
8080
// RUN: %clang -target aarch64-none-gnueabi -mkernel -mno-unaligned-access -### %s 2> %t
8181
// RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
8282

83+
// RUN: %clang -target aarch64-unknown-openbsd -### %s 2> %t
84+
// RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
85+
8386
// CHECK-ALIGNED-ARM: "-target-feature" "+strict-align"
8487
// CHECK-ALIGNED-AARCH64: "-target-feature" "+strict-align"
8588

0 commit comments

Comments
 (0)