[libcxx-commits] [lld] [llvm] [lldb] [compiler-rt] [libcxx] [lld-macho] Find objects in library search path (PR #78628)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jan 18 18:16:04 PST 2024
================
@@ -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, {""});
----------------
OldWorldOrdr wrote:
Looks like ld64 checks if the library name ends in `.o` and if so, assumes it's a Csu support file, and looks for a file in the library search path with that exact name, not searching for any `libcrt1.o.a`.
If a Csu support file is not found ld64 automatically changes the target to MacOS 10.8 which stopped requiring Csu support files, then continues without linking the object.
Apples new linker does the same, but it has no concept of Csu support files and just links with it like it were a normal file, exiting with an error if it's not found.
https://github.com/llvm/llvm-project/pull/78628
More information about the libcxx-commits
mailing list