1// No crash, might not be totally invalid
2RUN: llvm-objdump -private-headers %p/Inputs/macho-invalid-zero-ncmds
3
4RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-incomplete-load-command 2>&1 \
5RUN:      | FileCheck -check-prefix INCOMPLETE-LOADC %s
6INCOMPLETE-LOADC: Invalid data was encountered while parsing the file.
7
8RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-too-small-load-command 2>&1 \
9RUN:      | FileCheck -check-prefix SMALL-LOADC-SIZE %s
10RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-too-small-load-command 2>&1 \
11RUN:      | FileCheck -check-prefix SMALL-LOADC-SIZE %s
12SMALL-LOADC-SIZE: Mach-O load command with size < 8 bytes
13
14RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-too-small-segment-load-command 2>&1 \
15RUN:      | FileCheck -check-prefix SMALL-SEGLOADC-SIZE %s
16RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-too-small-segment-load-command 2>&1 \
17RUN:      | FileCheck -check-prefix SMALL-SEGLOADC-SIZE %s
18SMALL-SEGLOADC-SIZE: Mach-O segment load command size is too small
19
20RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-no-size-for-sections 2>&1 \
21RUN:      | FileCheck -check-prefix TOO-MANY-SECTS %s
22RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-no-size-for-sections 2>&1 \
23RUN:      | FileCheck -check-prefix TOO-MANY-SECTS %s
24TOO-MANY-SECTS: Mach-O segment load command contains too many sections
25
26RUN: not llvm-objdump -t %p/Inputs/macho-invalid-bad-symbol-index 2>&1 \
27RUN:      | FileCheck -check-prefix BAD-SYMBOL %s
28BAD-SYMBOL: Requested symbol index is out of range
29
30RUN: not llvm-objdump -t %p/Inputs/macho-invalid-symbol-name-past-eof 2>&1 \
31RUN:      | FileCheck -check-prefix NAME-PAST-EOF %s
32NAME-PAST-EOF: Symbol name entry points before beginning or past end of file
33
34RUN: not llvm-nm %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \
35RUN:      | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC %s
36INVALID-SECTION-IDX-SYMBOL-SEC: getSymbolSection: Invalid section index
37
38RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-header 2>&1 | FileCheck -check-prefix INVALID-HEADER %s
39INVALID-HEADER: Invalid data was encountered while parsing the file
40
41RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-incomplete-segment-load-command 2>&1 | FileCheck -check-prefix INCOMPLETE-SEGMENT-LOADC %s
42INCOMPLETE-SEGMENT-LOADC: Invalid data was encountered while parsing the file
43