lib/Linker: add support of deps which does not end with ".so".
authorIvan Krasin <krasin@chromium.org>
Tue, 20 Sep 2011 22:52:35 +0000 (22:52 +0000)
committerIvan Krasin <krasin@chromium.org>
Tue, 20 Sep 2011 22:52:35 +0000 (22:52 +0000)
It happens (for example) when you want to have a dependency on the .so
with the specific version, like liblzma.so.1.0.0 or
libcrypto.so.0.9.8.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140201 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Linker/Linker.cpp

index fba91da5ddd189bf5a75ef27fe6b92e1d5ac701f..59fbceb6a3080f93a8d4851c96aa45031bec02f3 100644 (file)
@@ -141,6 +141,14 @@ static inline sys::Path IsLibrary(StringRef Name,
   if (FullPath.isBitcodeFile())    // .so file containing bitcode?
     return FullPath;
 
   if (FullPath.isBitcodeFile())    // .so file containing bitcode?
     return FullPath;
 
+  // Try libX form, to make it possible to add dependency on the
+  // specific version of .so, like liblzma.so.1.0.0
+  FullPath.eraseSuffix();
+  if (FullPath.isDynamicLibrary())  // Native shared library?
+    return FullPath;
+  if (FullPath.isBitcodeFile())    // .so file containing bitcode?
+    return FullPath;
+
   // Not found .. fall through
 
   // Indicate that the library was not found in the directory.
   // Not found .. fall through
 
   // Indicate that the library was not found in the directory.