summaryrefslogtreecommitdiff
path: root/test/Object/macho-invalid.test
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2016-05-31 20:35:34 +0000
committerKevin Enderby <enderby@apple.com>2016-05-31 20:35:34 +0000
commite9ddf3a4a753c755496ae88d458d6ccca1200579 (patch)
tree8301edd73504c6ef8d82e7d2f0f7ca35c3f698fe /test/Object/macho-invalid.test
parent37735dbc09b0877f5ece8fb2e47a008fa6abf7e0 (diff)
Change llvm-objdump, llvm-nm and llvm-size when reporting an object file error
when the object is from a slice of a Mach-O Universal Binary use something like "foo.o (for architecture i386)" as part of the error message when expected. Also fixed places in these tools that were ignoring object file errors from MachOUniversalBinary::getAsObjectFile() when the code moved on to see if the slice was an archive. To do this MachOUniversalBinary::getAsObjectFile() and MachOUniversalBinary::getObjectForArch() were changed from returning ErrorOr<...> to Expected<...> then that was threaded up to its users. Converting these interfaces to Expected<> from ErrorOr<> does involve touching a number of places. To contain the changes for now the use of errorToErrorCode() is still used in two places yet to be fully converted. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271332 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Object/macho-invalid.test')
-rw-r--r--test/Object/macho-invalid.test13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/Object/macho-invalid.test b/test/Object/macho-invalid.test
index 55d9d25ab72..3fe6296645b 100644
--- a/test/Object/macho-invalid.test
+++ b/test/Object/macho-invalid.test
@@ -60,6 +60,13 @@ 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)
+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)
+
RUN: llvm-nm %p/Inputs/macho-invalid-section-index-getSectionRawName 2>&1 \
RUN: | FileCheck -check-prefix INVALID-SECTION-IDX-SYMBOL-SEC %s
INVALID-SECTION-IDX-SYMBOL-SEC: 0000000100000000 S __mh_execute_header
@@ -81,3 +88,9 @@ INCOMPLETE-SEGMENT-LOADC: truncated or malformed object (load commands extend pa
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)
+
+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)