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
This commit is contained in:
Kevin Enderby 2016-06-21 21:55:01 +00:00
parent 95ba82925b
commit 6a96160eba
3 changed files with 12 additions and 3 deletions

View 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

View 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();