[llvm] r258826 - Update the comments for the macho-invalid-zero-ncmds test and fix
Kevin Enderby via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 26 10:20:49 PST 2016
Author: enderby
Date: Tue Jan 26 12:20:49 2016
New Revision: 258826
URL: http://llvm.org/viewvc/llvm-project?rev=258826&view=rev
Log:
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.
Modified:
llvm/trunk/test/Object/macho-invalid.test
llvm/trunk/tools/llvm-objdump/MachODump.cpp
Modified: llvm/trunk/test/Object/macho-invalid.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/macho-invalid.test?rev=258826&r1=258825&r2=258826&view=diff
==============================================================================
--- llvm/trunk/test/Object/macho-invalid.test (original)
+++ llvm/trunk/test/Object/macho-invalid.test Tue Jan 26 12:20:49 2016
@@ -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
Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=258826&r1=258825&r2=258826&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Tue Jan 26 12:20:49 2016
@@ -6893,6 +6893,10 @@ static void PrintMachHeader(uint32_t mag
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";
More information about the llvm-commits
mailing list