blob: 038f5a840f98a0d2c1a86e82a88c522977ccced4 [file] [log] [blame]
Kevin Enderby40fdbf82016-01-26 18:20:49 +00001// 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.
4RUN: llvm-objdump -private-headers %p/Inputs/macho-invalid-zero-ncmds -macho \
5RUN: | FileCheck -check-prefix ZERO-NCMDS %s
6ZERO-NCMDS: MH_MAGIC_64 0 0 0x00 OBJECT 0 0 0x00000000
Filipe Cabecinhas40139502015-01-15 22:52:38 +00007
Kevin Enderby3fcdf6a2016-04-06 22:14:09 +00008RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho64-invalid-incomplete-load-command 2>&1 \
Filipe Cabecinhas40139502015-01-15 22:52:38 +00009RUN: | FileCheck -check-prefix INCOMPLETE-LOADC %s
Kevin Enderby3fcdf6a2016-04-06 22:14:09 +000010INCOMPLETE-LOADC: truncated or malformed object (load command 0 extends past the end all load commands in the file)
Filipe Cabecinhas40139502015-01-15 22:52:38 +000011
Kevin Enderby87025742016-04-13 21:17:58 +000012RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-too-small-load-command 2>&1 \
Filipe Cabecinhas40139502015-01-15 22:52:38 +000013RUN: | FileCheck -check-prefix SMALL-LOADC-SIZE %s
Kevin Enderby87025742016-04-13 21:17:58 +000014RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho64-invalid-too-small-load-command 2>&1 \
Filipe Cabecinhas40139502015-01-15 22:52:38 +000015RUN: | FileCheck -check-prefix SMALL-LOADC-SIZE %s
Kevin Enderby6e295f22016-04-21 21:20:40 +000016SMALL-LOADC-SIZE: truncated or malformed object (load commands extend past the end of the file)
Filipe Cabecinhas40139502015-01-15 22:52:38 +000017
18RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-too-small-segment-load-command 2>&1 \
19RUN: | FileCheck -check-prefix SMALL-SEGLOADC-SIZE %s
20RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-too-small-segment-load-command 2>&1 \
21RUN: | FileCheck -check-prefix SMALL-SEGLOADC-SIZE %s
Alexey Samsonov074da9b2015-06-04 20:08:52 +000022SMALL-SEGLOADC-SIZE: Mach-O segment load command size is too small
Filipe Cabecinhas40139502015-01-15 22:52:38 +000023
24RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-no-size-for-sections 2>&1 \
25RUN: | FileCheck -check-prefix TOO-MANY-SECTS %s
26RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-no-size-for-sections 2>&1 \
27RUN: | FileCheck -check-prefix TOO-MANY-SECTS %s
Alexey Samsonov074da9b2015-06-04 20:08:52 +000028TOO-MANY-SECTS: Mach-O segment load command contains too many sections
Filipe Cabecinhas40139502015-01-15 22:52:38 +000029
Kevin Enderby87025742016-04-13 21:17:58 +000030RUN: not llvm-objdump -macho -t %p/Inputs/macho-invalid-bad-symbol-index 2>&1 \
Filipe Cabecinhas40139502015-01-15 22:52:38 +000031RUN: | FileCheck -check-prefix BAD-SYMBOL %s
Kevin Enderby87025742016-04-13 21:17:58 +000032BAD-SYMBOL: truncated or malformed object (ilocalsym plus nlocalsym in LC_DYSYMTAB load command extends past the end of the symbol table)
33RUN: llvm-objdump -macho -t %p/Inputs/macho-valid-0-nsyms 2>&1 \
Kevin Enderby1829c682016-01-22 22:49:55 +000034RUN: | FileCheck -check-prefix ZERO-NSYMS %s
35ZERO-NSYMS: SYMBOL TABLE
Filipe Cabecinhas40139502015-01-15 22:52:38 +000036
37RUN: not llvm-objdump -t %p/Inputs/macho-invalid-symbol-name-past-eof 2>&1 \
38RUN: | FileCheck -check-prefix NAME-PAST-EOF %s
Kevin Enderby81e8b7d2016-04-20 21:24:34 +000039NAME-PAST-EOF: truncated or malformed object (bad string index: 4261412866 for symbol at index 0)
Kevin Enderbyf681ec52016-01-22 18:47:14 +000040RUN: llvm-nm -pa %p/Inputs/macho-invalid-symbol-name-past-eof 2>&1 \
41RUN: | FileCheck -check-prefix NAME-PAST-EOF-nm-pa %s
42NAME-PAST-EOF-nm-pa: 0000000000000000 - 00 0000 SO bad string index
43RUN: llvm-nm -pax %p/Inputs/macho-invalid-symbol-name-past-eof 2>&1 \
44RUN: | FileCheck -check-prefix NAME-PAST-EOF-nm-pax %s
45NAME-PAST-EOF-nm-pax: 0000000000000000 64 00 0000 fe000002 bad string index
Filipe Cabecinhas40139502015-01-15 22:52:38 +000046
Kevin Enderby1f472ea2016-01-21 21:13:27 +000047RUN: llvm-nm %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \
Rafael Espindola0d85d102015-05-22 14:59:27 +000048RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC %s
Kevin Enderby1f472ea2016-01-21 21:13:27 +000049INVALID-SECTION-IDX-SYMBOL-SEC: 0000000100000000 S __mh_execute_header
50RUN: llvm-nm -m %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \
51RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC-m %s
52INVALID-SECTION-IDX-SYMBOL-SEC-m: 0000000100000000 (?,?) [referenced dynamically] external __mh_execute_header
53RUN: llvm-nm -pax %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \
54RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC-pax %s
55INVALID-SECTION-IDX-SYMBOL-SEC-pax: 0000000100000000 0f 42 0010 00000065 __mh_execute_header
Kevin Enderby5afbc1c2016-03-23 20:27:00 +000056RUN: not llvm-objdump -t %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \
57RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC-objdump %s
Kevin Enderby7bd8d992016-05-02 20:28:12 +000058INVALID-SECTION-IDX-SYMBOL-SEC-objdump: truncated or malformed object (bad section index: 66 for symbol at index 8)
Alexey Samsonov9f336632015-06-04 19:45:22 +000059
Kevin Enderby87025742016-04-13 21:17:58 +000060RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-header 2>&1 | FileCheck -check-prefix INVALID-HEADER %s
61INVALID-HEADER: The file was not recognized as a valid object file
Alexey Samsonovf8a7bf82015-06-04 22:26:44 +000062
Kevin Enderby87025742016-04-13 21:17:58 +000063RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho64-invalid-incomplete-segment-load-command 2>&1 | FileCheck -check-prefix INCOMPLETE-SEGMENT-LOADC %s
Kevin Enderby6e295f22016-04-21 21:20:40 +000064INCOMPLETE-SEGMENT-LOADC: truncated or malformed object (load commands extend past the end of the file)