From: Kevin Enderby Date: Tue, 21 Jun 2016 21:55:01 +0000 (+0000) Subject: Update llvm-obdump(1) to print FAT_MAGIC_64 for Darwin’s 64-bit universal files X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6a96160ebaae508e540cc68ca8ee9c2e9bd685fb;p=llvm Update llvm-obdump(1) to print FAT_MAGIC_64 for Darwin’s 64-bit universal files with the -macho and -universal-headers flags. Just a follow on to r273207, I missed updating the printing of the fat magic number when the universal file is a 64-bit universal file. rdar://26899493 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273324 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/tools/llvm-objdump/X86/Inputs/macho-universal64.x86_64.i386 b/test/tools/llvm-objdump/X86/Inputs/macho-universal64.x86_64.i386 new file mode 100755 index 00000000000..add12e44a35 Binary files /dev/null and b/test/tools/llvm-objdump/X86/Inputs/macho-universal64.x86_64.i386 differ diff --git a/test/tools/llvm-objdump/X86/macho-universal-x86_64.i386.test b/test/tools/llvm-objdump/X86/macho-universal-x86_64.i386.test index 260e9aa341e..9089716f7a5 100644 --- a/test/tools/llvm-objdump/X86/macho-universal-x86_64.i386.test +++ b/test/tools/llvm-objdump/X86/macho-universal-x86_64.i386.test @@ -6,6 +6,8 @@ RUN: llvm-objdump %p/Inputs/macho-universal.x86_64.i386 -universal-headers -m \ RUN: | FileCheck %s -check-prefix FAT RUN: llvm-objdump %p/Inputs/macho-universal.x86_64.i386 -universal-headers -m \ RUN: -non-verbose | FileCheck %s -check-prefix NON-VERBOSE +RUN: llvm-objdump %p/Inputs/macho-universal64.x86_64.i386 -universal-headers \ +RUN: -m | FileCheck %s -check-prefix FAT-64 UEXE-all: macho-universal.x86_64.i386 (architecture x86_64): UEXE-all: (__TEXT,__text) section @@ -62,3 +64,7 @@ NON-VERBOSE: capabilities 0x0 NON-VERBOSE: offset 12288 NON-VERBOSE: size 4336 NON-VERBOSE: align 2^12 (4096) + +FAT-64: Fat headers +FAT-64: fat_magic FAT_MAGIC_64 +FAT-64: nfat_arch 2 diff --git a/tools/llvm-objdump/MachODump.cpp b/tools/llvm-objdump/MachODump.cpp index 3f4185e6330..b92599a02f8 100644 --- a/tools/llvm-objdump/MachODump.cpp +++ b/tools/llvm-objdump/MachODump.cpp @@ -1403,9 +1403,12 @@ static void printCPUType(uint32_t cputype, uint32_t cpusubtype) { static void printMachOUniversalHeaders(const object::MachOUniversalBinary *UB, bool verbose) { outs() << "Fat headers\n"; - if (verbose) - outs() << "fat_magic FAT_MAGIC\n"; - else + if (verbose) { + if (UB->getMagic() == MachO::FAT_MAGIC) + outs() << "fat_magic FAT_MAGIC\n"; + else // UB->getMagic() == MachO::FAT_MAGIC_64 + outs() << "fat_magic FAT_MAGIC_64\n"; + } else outs() << "fat_magic " << format("0x%" PRIx32, MachO::FAT_MAGIC) << "\n"; uint32_t nfat_arch = UB->getNumberOfObjects();