diff options
author | Eric Christopher <echristo@apple.com> | 2011-04-22 03:50:19 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2011-04-22 03:50:19 +0000 |
commit | 3509d2dc95540b6b2feabda401dea9e7f72070ce (patch) | |
tree | c3b4e1cdb60f2e327344e616700126daba9a5d1b /llvm/lib | |
parent | 7b015c7598bb22a16785db4ae5333248a0ffeb28 (diff) | |
download | bcm5719-llvm-3509d2dc95540b6b2feabda401dea9e7f72070ce.tar.gz bcm5719-llvm-3509d2dc95540b6b2feabda401dea9e7f72070ce.zip |
Add support for 64-bit object files to Path.
llvm-svn: 129975
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Support/Path.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp index cfe23d81c29..8fbaf2d42bf 100644 --- a/llvm/lib/Support/Path.cpp +++ b/llvm/lib/Support/Path.cpp @@ -92,15 +92,21 @@ sys::IdentifyFileType(const char *magic, unsigned length) { } break; + // The two magic numbers for mach-o are: + // 0xfeedface - 32-bit mach-o + // 0xfeedfacf - 64-bit mach-o case 0xFE: - case 0xCE: { + case 0xCE: + case 0xCF: { uint16_t type = 0; if (magic[0] == char(0xFE) && magic[1] == char(0xED) && - magic[2] == char(0xFA) && magic[3] == char(0xCE)) { + magic[2] == char(0xFA) && + (magic[3] == char(0xCE) || magic[3] == char(0xCF))) { /* Native endian */ if (length >= 16) type = magic[14] << 8 | magic[15]; - } else if (magic[0] == char(0xCE) && magic[1] == char(0xFA) && - magic[2] == char(0xED) && magic[3] == char(0xFE)) { + } else if ((magic[0] == char(0xCE) || magic[0] == char(0xCF)) && + magic[1] == char(0xFA) && magic[2] == char(0xED) && + magic[3] == char(0xFE)) { /* Reverse endian */ if (length >= 14) type = magic[13] << 8 | magic[12]; } |