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
This commit is contained in:
Chris Lattner 2007-04-11 03:15:35 +00:00
parent 18da072088
commit ade7592085

View File

@ -68,12 +68,14 @@ sys::IdentifyFileType(const char*magic, unsigned length) {
} }
break; break;
case 0xCE: case 0xCA:
case 0xCF:
// This is complicated by an overlap with Java class files. // This is complicated by an overlap with Java class files.
// See the Mach-O section in /usr/share/file/magic for details. // See the Mach-O section in /usr/share/file/magic for details.
if (magic[1] == char(0xFA) && magic[2] == char(0xED) && if (magic[1] == char(0xFE) && magic[2] == char(0xBA) &&
magic[3] == char(0xFE)) magic[3] == char(0xBE)) {
return Mach_O_DynamicallyLinkedSharedLib_FileType;
// FIXME: How does this work?
if (length >= 14 && magic[13] == 0) if (length >= 14 && magic[13] == 0)
switch (magic[12]) { switch (magic[12]) {
default: break; default: break;
@ -87,6 +89,7 @@ sys::IdentifyFileType(const char*magic, unsigned length) {
case 8: return Mach_O_Bundle_FileType; case 8: return Mach_O_Bundle_FileType;
case 9: return Mach_O_DynamicallyLinkedSharedLibStub_FileType; case 9: return Mach_O_DynamicallyLinkedSharedLibStub_FileType;
} }
}
break; break;
case 0xF0: // PowerPC Windows case 0xF0: // PowerPC Windows