diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td --- a/clang/include/clang/Basic/DiagnosticDriverKinds.td +++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -619,6 +619,9 @@ "SDK settings were ignored as 'SDKSettings.json' could not be parsed">, InGroup>; +def err_drv_darwin_sdk_missing_arclite : Error< + "SDK does not contain 'libarclite' at the path '%0'; try increasing the minimum deployment target">; + def err_drv_trivial_auto_var_init_stop_after_missing_dependency : Error< "'-ftrivial-auto-var-init-stop-after=*' is used without " "'-ftrivial-auto-var-init=zero' or '-ftrivial-auto-var-init=pattern'">; diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp --- a/clang/lib/Driver/ToolChains/Darwin.cpp +++ b/clang/lib/Driver/ToolChains/Darwin.cpp @@ -1204,6 +1204,9 @@ P += "macosx"; P += ".a"; + if (!getVFS().exists(P)) + getDriver().Diag(clang::diag::err_drv_darwin_sdk_missing_arclite) << P; + CmdArgs.push_back(Args.MakeArgString(P)); } diff --git a/clang/test/Driver/arclite-link-external-toolchain.c b/clang/test/Driver/arclite-link-external-toolchain.c --- a/clang/test/Driver/arclite-link-external-toolchain.c +++ b/clang/test/Driver/arclite-link-external-toolchain.c @@ -4,5 +4,8 @@ // RUN: -isysroot %t.tmpdir/Xcode.app/Contents/Developers/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk \ // RUN: %s 2>&1 | FileCheck %s +// CHECK: error: SDK does not contain 'libarclite' at the path ' +// CHECK: .tmpdir/Xcode.app/{{.*}}libarclite_macosx.a'; +// CHECK: try increasing the minimum deployment target // CHECK: -lfoo // CHECK: .tmpdir/Xcode.app/{{.*}}libarclite_macosx.a diff --git a/clang/test/Driver/arclite-link.c b/clang/test/Driver/arclite-link.c --- a/clang/test/Driver/arclite-link.c +++ b/clang/test/Driver/arclite-link.c @@ -1,9 +1,13 @@ // RUN: touch %t.o -// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -lfoo -mmacosx-version-min=10.10 %t.o 2>&1 | FileCheck -check-prefix=CHECK-ARCLITE-OSX %s +// RUN: mkdir -p %t.tmpdir/Xcode.app/Contents/Developers/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk +// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -lfoo -mmacosx-version-min=10.10 %t.o \ +// RUN: -isysroot %t.tmpdir/Xcode.app/Contents/Developers/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk 2>&1 | FileCheck -check-prefix=CHECK-ARCLITE-OSX %s // RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.11 %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOARCLITE %s // RUN: %clang -### -target i386-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.7 %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOARCLITE %s // RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -nostdlib %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOSTDLIB %s +// CHECK-ARCLITE-OSX: .tmpdir/Xcode.app/{{.*}}libarclite_macosx.a'; +// CHECK-ARCLITE-OSX: try increasing the minimum deployment target // CHECK-ARCLITE-OSX: -lfoo // CHECK-ARCLITE-OSX: libarclite_macosx.a // CHECK-ARCLITE-OSX: -framework