blob: 2236b0b03c18ff232795883518d45c269496e131 [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 Enderby368e7142016-05-03 17:16:08 +000012RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho64-invalid-incomplete-load-command.1 2>&1 \
13RUN: | FileCheck -check-prefix INCOMPLETE-LOADC-1 %s
14INCOMPLETE-LOADC-1: truncated or malformed object (load command 1 extends past the end all load commands in the file)
15
Kevin Enderby87025742016-04-13 21:17:58 +000016RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-too-small-load-command 2>&1 \
Filipe Cabecinhas40139502015-01-15 22:52:38 +000017RUN: | FileCheck -check-prefix SMALL-LOADC-SIZE %s
Kevin Enderby87025742016-04-13 21:17:58 +000018RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho64-invalid-too-small-load-command 2>&1 \
Filipe Cabecinhas40139502015-01-15 22:52:38 +000019RUN: | FileCheck -check-prefix SMALL-LOADC-SIZE %s
Kevin Enderby6e295f22016-04-21 21:20:40 +000020SMALL-LOADC-SIZE: truncated or malformed object (load commands extend past the end of the file)
Filipe Cabecinhas40139502015-01-15 22:52:38 +000021
Kevin Enderbya8e3ab02016-05-03 23:13:50 +000022RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho64-invalid-too-small-load-command.1 2>&1 \
23RUN: | FileCheck -check-prefix SMALL-LOADC-SIZE-1 %s
24SMALL-LOADC-SIZE-1: truncated or malformed object (load command 1 with size less than 8 bytes)
25
Filipe Cabecinhas40139502015-01-15 22:52:38 +000026RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-too-small-segment-load-command 2>&1 \
Kevin Enderby1851a822016-07-07 22:11:42 +000027RUN: | FileCheck -check-prefix MULTIPLE-NOT-4 %s
28MULTIPLE-NOT-4: truncated or malformed object (load command 0 cmdsize not a multiple of 4)
29
Kevin Enderbyb34e3a12016-05-05 17:43:35 +000030RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-too-small-segment-load-command.1 2>&1 \
Filipe Cabecinhas40139502015-01-15 22:52:38 +000031RUN: | FileCheck -check-prefix SMALL-SEGLOADC-SIZE %s
Kevin Enderbyb34e3a12016-05-05 17:43:35 +000032SMALL-SEGLOADC-SIZE: truncated or malformed object (load command 0 LC_SEGMENT cmdsize too small)
Kevin Enderby1851a822016-07-07 22:11:42 +000033
Kevin Enderbyb34e3a12016-05-05 17:43:35 +000034RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-too-small-segment-load-command 2>&1 \
Kevin Enderby1851a822016-07-07 22:11:42 +000035RUN: | FileCheck -check-prefix MULTIPLE-NOT-8 %s
36MULTIPLE-NOT-8: truncated or malformed object (load command 0 cmdsize not a multiple of 8)
Filipe Cabecinhas40139502015-01-15 22:52:38 +000037
38RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-no-size-for-sections 2>&1 \
39RUN: | FileCheck -check-prefix TOO-MANY-SECTS %s
Kevin Enderbyb34e3a12016-05-05 17:43:35 +000040TOO-MANY-SECTS: truncated or malformed object (load command 0 inconsistent cmdsize in LC_SEGMENT for the number of sections)
Filipe Cabecinhas40139502015-01-15 22:52:38 +000041RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-no-size-for-sections 2>&1 \
Kevin Enderbyb34e3a12016-05-05 17:43:35 +000042RUN: | FileCheck -check-prefix TOO-MANY-SECTS-64 %s
43TOO-MANY-SECTS-64: truncated or malformed object (load command 0 inconsistent cmdsize in LC_SEGMENT_64 for the number of sections)
Filipe Cabecinhas40139502015-01-15 22:52:38 +000044
Kevin Enderby87025742016-04-13 21:17:58 +000045RUN: not llvm-objdump -macho -t %p/Inputs/macho-invalid-bad-symbol-index 2>&1 \
Filipe Cabecinhas40139502015-01-15 22:52:38 +000046RUN: | FileCheck -check-prefix BAD-SYMBOL %s
Kevin Enderby87025742016-04-13 21:17:58 +000047BAD-SYMBOL: truncated or malformed object (ilocalsym plus nlocalsym in LC_DYSYMTAB load command extends past the end of the symbol table)
48RUN: llvm-objdump -macho -t %p/Inputs/macho-valid-0-nsyms 2>&1 \
Kevin Enderby1829c682016-01-22 22:49:55 +000049RUN: | FileCheck -check-prefix ZERO-NSYMS %s
50ZERO-NSYMS: SYMBOL TABLE
Filipe Cabecinhas40139502015-01-15 22:52:38 +000051
52RUN: not llvm-objdump -t %p/Inputs/macho-invalid-symbol-name-past-eof 2>&1 \
53RUN: | FileCheck -check-prefix NAME-PAST-EOF %s
Kevin Enderby81e8b7d2016-04-20 21:24:34 +000054NAME-PAST-EOF: truncated or malformed object (bad string index: 4261412866 for symbol at index 0)
Kevin Enderbyf681ec52016-01-22 18:47:14 +000055RUN: llvm-nm -pa %p/Inputs/macho-invalid-symbol-name-past-eof 2>&1 \
56RUN: | FileCheck -check-prefix NAME-PAST-EOF-nm-pa %s
57NAME-PAST-EOF-nm-pa: 0000000000000000 - 00 0000 SO bad string index
58RUN: llvm-nm -pax %p/Inputs/macho-invalid-symbol-name-past-eof 2>&1 \
59RUN: | FileCheck -check-prefix NAME-PAST-EOF-nm-pax %s
60NAME-PAST-EOF-nm-pax: 0000000000000000 64 00 0000 fe000002 bad string index
Filipe Cabecinhas40139502015-01-15 22:52:38 +000061
Kevin Enderbyac9e1552016-05-17 17:10:12 +000062RUN: not llvm-objdump -t %p/Inputs/macho-bad-archive1.a 2>&1 \
63RUN: | FileCheck -check-prefix NAME-PAST-EOF-ARCHIVE %s
64NAME-PAST-EOF-ARCHIVE: macho-bad-archive1.a(macho-invalid-symbol-name-past-eof) truncated or malformed object (bad string index: 4261412866 for symbol at index 0)
65
Kevin Enderby9acb1092016-05-31 20:35:34 +000066RUN: not llvm-objdump -macho -arch all -t %p/Inputs/macho-universal-bad1.x86_64.i386 2>&1 \
67RUN: | FileCheck -check-prefix NAME-PAST-EOF-FAT %s
68NAME-PAST-EOF-FAT: macho-universal-bad1.x86_64.i386 (for architecture x86_64) truncated or malformed object (bad string index: 4261412866 for symbol at index 0)
69RUN: not llvm-objdump -macho -arch all -t %p/Inputs/macho-universal-archive-bad1.x86_64.i386 2>&1 \
70RUN: | FileCheck -check-prefix NAME-PAST-EOF-FAT-ARCHIVE %s
71NAME-PAST-EOF-FAT-ARCHIVE: macho-universal-archive-bad1.x86_64.i386(macho-invalid-symbol-name-past-eof) (for architecture x86_64) truncated or malformed object (bad string index: 4261412866 for symbol at index 0)
72
Kevin Enderby1f472ea2016-01-21 21:13:27 +000073RUN: llvm-nm %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \
Rafael Espindola0d85d102015-05-22 14:59:27 +000074RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC %s
Kevin Enderby1f472ea2016-01-21 21:13:27 +000075INVALID-SECTION-IDX-SYMBOL-SEC: 0000000100000000 S __mh_execute_header
76RUN: llvm-nm -m %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \
77RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC-m %s
78INVALID-SECTION-IDX-SYMBOL-SEC-m: 0000000100000000 (?,?) [referenced dynamically] external __mh_execute_header
79RUN: llvm-nm -pax %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \
80RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC-pax %s
81INVALID-SECTION-IDX-SYMBOL-SEC-pax: 0000000100000000 0f 42 0010 00000065 __mh_execute_header
Kevin Enderby5afbc1c2016-03-23 20:27:00 +000082RUN: not llvm-objdump -t %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \
83RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC-objdump %s
Kevin Enderby7bd8d992016-05-02 20:28:12 +000084INVALID-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 +000085
Kevin Enderby87025742016-04-13 21:17:58 +000086RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-header 2>&1 | FileCheck -check-prefix INVALID-HEADER %s
87INVALID-HEADER: The file was not recognized as a valid object file
Alexey Samsonovf8a7bf82015-06-04 22:26:44 +000088
Kevin Enderby87025742016-04-13 21:17:58 +000089RUN: 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 +000090INCOMPLETE-SEGMENT-LOADC: truncated or malformed object (load commands extend past the end of the file)
Kevin Enderbyac9e1552016-05-17 17:10:12 +000091
92RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-bad-archive2.a 2>&1 | FileCheck -check-prefix INCOMPLETE-SEGMENT-LOADC-ARCHIVE %s
93INCOMPLETE-SEGMENT-LOADC-ARCHIVE: macho-bad-archive2.a(macho64-invalid-incomplete-segment-load-command) truncated or malformed object (load commands extend past the end of the file)
Kevin Enderby9acb1092016-05-31 20:35:34 +000094
95RUN: not llvm-objdump -macho -private-headers -arch all %p/Inputs/macho-universal-bad2.x86_64.i386 2>&1 | FileCheck -check-prefix INCOMPLETE-SEGMENT-LOADC-FAT %s
96INCOMPLETE-SEGMENT-LOADC-FAT: macho-universal-bad2.x86_64.i386 (for architecture x86_64) truncated or malformed object (load commands extend past the end of the file)
97
98RUN: not llvm-objdump -macho -private-headers -arch all %p/Inputs/macho-universal-archive-bad2.x86_64.i386 2>&1 | FileCheck -check-prefix INCOMPLETE-SEGMENT-LOADC-FAT-ARCHIVE %s
99INCOMPLETE-SEGMENT-LOADC-FAT-ARCHIVE: macho-universal-archive-bad2.x86_64.i386(macho64-invalid-incomplete-segment-load-command) (for architecture x86_64) truncated or malformed object (load commands extend past the end of the file)
Kevin Enderby10519092016-06-27 21:39:39 +0000100
101RUN: not llvm-objdump -macho -universal-headers %p/Inputs/macho-invalid-fat 2>&1 | FileCheck -check-prefix INVALID-FAT %s
102INVALID-FAT: truncated or malformed fat file (fat_arch_64 structs would extend past the end of the file)
Kevin Enderby42398052016-06-28 23:16:13 +0000103
104RUN: not llvm-objdump -macho -private-headers -arch all %p/Inputs/macho-invalid-fat.obj.elf-x86_64 2>&1 | FileCheck -check-prefix INVALID-FAT-ELF %s
105INVALID-FAT-ELF: Mach-O universal file: {{.*}}/macho-invalid-fat.obj.elf-x86_64 for architecture x86_64 is not a Mach-O file or an archive file
Kevin Enderby600fb3f2016-08-05 18:19:40 +0000106
107RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-segment-fileoff 2>&1 | FileCheck -check-prefix INVALID-SEGMENT-FILEOFF %s
108INVALID-SEGMENT-FILEOFF: macho-invalid-segment-fileoff': truncated or malformed object (load command 0 fileoff field in LC_SEGMENT extends past the end of the file)
109
110RUN: not llvm-nm %p/Inputs/macho-invalid-segment-fileoff 2>&1 | FileCheck -check-prefix INVALID-SEGMENT-FILEOFF-NM %s
111INVALID-SEGMENT-FILEOFF-NM: macho-invalid-segment-fileoff truncated or malformed object (load command 0 fileoff field in LC_SEGMENT extends past the end of the file)
112
113RUN: not llvm-size %p/Inputs/macho-invalid-segment-fileoff 2>&1 | FileCheck -check-prefix INVALID-SEGMENT-FILEOFF-SIZE %s
114INVALID-SEGMENT-FILEOFF-SIZE: macho-invalid-segment-fileoff truncated or malformed object (load command 0 fileoff field in LC_SEGMENT extends past the end of the file)