Skip to content

Commit 34ebfab

Browse files
authored
[llvm][ARM] Restore the default to -mstrict-align on Apple firmwares (#115546)
This is a partial revert of e314622 rdar://139237593
1 parent 9204eba commit 34ebfab

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,10 @@ llvm::ARM::FPUKind arm::getARMTargetFeatures(const Driver &D,
908908
if (VersionNum < 6 ||
909909
Triple.getSubArch() == llvm::Triple::SubArchType::ARMSubArch_v6m)
910910
Features.push_back("+strict-align");
911+
} else if (Triple.getVendor() == llvm::Triple::Apple &&
912+
Triple.isOSBinFormatMachO()) {
913+
// Firmwares on Apple platforms are strict-align by default.
914+
Features.push_back("+strict-align");
911915
} else if (VersionNum < 7 ||
912916
Triple.getSubArch() ==
913917
llvm::Triple::SubArchType::ARMSubArch_v6m ||

clang/test/Driver/arm-alignment.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@
3737
// RUN: %clang -target thumbv8m.base-none-gnueabi -### %s 2> %t
3838
// RUN: FileCheck --check-prefix CHECK-ALIGNED-ARM <%t %s
3939

40+
// RUN: %clang -target armv7em-apple-unknown-macho -mthumb -### %s 2> %t
41+
// RUN: FileCheck --check-prefix CHECK-ALIGNED-ARM <%t %s
42+
43+
// RUN: %clang -target armv7em-apple-darwin -mthumb -### %s 2> %t
44+
// RUN: FileCheck --check-prefix CHECK-ALIGNED-ARM <%t %s
45+
4046
// RUN: %clang --target=aarch64 -munaligned-access -### %s 2> %t
4147
// RUN: FileCheck --check-prefix=CHECK-UNALIGNED-AARCH64 < %t %s
4248

0 commit comments

Comments
 (0)