forked from OSchip/llvm-project
parent
10b1c8031f
commit
319d7304c3
|
@ -99,20 +99,14 @@ std::string elf::findFromSearchPaths(StringRef Path) {
|
||||||
// Searches a given library from input search paths, which are filled
|
// Searches a given library from input search paths, which are filled
|
||||||
// from -L command line switches. Returns a path to an existent library file.
|
// from -L command line switches. Returns a path to an existent library file.
|
||||||
std::string elf::searchLibrary(StringRef Path) {
|
std::string elf::searchLibrary(StringRef Path) {
|
||||||
std::vector<std::string> Names;
|
if (Path.startswith(":"))
|
||||||
if (Path[0] == ':') {
|
return findFromSearchPaths(Path.substr(1));
|
||||||
Names.push_back(Path.drop_front());
|
if (!Config->Static) {
|
||||||
} else {
|
std::string S = findFromSearchPaths(("lib" + Path + ".so").str());
|
||||||
if (!Config->Static)
|
|
||||||
Names.push_back(("lib" + Path + ".so").str());
|
|
||||||
Names.push_back(("lib" + Path + ".a").str());
|
|
||||||
}
|
|
||||||
for (const std::string &Name : Names) {
|
|
||||||
std::string S = findFromSearchPaths(Name);
|
|
||||||
if (!S.empty())
|
if (!S.empty())
|
||||||
return S;
|
return S;
|
||||||
}
|
}
|
||||||
return "";
|
return findFromSearchPaths(("lib" + Path + ".a").str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Makes a path by concatenating Dir and File.
|
// Makes a path by concatenating Dir and File.
|
||||||
|
|
Loading…
Reference in New Issue