1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00

Make isDynamicLibrary detect more than just an ELF file.

llvm-svn: 35874
This commit is contained in:
Reid Spencer 2007-04-11 00:49:39 +00:00
parent a422b454ae
commit e580735108

View File

@ -103,8 +103,16 @@ Path::isArchive() const {
bool
Path::isDynamicLibrary() const {
if (canRead())
return hasMagicNumber("\177ELF");
if (canRead()) {
std::string Magic;
if (getMagicNumber(Magic, 64))
switch (IdentifyFileType(Magic.c_str(), Magic.length())) {
default: return false;
case ELF_FileType:
case Mach_O_FileType:
case COFF_FileType: return true;
}
}
return false;
}