Kevin Enderby | 40fdbf8 | 2016-01-26 18:20:49 +0000 | [diff] [blame] | 1 | // An odd Mach-O file, with just a mach header with all but the magic field |
| 2 | // and filetype zeros. The cputype and cpusubtype fields being zero are invalid, |
| 3 | // but that does not mater for the most part to display some of the contents. |
| 4 | RUN: llvm-objdump -private-headers %p/Inputs/macho-invalid-zero-ncmds -macho \ |
| 5 | RUN: | FileCheck -check-prefix ZERO-NCMDS %s |
| 6 | ZERO-NCMDS: MH_MAGIC_64 0 0 0x00 OBJECT 0 0 0x00000000 |
Filipe Cabecinhas | 4013950 | 2015-01-15 22:52:38 +0000 | [diff] [blame] | 7 | |
Kevin Enderby | 3fcdf6a | 2016-04-06 22:14:09 +0000 | [diff] [blame] | 8 | RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho64-invalid-incomplete-load-command 2>&1 \ |
Filipe Cabecinhas | 4013950 | 2015-01-15 22:52:38 +0000 | [diff] [blame] | 9 | RUN: | FileCheck -check-prefix INCOMPLETE-LOADC %s |
Kevin Enderby | 3fcdf6a | 2016-04-06 22:14:09 +0000 | [diff] [blame] | 10 | INCOMPLETE-LOADC: truncated or malformed object (load command 0 extends past the end all load commands in the file) |
Filipe Cabecinhas | 4013950 | 2015-01-15 22:52:38 +0000 | [diff] [blame] | 11 | |
| 12 | RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-too-small-load-command 2>&1 \ |
| 13 | RUN: | FileCheck -check-prefix SMALL-LOADC-SIZE %s |
| 14 | RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-too-small-load-command 2>&1 \ |
| 15 | RUN: | FileCheck -check-prefix SMALL-LOADC-SIZE %s |
Alexey Samsonov | de5a94a | 2015-06-04 19:57:46 +0000 | [diff] [blame] | 16 | SMALL-LOADC-SIZE: Mach-O load command with size < 8 bytes |
Filipe Cabecinhas | 4013950 | 2015-01-15 22:52:38 +0000 | [diff] [blame] | 17 | |
| 18 | RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-too-small-segment-load-command 2>&1 \ |
| 19 | RUN: | FileCheck -check-prefix SMALL-SEGLOADC-SIZE %s |
| 20 | RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-too-small-segment-load-command 2>&1 \ |
| 21 | RUN: | FileCheck -check-prefix SMALL-SEGLOADC-SIZE %s |
Alexey Samsonov | 074da9b | 2015-06-04 20:08:52 +0000 | [diff] [blame] | 22 | SMALL-SEGLOADC-SIZE: Mach-O segment load command size is too small |
Filipe Cabecinhas | 4013950 | 2015-01-15 22:52:38 +0000 | [diff] [blame] | 23 | |
| 24 | RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-no-size-for-sections 2>&1 \ |
| 25 | RUN: | FileCheck -check-prefix TOO-MANY-SECTS %s |
| 26 | RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-no-size-for-sections 2>&1 \ |
| 27 | RUN: | FileCheck -check-prefix TOO-MANY-SECTS %s |
Alexey Samsonov | 074da9b | 2015-06-04 20:08:52 +0000 | [diff] [blame] | 28 | TOO-MANY-SECTS: Mach-O segment load command contains too many sections |
Filipe Cabecinhas | 4013950 | 2015-01-15 22:52:38 +0000 | [diff] [blame] | 29 | |
| 30 | RUN: not llvm-objdump -t %p/Inputs/macho-invalid-bad-symbol-index 2>&1 \ |
| 31 | RUN: | FileCheck -check-prefix BAD-SYMBOL %s |
Kevin Enderby | 1829c68 | 2016-01-22 22:49:55 +0000 | [diff] [blame] | 32 | BAD-SYMBOL: Invalid data was encountered while parsing the file. |
| 33 | RUN: llvm-objdump -t %p/Inputs/macho-valid-0-nsyms 2>&1 \ |
| 34 | RUN: | FileCheck -check-prefix ZERO-NSYMS %s |
| 35 | ZERO-NSYMS: SYMBOL TABLE |
| 36 | ZERO-NSYMS-NOT: Requested symbol index is out of range |
Filipe Cabecinhas | 4013950 | 2015-01-15 22:52:38 +0000 | [diff] [blame] | 37 | |
| 38 | RUN: not llvm-objdump -t %p/Inputs/macho-invalid-symbol-name-past-eof 2>&1 \ |
| 39 | RUN: | FileCheck -check-prefix NAME-PAST-EOF %s |
Kevin Enderby | f681ec5 | 2016-01-22 18:47:14 +0000 | [diff] [blame] | 40 | NAME-PAST-EOF: error reading file: Invalid data was encountered while parsing the file. |
| 41 | RUN: llvm-nm -pa %p/Inputs/macho-invalid-symbol-name-past-eof 2>&1 \ |
| 42 | RUN: | FileCheck -check-prefix NAME-PAST-EOF-nm-pa %s |
| 43 | NAME-PAST-EOF-nm-pa: 0000000000000000 - 00 0000 SO bad string index |
| 44 | RUN: llvm-nm -pax %p/Inputs/macho-invalid-symbol-name-past-eof 2>&1 \ |
| 45 | RUN: | FileCheck -check-prefix NAME-PAST-EOF-nm-pax %s |
| 46 | NAME-PAST-EOF-nm-pax: 0000000000000000 64 00 0000 fe000002 bad string index |
Filipe Cabecinhas | 4013950 | 2015-01-15 22:52:38 +0000 | [diff] [blame] | 47 | |
Kevin Enderby | 1f472ea | 2016-01-21 21:13:27 +0000 | [diff] [blame] | 48 | RUN: llvm-nm %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \ |
Rafael Espindola | 0d85d10 | 2015-05-22 14:59:27 +0000 | [diff] [blame] | 49 | RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC %s |
Kevin Enderby | 1f472ea | 2016-01-21 21:13:27 +0000 | [diff] [blame] | 50 | INVALID-SECTION-IDX-SYMBOL-SEC: 0000000100000000 S __mh_execute_header |
| 51 | RUN: llvm-nm -m %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \ |
| 52 | RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC-m %s |
| 53 | INVALID-SECTION-IDX-SYMBOL-SEC-m: 0000000100000000 (?,?) [referenced dynamically] external __mh_execute_header |
| 54 | RUN: llvm-nm -pax %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \ |
| 55 | RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC-pax %s |
| 56 | INVALID-SECTION-IDX-SYMBOL-SEC-pax: 0000000100000000 0f 42 0010 00000065 __mh_execute_header |
Kevin Enderby | 5afbc1c | 2016-03-23 20:27:00 +0000 | [diff] [blame] | 57 | RUN: not llvm-objdump -t %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \ |
| 58 | RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC-objdump %s |
| 59 | INVALID-SECTION-IDX-SYMBOL-SEC-objdump: Invalid data was encountered while parsing the file. |
Alexey Samsonov | 9f33663 | 2015-06-04 19:45:22 +0000 | [diff] [blame] | 60 | |
| 61 | RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-header 2>&1 | FileCheck -check-prefix INVALID-HEADER %s |
Kevin Enderby | 87c85b7 | 2016-01-26 23:43:37 +0000 | [diff] [blame] | 62 | INVALID-HEADER: The file was not recognized as a valid object file. |
| 63 | NOT-INVALID-HEADER: Invalid data was encountered while parsing the file. |
Alexey Samsonov | f8a7bf8 | 2015-06-04 22:26:44 +0000 | [diff] [blame] | 64 | |
| 65 | RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-incomplete-segment-load-command 2>&1 | FileCheck -check-prefix INCOMPLETE-SEGMENT-LOADC %s |
| 66 | INCOMPLETE-SEGMENT-LOADC: Invalid data was encountered while parsing the file |