From: Reid Spencer Date: Wed, 11 Apr 2007 00:49:39 +0000 (+0000) Subject: Make isDynamicLibrary detect more than just an ELF file. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=410aa020a2c834a5029bb98ee44691c0ec6f2c53;p=oota-llvm.git Make isDynamicLibrary detect more than just an ELF file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35874 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/System/Path.cpp b/lib/System/Path.cpp index b599c9c8868..0bd48490bb5 100644 --- a/lib/System/Path.cpp +++ b/lib/System/Path.cpp @@ -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; }