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'. This likely means you need to increase your 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: This likely means you need to increase your minimum deployment target // CHECK: -lfoo // CHECK: .tmpdir/Xcode.app/{{.*}}libarclite_macosx.a