[llvm-commits] CVS: llvm/lib/System/Path.cpp
Reid Spencer
reid at x10sys.com
Tue Apr 10 17:49:56 PDT 2007
Changes in directory llvm/lib/System:
Path.cpp updated: 1.22 -> 1.23
---
Log message:
Make isDynamicLibrary detect more than just an ELF file.
---
Diffs of the changes: (+10 -2)
Path.cpp | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
Index: llvm/lib/System/Path.cpp
diff -u llvm/lib/System/Path.cpp:1.22 llvm/lib/System/Path.cpp:1.23
--- llvm/lib/System/Path.cpp:1.22 Wed Apr 4 01:30:26 2007
+++ llvm/lib/System/Path.cpp Tue Apr 10 19:49:39 2007
@@ -103,8 +103,16 @@
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;
}
More information about the llvm-commits
mailing list