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.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/lld/ELF/DriverUtils.cpp b/lld/ELF/DriverUtils.cpp
index 0fb3aebc61f..e6a482b4969 100644
--- a/lld/ELF/DriverUtils.cpp
+++ b/lld/ELF/DriverUtils.cpp
@@ -223,12 +223,9 @@ Optional<std::string> elf::findFromSearchPaths(StringRef Path) {
return None;
}
-// This is for -lfoo. We'll look for libfoo.so or libfoo.a from
+// This is for -l<basename>. We'll look for lib<basename>.so or lib<basename>.a from
// search paths.
-Optional<std::string> elf::searchLibrary(StringRef Name) {
- if (Name.startswith(":"))
- return findFromSearchPaths(Name.substr(1));
-
+Optional<std::string> elf::searchLibraryBaseName(StringRef Name) {
for (StringRef Dir : Config->SearchPaths) {
if (!Config->Static)
if (Optional<std::string> S = findFile(Dir, "lib" + Name + ".so"))
@@ -239,6 +236,13 @@ Optional<std::string> elf::searchLibrary(StringRef Name) {
return None;
}
+// This is for -l<namespec>.
+Optional<std::string> elf::searchLibrary(StringRef Name) {
+ if (Name.startswith(":"))
+ return findFromSearchPaths(Name.substr(1));
+ return searchLibraryBaseName (Name);
+}
+
// If a linker/version script doesn't exist in the current directory, we also
// look for the script in the '-L' search paths. This matches the behaviour of
// '-T', --version-script=, and linker script INPUT() command in ld.bfd.
OpenPOWER on IntegriCloud