@@ -758,14 +758,9 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
758758 }
759759 }
760760
761- // Add framework include paths and library search paths.
762- // There are two flavors:
763- // 1. The "non-standard" paths, e.g. for DriverKit:
764- // -L<sysroot>/System/DriverKit/usr/lib
765- // -F<sysroot>/System/DriverKit/System/Library/Frameworks
766- // 2. The "standard" paths, e.g. for macOS and iOS:
767- // -F<sysroot>/System/Library/Frameworks
768- // -F<sysroot>/Library/Frameworks
761+ // Add non-standard, platform-specific search paths, e.g., for DriverKit:
762+ // -L<sysroot>/System/DriverKit/usr/lib
763+ // -F<sysroot>/System/DriverKit/System/Library/Framework
769764 {
770765 bool NonStandardSearchPath = false ;
771766 const auto &Triple = getToolChain ().getTriple ();
@@ -776,22 +771,18 @@ void darwin::Linker::ConstructJob(Compilation &C, const JobAction &JA,
776771 (Version.getMajor () == 605 && Version.getMinor ().value_or (0 ) < 1 );
777772 }
778773
779- if (auto *Sysroot = Args.getLastArg (options::OPT_isysroot)) {
780- auto AddSearchPath = [&](StringRef Flag, StringRef SearchPath) {
781- SmallString<128 > P (Sysroot->getValue ());
782- AppendPlatformPrefix (P, Triple);
783- llvm::sys::path::append (P, SearchPath);
784- if (getToolChain ().getVFS ().exists (P)) {
785- CmdArgs.push_back (Args.MakeArgString (Flag + P));
786- }
787- };
788-
789- if (NonStandardSearchPath) {
774+ if (NonStandardSearchPath) {
775+ if (auto *Sysroot = Args.getLastArg (options::OPT_isysroot)) {
776+ auto AddSearchPath = [&](StringRef Flag, StringRef SearchPath) {
777+ SmallString<128 > P (Sysroot->getValue ());
778+ AppendPlatformPrefix (P, Triple);
779+ llvm::sys::path::append (P, SearchPath);
780+ if (getToolChain ().getVFS ().exists (P)) {
781+ CmdArgs.push_back (Args.MakeArgString (Flag + P));
782+ }
783+ };
790784 AddSearchPath (" -L" , " /usr/lib" );
791785 AddSearchPath (" -F" , " /System/Library/Frameworks" );
792- } else if (!Triple.isDriverKit ()) {
793- AddSearchPath (" -F" , " /System/Library/Frameworks" );
794- AddSearchPath (" -F" , " /Library/Frameworks" );
795786 }
796787 }
797788 }
0 commit comments