Update the comments for the macho-invalid-zero-ncmds test and fix

llvm-objdump when printing the Mach Header to print the unknown
cputype and cpusubtype fields as decimal instead of not printing
them at all.  And change the test to check for that.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258826 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kevin Enderby 2016-01-26 18:20:49 +00:00
parent b4878ed1be
commit ce2bf8c364
2 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,9 @@
// No crash, might not be totally invalid
RUN: llvm-objdump -private-headers %p/Inputs/macho-invalid-zero-ncmds
// An odd Mach-O file, with just a mach header with all but the magic field
// and filetype zeros. The cputype and cpusubtype fields being zero are invalid,
// but that does not mater for the most part to display some of the contents.
RUN: llvm-objdump -private-headers %p/Inputs/macho-invalid-zero-ncmds -macho \
RUN: | FileCheck -check-prefix ZERO-NCMDS %s
ZERO-NCMDS: MH_MAGIC_64 0 0 0x00 OBJECT 0 0 0x00000000
RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-incomplete-load-command 2>&1 \
RUN: | FileCheck -check-prefix INCOMPLETE-LOADC %s

View File

@ -6893,6 +6893,10 @@ static void PrintMachHeader(uint32_t magic, uint32_t cputype,
break;
}
break;
default:
outs() << format(" %7d", cputype);
outs() << format(" %10d", cpusubtype & ~MachO::CPU_SUBTYPE_MASK);
break;
}
if ((cpusubtype & MachO::CPU_SUBTYPE_MASK) == MachO::CPU_SUBTYPE_LIB64) {
outs() << " LIB64";