While not the recommended extension on macOS .so is supported by ld64.
This mirrors that behavior.
Related report: https://github.com/bazelbuild/bazel/issues/18464
Differential Revision: https://reviews.llvm.org/D151147
auto doFind = [&] {
if (config->searchDylibsFirst) {
- if (std::optional<StringRef> path = findPathCombination(
- "lib" + name, config->librarySearchPaths, {".tbd", ".dylib"}))
+ if (std::optional<StringRef> path =
+ findPathCombination("lib" + name, config->librarySearchPaths,
+ {".tbd", ".dylib", ".so"}))
return path;
return findPathCombination("lib" + name, config->librarySearchPaths,
{".a"});
}
return findPathCombination("lib" + name, config->librarySearchPaths,
- {".tbd", ".dylib", ".a"});
+ {".tbd", ".dylib", ".so", ".a"});
};
std::optional<StringRef> path = doFind();
return loadDylib(*dylibPath, umbrella);
}
} else if (std::optional<StringRef> dylibPath = findPathCombination(
- stem, config->librarySearchPaths, {".tbd", ".dylib"}))
+ stem, config->librarySearchPaths, {".tbd", ".dylib", ".so"}))
return loadDylib(*dylibPath, umbrella);
}
# DYLIBSEARCH: searched {{.*}}/MacOSX.sdk/usr/lib{{[/\\]}}libhello.tbd, not found
# DYLIBSEARCH-NEXT: searched {{.*}}/MacOSX.sdk/usr/lib{{[/\\]}}libhello.dylib, not found
+# DYLIBSEARCH-NEXT: searched {{.*}}/MacOSX.sdk/usr/lib{{[/\\]}}libhello.so, not found
# DYLIBSEARCH-NEXT: searched [[PATH]]A{{[/\\]}}libhello.tbd, not found
# DYLIBSEARCH-NEXT: searched [[PATH]]A{{[/\\]}}libhello.dylib, not found
# DYLIBSEARCH: searched [[PATH]]{{[/\\]}}libhello.dylib, found
# ARCHIVESEARCH: searched {{.*}}/MacOSX.sdk/usr/lib{{[/\\]}}libhello.tbd, not found
# ARCHIVESEARCH-NEXT: searched {{.*}}/MacOSX.sdk/usr/lib{{[/\\]}}libhello.dylib, not found
+# ARCHIVESEARCH-NEXT: searched {{.*}}/MacOSX.sdk/usr/lib{{[/\\]}}libhello.so, not found
# ARCHIVESEARCH-NEXT: searched {{.*}}/MacOSX.sdk/usr/lib{{[/\\]}}libhello.a, not found
# ARCHIVESEARCH-NEXT: searched [[PATH]]A{{[/\\]}}libhello.tbd, not found
# ARCHIVESEARCH-NEXT: searched [[PATH]]A{{[/\\]}}libhello.dylib, not found
+# ARCHIVESEARCH-NEXT: searched [[PATH]]A{{[/\\]}}libhello.so, not found
# ARCHIVESEARCH-NEXT: searched [[PATH]]A{{[/\\]}}libhello.a, not found
# ARCHIVESEARCH: searched [[PATH]]{{[/\\]}}libhello.dylib, found
# ARCHIVESEARCH: searched [[PATH]]A{{[/\\]}}libgoodbye.a, found