summaryrefslogtreecommitdiffstats
path: root/lld/ELF/DriverUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/DriverUtils.cpp')
-rw-r--r--lld/ELF/DriverUtils.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/lld/ELF/DriverUtils.cpp b/lld/ELF/DriverUtils.cpp
index 4c3bd813c2b..c32429e900f 100644
--- a/lld/ELF/DriverUtils.cpp
+++ b/lld/ELF/DriverUtils.cpp
@@ -244,12 +244,17 @@ std::string elf::findFromSearchPaths(StringRef Path) {
std::string elf::searchLibrary(StringRef Path) {
if (Path.startswith(":"))
return findFromSearchPaths(Path.substr(1));
- if (!Config->Static) {
- std::string S = findFromSearchPaths(("lib" + Path + ".so").str());
- if (!S.empty())
+ for (StringRef Dir : Config->SearchPaths) {
+ if (!Config->Static) {
+ std::string S = buildSysrootedPath(Dir, ("lib" + Path + ".so").str());
+ if (fs::exists(S))
+ return S;
+ }
+ std::string S = buildSysrootedPath(Dir, ("lib" + Path + ".a").str());
+ if (fs::exists(S))
return S;
}
- return findFromSearchPaths(("lib" + Path + ".a").str());
+ return "";
}
// Makes a path by concatenating Dir and File.
OpenPOWER on IntegriCloud