From ade7592085cbb3d37a7cc9701c4c07c9c58a87c5 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 11 Apr 2007 03:15:35 +0000 Subject: [PATCH] Hack to get sys::Path to recognize macho dylibs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35878 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/System/Path.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/System/Path.cpp b/lib/System/Path.cpp index a028696c139..66436ae0e52 100644 --- a/lib/System/Path.cpp +++ b/lib/System/Path.cpp @@ -68,12 +68,14 @@ sys::IdentifyFileType(const char*magic, unsigned length) { } break; - case 0xCE: - case 0xCF: + case 0xCA: // This is complicated by an overlap with Java class files. // See the Mach-O section in /usr/share/file/magic for details. - if (magic[1] == char(0xFA) && magic[2] == char(0xED) && - magic[3] == char(0xFE)) + if (magic[1] == char(0xFE) && magic[2] == char(0xBA) && + magic[3] == char(0xBE)) { + return Mach_O_DynamicallyLinkedSharedLib_FileType; + + // FIXME: How does this work? if (length >= 14 && magic[13] == 0) switch (magic[12]) { default: break; @@ -87,6 +89,7 @@ sys::IdentifyFileType(const char*magic, unsigned length) { case 8: return Mach_O_Bundle_FileType; case 9: return Mach_O_DynamicallyLinkedSharedLibStub_FileType; } + } break; case 0xF0: // PowerPC Windows