2016-01-27 02:20:49 +08:00
// 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
2015-01-16 06:52:38 +08:00
2016-04-07 06:14:09 +08:00
RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho64-invalid-incomplete-load-command 2>&1 \
2015-01-16 06:52:38 +08:00
RUN: | FileCheck -check-prefix INCOMPLETE-LOADC %s
2016-04-07 06:14:09 +08:00
INCOMPLETE-LOADC: truncated or malformed object (load command 0 extends past the end all load commands in the file)
2015-01-16 06:52:38 +08:00
2016-05-04 01:16:08 +08:00
RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho64-invalid-incomplete-load-command.1 2>&1 \
RUN: | FileCheck -check-prefix INCOMPLETE-LOADC-1 %s
INCOMPLETE-LOADC-1: truncated or malformed object (load command 1 extends past the end all load commands in the file)
2016-04-14 05:17:58 +08:00
RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-too-small-load-command 2>&1 \
2015-01-16 06:52:38 +08:00
RUN: | FileCheck -check-prefix SMALL-LOADC-SIZE %s
2016-04-14 05:17:58 +08:00
RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho64-invalid-too-small-load-command 2>&1 \
2015-01-16 06:52:38 +08:00
RUN: | FileCheck -check-prefix SMALL-LOADC-SIZE %s
2016-04-22 05:20:40 +08:00
SMALL-LOADC-SIZE: truncated or malformed object (load commands extend past the end of the file)
2015-01-16 06:52:38 +08:00
2016-05-04 07:13:50 +08:00
RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho64-invalid-too-small-load-command.1 2>&1 \
RUN: | FileCheck -check-prefix SMALL-LOADC-SIZE-1 %s
SMALL-LOADC-SIZE-1: truncated or malformed object (load command 1 with size less than 8 bytes)
2015-01-16 06:52:38 +08:00
RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-too-small-segment-load-command 2>&1 \
2016-07-08 06:11:42 +08:00
RUN: | FileCheck -check-prefix MULTIPLE-NOT-4 %s
MULTIPLE-NOT-4: truncated or malformed object (load command 0 cmdsize not a multiple of 4)
2016-05-06 01:43:35 +08:00
RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-too-small-segment-load-command.1 2>&1 \
2015-01-16 06:52:38 +08:00
RUN: | FileCheck -check-prefix SMALL-SEGLOADC-SIZE %s
2016-05-06 01:43:35 +08:00
SMALL-SEGLOADC-SIZE: truncated or malformed object (load command 0 LC_SEGMENT cmdsize too small)
2016-07-08 06:11:42 +08:00
2016-05-06 01:43:35 +08:00
RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-too-small-segment-load-command 2>&1 \
2016-07-08 06:11:42 +08:00
RUN: | FileCheck -check-prefix MULTIPLE-NOT-8 %s
MULTIPLE-NOT-8: truncated or malformed object (load command 0 cmdsize not a multiple of 8)
2015-01-16 06:52:38 +08:00
RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-no-size-for-sections 2>&1 \
RUN: | FileCheck -check-prefix TOO-MANY-SECTS %s
2016-05-06 01:43:35 +08:00
TOO-MANY-SECTS: truncated or malformed object (load command 0 inconsistent cmdsize in LC_SEGMENT for the number of sections)
2015-01-16 06:52:38 +08:00
RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-no-size-for-sections 2>&1 \
2016-05-06 01:43:35 +08:00
RUN: | FileCheck -check-prefix TOO-MANY-SECTS-64 %s
TOO-MANY-SECTS-64: truncated or malformed object (load command 0 inconsistent cmdsize in LC_SEGMENT_64 for the number of sections)
2015-01-16 06:52:38 +08:00
2016-04-14 05:17:58 +08:00
RUN: not llvm-objdump -macho -t %p/Inputs/macho-invalid-bad-symbol-index 2>&1 \
2015-01-16 06:52:38 +08:00
RUN: | FileCheck -check-prefix BAD-SYMBOL %s
2016-04-14 05:17:58 +08:00
BAD-SYMBOL: truncated or malformed object (ilocalsym plus nlocalsym in LC_DYSYMTAB load command extends past the end of the symbol table)
RUN: llvm-objdump -macho -t %p/Inputs/macho-valid-0-nsyms 2>&1 \
2016-01-23 06:49:55 +08:00
RUN: | FileCheck -check-prefix ZERO-NSYMS %s
ZERO-NSYMS: SYMBOL TABLE
2015-01-16 06:52:38 +08:00
RUN: not llvm-objdump -t %p/Inputs/macho-invalid-symbol-name-past-eof 2>&1 \
RUN: | FileCheck -check-prefix NAME-PAST-EOF %s
2016-04-21 05:24:34 +08:00
NAME-PAST-EOF: truncated or malformed object (bad string index: 4261412866 for symbol at index 0)
2016-01-23 02:47:14 +08:00
RUN: llvm-nm -pa %p/Inputs/macho-invalid-symbol-name-past-eof 2>&1 \
RUN: | FileCheck -check-prefix NAME-PAST-EOF-nm-pa %s
NAME-PAST-EOF-nm-pa: 0000000000000000 - 00 0000 SO bad string index
RUN: llvm-nm -pax %p/Inputs/macho-invalid-symbol-name-past-eof 2>&1 \
RUN: | FileCheck -check-prefix NAME-PAST-EOF-nm-pax %s
NAME-PAST-EOF-nm-pax: 0000000000000000 64 00 0000 fe000002 bad string index
2015-01-16 06:52:38 +08:00
2016-05-18 01:10:12 +08:00
RUN: not llvm-objdump -t %p/Inputs/macho-bad-archive1.a 2>&1 \
RUN: | FileCheck -check-prefix NAME-PAST-EOF-ARCHIVE %s
NAME-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)
2016-06-01 04:35:34 +08:00
RUN: not llvm-objdump -macho -arch all -t %p/Inputs/macho-universal-bad1.x86_64.i386 2>&1 \
RUN: | FileCheck -check-prefix NAME-PAST-EOF-FAT %s
NAME-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)
RUN: not llvm-objdump -macho -arch all -t %p/Inputs/macho-universal-archive-bad1.x86_64.i386 2>&1 \
RUN: | FileCheck -check-prefix NAME-PAST-EOF-FAT-ARCHIVE %s
NAME-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)
2016-01-22 05:13:27 +08:00
RUN: llvm-nm %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \
2015-05-22 22:59:27 +08:00
RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC %s
2016-01-22 05:13:27 +08:00
INVALID-SECTION-IDX-SYMBOL-SEC: 0000000100000000 S __mh_execute_header
RUN: llvm-nm -m %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \
RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC-m %s
INVALID-SECTION-IDX-SYMBOL-SEC-m: 0000000100000000 (?,?) [referenced dynamically] external __mh_execute_header
RUN: llvm-nm -pax %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \
RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC-pax %s
INVALID-SECTION-IDX-SYMBOL-SEC-pax: 0000000100000000 0f 42 0010 00000065 __mh_execute_header
2016-03-24 04:27:00 +08:00
RUN: not llvm-objdump -t %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \
RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC-objdump %s
2016-05-03 04:28:12 +08:00
INVALID-SECTION-IDX-SYMBOL-SEC-objdump: truncated or malformed object (bad section index: 66 for symbol at index 8)
2015-06-05 03:45:22 +08:00
2016-04-14 05:17:58 +08:00
RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-header 2>&1 | FileCheck -check-prefix INVALID-HEADER %s
INVALID-HEADER: The file was not recognized as a valid object file
2015-06-05 06:26:44 +08:00
2016-04-14 05:17:58 +08:00
RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho64-invalid-incomplete-segment-load-command 2>&1 | FileCheck -check-prefix INCOMPLETE-SEGMENT-LOADC %s
2016-04-22 05:20:40 +08:00
INCOMPLETE-SEGMENT-LOADC: truncated or malformed object (load commands extend past the end of the file)
2016-05-18 01:10:12 +08:00
RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-bad-archive2.a 2>&1 | FileCheck -check-prefix INCOMPLETE-SEGMENT-LOADC-ARCHIVE %s
INCOMPLETE-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)
2016-06-01 04:35:34 +08:00
RUN: 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
INCOMPLETE-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)
RUN: 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
INCOMPLETE-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)
2016-06-28 05:39:39 +08:00
RUN: not llvm-objdump -macho -universal-headers %p/Inputs/macho-invalid-fat 2>&1 | FileCheck -check-prefix INVALID-FAT %s
INVALID-FAT: truncated or malformed fat file (fat_arch_64 structs would extend past the end of the file)
2016-06-29 07:16:13 +08:00
RUN: 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
INVALID-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
2016-08-06 02:19:40 +08:00
RUN: not llvm-objdump -macho -private-headers %p/Inputs/macho-invalid-segment-fileoff 2>&1 | FileCheck -check-prefix INVALID-SEGMENT-FILEOFF %s
INVALID-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)
RUN: not llvm-nm %p/Inputs/macho-invalid-segment-fileoff 2>&1 | FileCheck -check-prefix INVALID-SEGMENT-FILEOFF-NM %s
INVALID-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)
RUN: not llvm-size %p/Inputs/macho-invalid-segment-fileoff 2>&1 | FileCheck -check-prefix INVALID-SEGMENT-FILEOFF-SIZE %s
INVALID-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)