[lld] [lld-macho] Find objects in library search path (PR #78628)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 18 13:25:27 PST 2024
https://github.com/OldWorldOrdr created https://github.com/llvm/llvm-project/pull/78628
Find object files in library search path just like Apple's linker, this makes building with some older MacOS SDKs easier since clang runs with `-lcrt1.10.6.o`
>From e73fc2d0263e9e601f2964a90cfe347e8d2bb87c Mon Sep 17 00:00:00 2001
From: OldWorldOrdr <joey.t.reinhart at gmail.com>
Date: Thu, 18 Jan 2024 16:20:52 -0500
Subject: [PATCH] [lld-macho] Find objects in library search path
---
lld/MachO/Driver.cpp | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 401459a054394ec..f04165f5c026153 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -95,11 +95,16 @@ static std::optional<StringRef> findLibrary(StringRef name) {
findPathCombination("lib" + name, config->librarySearchPaths,
{".tbd", ".dylib", ".so"}))
return path;
- return findPathCombination("lib" + name, config->librarySearchPaths,
- {".a"});
+ else if (std::optional<StringRef> path = findPathCombination(
+ "lib" + name, config->librarySearchPaths, {".a"}))
+ return path;
+ return findPathCombination(name, config->librarySearchPaths, {""});
}
- return findPathCombination("lib" + name, config->librarySearchPaths,
- {".tbd", ".dylib", ".so", ".a"});
+ if (std::optional<StringRef> path =
+ findPathCombination("lib" + name, config->librarySearchPaths,
+ {".tbd", ".dylib", ".so", ".a"}))
+ return path;
+ return findPathCombination(name, config->librarySearchPaths, {""});
};
std::optional<StringRef> path = doFind();
More information about the llvm-commits
mailing list