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;
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