[PATCH] D122030: Driver: Make macOS the default target OS for -arch arm64
Duncan P. N. Exon Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 18 13:17:22 PDT 2022
dexonsmith created this revision.
dexonsmith added reviewers: arphaman, ab, steven_wu.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
dexonsmith requested review of this revision.
Herald added a project: clang.
This is a follow up to 565603cc94d79a8d0de6df840fd53714899fb890 <https://reviews.llvm.org/rG565603cc94d79a8d0de6df840fd53714899fb890>,
which made macOS the default target OS for `-arch arm64` when
running on an Apple Silicon Mac. Now it'll be the default when
running on an Intel Mac too.
clang/test/Driver/apple-arm64-arch.c was a bit odd before: it was added
for the above commit, but tested the inverse behaviour and XFAIL'ed on
Apple Silicon. This inverts it to the (new) behaviour (that's now
correct regardless) and removes the XFAIL.
Radar-Id: rdar://90500294
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D122030
Files:
clang/lib/Driver/ToolChains/Darwin.cpp
clang/test/Driver/apple-arm64-arch.c
Index: clang/test/Driver/apple-arm64-arch.c
===================================================================
--- clang/test/Driver/apple-arm64-arch.c
+++ clang/test/Driver/apple-arm64-arch.c
@@ -2,6 +2,5 @@
// RUN: FileCheck %s
//
// REQUIRES: system-darwin
-// XFAIL: apple-silicon-mac
//
-// CHECK: "-triple" "arm64-apple-ios{{[0-9.]+}}"
+// CHECK: "-triple" "arm64-apple-macosx{{[0-9.]+}}"
Index: clang/lib/Driver/ToolChains/Darwin.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Darwin.cpp
+++ clang/lib/Driver/ToolChains/Darwin.cpp
@@ -2000,16 +2000,9 @@
llvm::Triple::OSType OSTy = llvm::Triple::UnknownOS;
StringRef MachOArchName = Toolchain.getMachOArchName(Args);
- if (MachOArchName == "arm64" || MachOArchName == "arm64e") {
-#if __arm64__
- // A clang running on an Apple Silicon mac defaults
- // to building for mac when building for arm64 rather than
- // defaulting to iOS.
+ if (MachOArchName == "arm64" || MachOArchName == "arm64e")
OSTy = llvm::Triple::MacOSX;
-#else
- OSTy = llvm::Triple::IOS;
-#endif
- } else if (MachOArchName == "armv7" || MachOArchName == "armv7s")
+ else if (MachOArchName == "armv7" || MachOArchName == "armv7s")
OSTy = llvm::Triple::IOS;
else if (MachOArchName == "armv7k" || MachOArchName == "arm64_32")
OSTy = llvm::Triple::WatchOS;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122030.416587.patch
Type: text/x-patch
Size: 1387 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220318/20b6c6a5/attachment.bin>
More information about the cfe-commits
mailing list