[clang] 253988f - [darwin][driver] Do not link with libarclite when building for Apple Silicon macOS
Alex Lorenz via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 26 17:16:41 PDT 2020
Author: Alex Lorenz
Date: 2020-06-26T17:15:37-07:00
New Revision: 253988f0f400201adb094d0f81d2c0c3fac94f4f
URL: https://github.com/llvm/llvm-project/commit/253988f0f400201adb094d0f81d2c0c3fac94f4f
DIFF: https://github.com/llvm/llvm-project/commit/253988f0f400201adb094d0f81d2c0c3fac94f4f.diff
LOG: [darwin][driver] Do not link with libarclite when building for Apple Silicon macOS
Added:
Modified:
clang/lib/Driver/ToolChains/Darwin.cpp
clang/lib/Driver/ToolChains/Darwin.h
clang/test/Driver/arclite-link.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index 1b3a3e934995..36559483593b 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -971,6 +971,8 @@ void DarwinClang::AddLinkARCArgs(const ArgList &Args,
// Avoid linking compatibility stubs on i386 mac.
if (isTargetMacOS() && getArch() == llvm::Triple::x86)
return;
+ if (isTargetAppleSiliconMac())
+ return;
ObjCRuntime runtime = getDefaultObjCRuntime(/*nonfragile*/ true);
diff --git a/clang/lib/Driver/ToolChains/Darwin.h b/clang/lib/Driver/ToolChains/Darwin.h
index 1b193a4c4eb9..e6f2beb94a2e 100644
--- a/clang/lib/Driver/ToolChains/Darwin.h
+++ b/clang/lib/Driver/ToolChains/Darwin.h
@@ -409,6 +409,17 @@ class LLVM_LIBRARY_VISIBILITY Darwin : public MachO {
return TargetPlatform == MacOS;
}
+ bool isTargetMacOSBased() const {
+ assert(TargetInitialized && "Target not initialized!");
+ // FIXME (Alex L): Add remaining MacCatalyst suppport.
+ return TargetPlatform == MacOS;
+ }
+
+ bool isTargetAppleSiliconMac() const {
+ assert(TargetInitialized && "Target not initialized!");
+ return isTargetMacOSBased() && getArch() == llvm::Triple::aarch64;
+ }
+
bool isTargetInitialized() const { return TargetInitialized; }
VersionTuple getTargetVersion() const {
diff --git a/clang/test/Driver/arclite-link.c b/clang/test/Driver/arclite-link.c
index 2cc0271fc022..a53b12daa47b 100644
--- a/clang/test/Driver/arclite-link.c
+++ b/clang/test/Driver/arclite-link.c
@@ -15,3 +15,6 @@
// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -fobjc-arc -mmacosx-version-min=10.10 %s 2>&1 | FileCheck -check-prefix=CHECK-UNUSED %s
// CHECK-UNUSED-NOT: warning: argument unused during compilation: '-fobjc-link-runtime'
+
+// RUN: %clang -### -target arm64-apple-macos10.8 -fobjc-link-runtime %t.o 2>&1 | FileCheck -check-prefix=CHECK-ARCLITE-ARM-MAC %s
+// CHECK-ARCLITE-ARM-MAC-NOT: libarclite
More information about the cfe-commits
mailing list