diff options
Diffstat (limited to 'llvm/test')
16 files changed, 51 insertions, 9 deletions
diff --git a/llvm/test/Object/Inputs/macho-invalid-bad-symbol-index b/llvm/test/Object/Inputs/macho-invalid-bad-symbol-index Binary files differnew file mode 100644 index 00000000000..294bbde3ddf --- /dev/null +++ b/llvm/test/Object/Inputs/macho-invalid-bad-symbol-index diff --git a/llvm/test/Object/Inputs/macho-invalid-getsection-index b/llvm/test/Object/Inputs/macho-invalid-getsection-index Binary files differnew file mode 100644 index 00000000000..b7e4b95bc9b --- /dev/null +++ b/llvm/test/Object/Inputs/macho-invalid-getsection-index diff --git a/llvm/test/Object/Inputs/macho-invalid-no-size-for-sections b/llvm/test/Object/Inputs/macho-invalid-no-size-for-sections Binary files differnew file mode 100644 index 00000000000..89fa95acbcf --- /dev/null +++ b/llvm/test/Object/Inputs/macho-invalid-no-size-for-sections diff --git a/llvm/test/Object/Inputs/macho-invalid-section-index-getSectionRawFinalSegmentName b/llvm/test/Object/Inputs/macho-invalid-section-index-getSectionRawFinalSegmentName Binary files differnew file mode 100644 index 00000000000..e3f65865922 --- /dev/null +++ b/llvm/test/Object/Inputs/macho-invalid-section-index-getSectionRawFinalSegmentName diff --git a/llvm/test/Object/Inputs/macho-invalid-section-index-getSectionRawName b/llvm/test/Object/Inputs/macho-invalid-section-index-getSectionRawName Binary files differnew file mode 100644 index 00000000000..9cd3e1cace8 --- /dev/null +++ b/llvm/test/Object/Inputs/macho-invalid-section-index-getSectionRawName diff --git a/llvm/test/Object/Inputs/macho-invalid-symbol-name-past-eof b/llvm/test/Object/Inputs/macho-invalid-symbol-name-past-eof Binary files differnew file mode 100644 index 00000000000..87478840787 --- /dev/null +++ b/llvm/test/Object/Inputs/macho-invalid-symbol-name-past-eof diff --git a/llvm/test/Object/Inputs/macho-invalid-too-small-load-command b/llvm/test/Object/Inputs/macho-invalid-too-small-load-command Binary files differnew file mode 100644 index 00000000000..36021692ee5 --- /dev/null +++ b/llvm/test/Object/Inputs/macho-invalid-too-small-load-command diff --git a/llvm/test/Object/Inputs/macho-invalid-too-small-segment-load-command b/llvm/test/Object/Inputs/macho-invalid-too-small-segment-load-command Binary files differnew file mode 100644 index 00000000000..8cbfbf96578 --- /dev/null +++ b/llvm/test/Object/Inputs/macho-invalid-too-small-segment-load-command diff --git a/llvm/test/Object/Inputs/macho-zero-ncmds b/llvm/test/Object/Inputs/macho-invalid-zero-ncmds Binary files differindex 0505419195e..0505419195e 100644 --- a/llvm/test/Object/Inputs/macho-zero-ncmds +++ b/llvm/test/Object/Inputs/macho-invalid-zero-ncmds diff --git a/llvm/test/Object/Inputs/macho64-invalid-getsection-index b/llvm/test/Object/Inputs/macho64-invalid-getsection-index Binary files differnew file mode 100644 index 00000000000..a2a7bc10c4f --- /dev/null +++ b/llvm/test/Object/Inputs/macho64-invalid-getsection-index diff --git a/llvm/test/Object/Inputs/macho64-invalid-incomplete-load-command b/llvm/test/Object/Inputs/macho64-invalid-incomplete-load-command Binary files differnew file mode 100644 index 00000000000..a569c9e14b3 --- /dev/null +++ b/llvm/test/Object/Inputs/macho64-invalid-incomplete-load-command diff --git a/llvm/test/Object/Inputs/macho64-invalid-no-size-for-sections b/llvm/test/Object/Inputs/macho64-invalid-no-size-for-sections Binary files differnew file mode 100644 index 00000000000..5aae5ffed3a --- /dev/null +++ b/llvm/test/Object/Inputs/macho64-invalid-no-size-for-sections diff --git a/llvm/test/Object/Inputs/macho64-invalid-too-small-load-command b/llvm/test/Object/Inputs/macho64-invalid-too-small-load-command Binary files differnew file mode 100644 index 00000000000..0028451d190 --- /dev/null +++ b/llvm/test/Object/Inputs/macho64-invalid-too-small-load-command diff --git a/llvm/test/Object/Inputs/macho64-invalid-too-small-segment-load-command b/llvm/test/Object/Inputs/macho64-invalid-too-small-segment-load-command Binary files differnew file mode 100644 index 00000000000..ce6a20134a9 --- /dev/null +++ b/llvm/test/Object/Inputs/macho64-invalid-too-small-segment-load-command diff --git a/llvm/test/Object/macho-invalid.test b/llvm/test/Object/macho-invalid.test new file mode 100644 index 00000000000..138d8eb1f3d --- /dev/null +++ b/llvm/test/Object/macho-invalid.test @@ -0,0 +1,51 @@ +// No crash, might not be totally invalid +RUN: llvm-objdump -private-headers %p/Inputs/macho-invalid-zero-ncmds + +RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-incomplete-load-command 2>&1 \ +RUN: | FileCheck -check-prefix INCOMPLETE-LOADC %s + +RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-too-small-load-command 2>&1 \ +RUN: | FileCheck -check-prefix SMALL-LOADC-SIZE %s +RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-too-small-load-command 2>&1 \ +RUN: | FileCheck -check-prefix SMALL-LOADC-SIZE %s + +RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-too-small-segment-load-command 2>&1 \ +RUN: | FileCheck -check-prefix SMALL-SEGLOADC-SIZE %s +RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-too-small-segment-load-command 2>&1 \ +RUN: | FileCheck -check-prefix SMALL-SEGLOADC-SIZE %s + +RUN: not llvm-objdump -private-headers %p/Inputs/macho-invalid-no-size-for-sections 2>&1 \ +RUN: | FileCheck -check-prefix TOO-MANY-SECTS %s +RUN: not llvm-objdump -private-headers %p/Inputs/macho64-invalid-no-size-for-sections 2>&1 \ +RUN: | FileCheck -check-prefix TOO-MANY-SECTS %s + +RUN: not llvm-objdump -t %p/Inputs/macho-invalid-bad-symbol-index 2>&1 \ +RUN: | FileCheck -check-prefix BAD-SYMBOL %s + +RUN: not llvm-objdump -t %p/Inputs/macho-invalid-symbol-name-past-eof 2>&1 \ +RUN: | FileCheck -check-prefix NAME-PAST-EOF %s + +RUN: not llvm-objdump -t %p/Inputs/macho-invalid-section-index-getSectionRawFinalSegmentName 2>&1 \ +RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SEG-NAME %s + +RUN: not llvm-nm %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \ +RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SECT-NAME %s + +RUN: not llvm-objdump -t %p/Inputs/macho-invalid-getsection-index 2>&1 \ +RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-GETSECT %s + +RUN: not llvm-objdump -t %p/Inputs/macho64-invalid-getsection-index 2>&1 \ +RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-GETSECT64 %s + + +SMALL-LOADC-SIZE: Load command with size < 8 bytes +SMALL-SEGLOADC-SIZE: Segment load command size is too small +INCOMPLETE-LOADC: Malformed MachO file +TOO-MANY-SECTS: Number of sections too large for size of load command +BAD-SYMBOL: Requested symbol index is out of range +NAME-PAST-EOF: Symbol name entry points past end of file + +INVALID-SECTION-IDX-SEG-NAME: getSectionRawFinalSegmentName: Invalid section index +INVALID-SECTION-IDX-SECT-NAME: getSectionRawName: Invalid section index +INVALID-SECTION-IDX-GETSECT: getSection: Invalid section index +INVALID-SECTION-IDX-GETSECT64: getSection64: Invalid section index diff --git a/llvm/test/Object/objdump-macho-quirks.test b/llvm/test/Object/objdump-macho-quirks.test deleted file mode 100644 index eeee1537def..00000000000 --- a/llvm/test/Object/objdump-macho-quirks.test +++ /dev/null @@ -1,9 +0,0 @@ -RUN: llvm-objdump -private-headers %p/Inputs/macho-zero-ncmds \ -RUN: | FileCheck %s -check-prefix A - -// Check that we don't get an infinite loop if ncmds = 0 -A: file format Mach-O 64-bit unknown -A: Mach header -A: magic cputype cpusubtype caps filetype ncmds sizeofcmds flags -A: MH_MAGIC_64 0x00 OBJECT 0 0 0x00000000 - |

