mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
For PR351: \
* Move generic isArchive method here from Unix/Path.cpp \ * Implement isDynamicLibrary \ * Implement FindLibrary for Linker git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18861 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
de4cedca14
commit
ccb23a13e9
@ -49,6 +49,37 @@ sys::IdentifyFileType(const char*magic, unsigned length) {
|
||||
return UnknownFileType;
|
||||
}
|
||||
|
||||
bool
|
||||
Path::isArchive() const {
|
||||
if (readable())
|
||||
return hasMagicNumber("!<arch>\012");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
Path::isDynamicLibrary() const {
|
||||
if (readable())
|
||||
return hasMagicNumber("\177ELF");
|
||||
return false;
|
||||
}
|
||||
|
||||
Path
|
||||
Path::FindLibrary(std::string& name) {
|
||||
std::vector<sys::Path> LibPaths;
|
||||
GetSystemLibraryPaths(LibPaths);
|
||||
for (unsigned i = 0; i < LibPaths.size(); ++i) {
|
||||
sys::Path FullPath(LibPaths[i]);
|
||||
FullPath.appendFile("lib" + name + LTDL_SHLIB_EXT);
|
||||
if (FullPath.isDynamicLibrary())
|
||||
return FullPath;
|
||||
FullPath.elideSuffix();
|
||||
FullPath.appendSuffix("a");
|
||||
if (FullPath.isArchive())
|
||||
return FullPath;
|
||||
}
|
||||
return sys::Path();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Include the truly platform-specific parts of this class.
|
||||
|
Loading…
Reference in New Issue
Block a user