OLD | NEW |
1 //===- lib/Linker/Linker.cpp - Basic Linker functionality ----------------===// | 1 //===- lib/Linker/Linker.cpp - Basic Linker functionality ----------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file contains basic Linker functionality that all usages will need. | 10 // This file contains basic Linker functionality that all usages will need. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 return FullPath; | 134 return FullPath; |
135 | 135 |
136 // Try the libX.so (or .dylib) form | 136 // Try the libX.so (or .dylib) form |
137 FullPath.eraseSuffix(); | 137 FullPath.eraseSuffix(); |
138 FullPath.appendSuffix(sys::Path::GetDLLSuffix()); | 138 FullPath.appendSuffix(sys::Path::GetDLLSuffix()); |
139 if (FullPath.isDynamicLibrary()) // Native shared library? | 139 if (FullPath.isDynamicLibrary()) // Native shared library? |
140 return FullPath; | 140 return FullPath; |
141 if (FullPath.isBitcodeFile()) // .so file containing bitcode? | 141 if (FullPath.isBitcodeFile()) // .so file containing bitcode? |
142 return FullPath; | 142 return FullPath; |
143 | 143 |
| 144 // Try libX form, to make it possible to add dependency on the |
| 145 // specific version of .so, like liblzma.so.1.0.0 |
| 146 FullPath.eraseSuffix(); |
| 147 if (FullPath.isDynamicLibrary()) // Native shared library? |
| 148 return FullPath; |
| 149 if (FullPath.isBitcodeFile()) // .so file containing bitcode? |
| 150 return FullPath; |
| 151 |
144 // Not found .. fall through | 152 // Not found .. fall through |
145 | 153 |
146 // Indicate that the library was not found in the directory. | 154 // Indicate that the library was not found in the directory. |
147 FullPath.clear(); | 155 FullPath.clear(); |
148 return FullPath; | 156 return FullPath; |
149 } | 157 } |
150 | 158 |
151 /// FindLib - Try to convert Filename into the name of a file that we can open, | 159 /// FindLib - Try to convert Filename into the name of a file that we can open, |
152 /// if it does not already name a file we can open, by first trying to open | 160 /// if it does not already name a file we can open, by first trying to open |
153 /// Filename, then libFilename.[suffix] for each of a set of several common | 161 /// Filename, then libFilename.[suffix] for each of a set of several common |
(...skipping 11 matching lines...) Expand all Loading... |
165 // Iterate over the directories in Paths to see if we can find the library | 173 // Iterate over the directories in Paths to see if we can find the library |
166 // there. | 174 // there. |
167 for (unsigned Index = 0; Index != LibPaths.size(); ++Index) { | 175 for (unsigned Index = 0; Index != LibPaths.size(); ++Index) { |
168 sys::Path Directory(LibPaths[Index]); | 176 sys::Path Directory(LibPaths[Index]); |
169 sys::Path FullPath = IsLibrary(Filename, Directory); | 177 sys::Path FullPath = IsLibrary(Filename, Directory); |
170 if (!FullPath.isEmpty()) | 178 if (!FullPath.isEmpty()) |
171 return FullPath; | 179 return FullPath; |
172 } | 180 } |
173 return sys::Path(); | 181 return sys::Path(); |
174 } | 182 } |
OLD | NEW |