]> granicus.if.org Git - llvm/commitdiff
Update llvm-obdump(1) to print FAT_MAGIC_64 for Darwin’s 64-bit universal files
authorKevin Enderby <enderby@apple.com>
Tue, 21 Jun 2016 21:55:01 +0000 (21:55 +0000)
committerKevin Enderby <enderby@apple.com>
Tue, 21 Jun 2016 21:55:01 +0000 (21:55 +0000)
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

test/tools/llvm-objdump/X86/Inputs/macho-universal64.x86_64.i386 [new file with mode: 0755]
test/tools/llvm-objdump/X86/macho-universal-x86_64.i386.test
tools/llvm-objdump/MachODump.cpp

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 (executable)
index 0000000..add12e4
Binary files /dev/null and b/test/tools/llvm-objdump/X86/Inputs/macho-universal64.x86_64.i386 differ
index 260e9aa341e8c4b9955efa1aad1344048923d527..9089716f7a5edde48b45268a9062300719a3ce8f 100644 (file)
@@ -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
index 3f4185e63307f6f208f51660ce3f10dda6872308..b92599a02f8f477252a92e6b7f5f760a4d749bb9 100644 (file)
@@ -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();