[darwin][driver] Do not link with libarclite when building for Apple Silicon macOS

This commit is contained in:
Alex Lorenz 2020-06-26 14:57:00 -07:00
parent 5fb5f7b5ab
commit 253988f0f4
3 changed files with 16 additions and 0 deletions

View File

@ -971,6 +971,8 @@ void DarwinClang::AddLinkARCArgs(const ArgList &Args,
// Avoid linking compatibility stubs on i386 mac. // Avoid linking compatibility stubs on i386 mac.
if (isTargetMacOS() && getArch() == llvm::Triple::x86) if (isTargetMacOS() && getArch() == llvm::Triple::x86)
return; return;
if (isTargetAppleSiliconMac())
return;
ObjCRuntime runtime = getDefaultObjCRuntime(/*nonfragile*/ true); ObjCRuntime runtime = getDefaultObjCRuntime(/*nonfragile*/ true);

View File

@ -409,6 +409,17 @@ protected:
return TargetPlatform == MacOS; 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; } bool isTargetInitialized() const { return TargetInitialized; }
VersionTuple getTargetVersion() const { VersionTuple getTargetVersion() const {

View File

@ -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 // 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' // 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