summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-objdump
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2016-11-15 23:07:41 +0000
committerKevin Enderby <enderby@apple.com>2016-11-15 23:07:41 +0000
commit844c4ac55ac997ed36120771cbf87658d5eac31f (patch)
tree7eebefc14ebb80adcc2e4ab5642a369d9ea3f718 /llvm/test/tools/llvm-objdump
parent07529a313a10cc77d9736e1c5102c05e62a0594b (diff)
downloadbcm5719-llvm-844c4ac55ac997ed36120771cbf87658d5eac31f.tar.gz
bcm5719-llvm-844c4ac55ac997ed36120771cbf87658d5eac31f.zip
General clean up of Mach-O error handling in llvm-objdump.
To get a good error message for all files that could contain Mach-O files the code in llvm-objdump needs to use the archive member name and name of the architecture of a slice of a universal file in those cases where the error come from a Mach-O file in an archive or a universal file. Most of this is fixed by moving the call to checkSymbolTable() into ProcessMachO() and calling it when the operation needs the symbol table. And then calling the form of report_error() that has the ArchiveName and ArchitectureName arguments. One other place needed to call this form of report_error() also with these arguments. Also changed the code in MachODump.cpp to not use report_fatal_error() and use report_error() instead to make the code smaller and cleaner. All cases of this are for errors with the symbol table which should now never be tripped since checkSymbolTable() should be called first to get a good error message in these cases. llvm-svn: 287050
Diffstat (limited to 'llvm/test/tools/llvm-objdump')
-rw-r--r--llvm/test/tools/llvm-objdump/X86/Inputs/macho-invalid-symbol-indr-archive-universalbin0 -> 4696 bytes
-rw-r--r--llvm/test/tools/llvm-objdump/X86/Inputs/macho-invalid-symbol-nsect-archivebin0 -> 356 bytes
-rw-r--r--llvm/test/tools/llvm-objdump/X86/Inputs/macho-invalid-symbol-strx-universalbin0 -> 8452 bytes
-rw-r--r--llvm/test/tools/llvm-objdump/X86/malformed-machos.test9
4 files changed, 9 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-objdump/X86/Inputs/macho-invalid-symbol-indr-archive-universal b/llvm/test/tools/llvm-objdump/X86/Inputs/macho-invalid-symbol-indr-archive-universal
new file mode 100644
index 00000000000..09ca61afadb
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/X86/Inputs/macho-invalid-symbol-indr-archive-universal
Binary files differ
diff --git a/llvm/test/tools/llvm-objdump/X86/Inputs/macho-invalid-symbol-nsect-archive b/llvm/test/tools/llvm-objdump/X86/Inputs/macho-invalid-symbol-nsect-archive
new file mode 100644
index 00000000000..bf5f6a901bd
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/X86/Inputs/macho-invalid-symbol-nsect-archive
Binary files differ
diff --git a/llvm/test/tools/llvm-objdump/X86/Inputs/macho-invalid-symbol-strx-universal b/llvm/test/tools/llvm-objdump/X86/Inputs/macho-invalid-symbol-strx-universal
new file mode 100644
index 00000000000..9b1ef6b26af
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/X86/Inputs/macho-invalid-symbol-strx-universal
Binary files differ
diff --git a/llvm/test/tools/llvm-objdump/X86/malformed-machos.test b/llvm/test/tools/llvm-objdump/X86/malformed-machos.test
index edd6a24177e..9db87de889e 100644
--- a/llvm/test/tools/llvm-objdump/X86/malformed-machos.test
+++ b/llvm/test/tools/llvm-objdump/X86/malformed-machos.test
@@ -43,11 +43,20 @@
RUN: not llvm-objdump -macho -disassemble %p/Inputs/macho-invalid-symbol-nsect 2>&1 | FileCheck -check-prefix INVALID-SYMBOL-NSECT %s
INVALID-SYMBOL-NSECT: macho-invalid-symbol-nsect': truncated or malformed object (bad section index: 97 for symbol at index 1)
+RUN: not llvm-objdump -macho -disassemble %p/Inputs/macho-invalid-symbol-nsect-archive 2>&1 | FileCheck -check-prefix INVALID-SYMBOL-NSECT-ARCHIVE %s
+INVALID-SYMBOL-NSECT-ARCHIVE: macho-invalid-symbol-nsect-archive(macho-invalid-symbol-nsect): truncated or malformed object (bad section index: 97 for symbol at index 1)
+
RUN: not llvm-objdump -macho -disassemble %p/Inputs/macho-invalid-symbol-indr 2>&1 | FileCheck -check-prefix INVALID-SYMBOL-INDR %s
INVALID-SYMBOL-INDR: macho-invalid-symbol-indr': truncated or malformed object (bad n_value: 22 past the end of string table, for N_INDR symbol at index 1)
+RUN: not llvm-objdump -macho -disassemble -arch all %p/Inputs/macho-invalid-symbol-indr-archive-universal 2>&1 | FileCheck -check-prefix INVALID-SYMBOL-INDR-ARCHIVE-UNIVERSAL %s
+INVALID-SYMBOL-INDR-ARCHIVE-UNIVERSAL: macho-invalid-symbol-indr-archive-universal(macho-invalid-symbol-indr) (for architecture i386): truncated or malformed object (bad n_value: 22 past the end of string table, for N_INDR symbol at index 1)
+
RUN: not llvm-objdump -macho -disassemble %p/Inputs/macho-invalid-symbol-strx 2>&1 | FileCheck -check-prefix INVALID-SYMBOL-STRX %s
INVALID-SYMBOL-STRX: macho-invalid-symbol-strx': truncated or malformed object (bad string table index: 22 past the end of string table, for symbol at index 1)
+RUN: not llvm-objdump -macho -disassemble -arch all %p/Inputs/macho-invalid-symbol-strx-universal 2>&1 | FileCheck -check-prefix INVALID-SYMBOL-STRX-UNIVERSAL %s
+INVALID-SYMBOL-STRX-UNIVERSAL: macho-invalid-symbol-strx-universal' (for architecture i386): truncated or malformed object (bad string table index: 22 past the end of string table, for symbol at index 1)
+
RUN: not llvm-objdump -macho -disassemble %p/Inputs/macho-invalid-symbol-lib_ordinal 2>&1 | FileCheck -check-prefix INVALID-SYMBOL-LIB_ORDINAL %s
INVALID-SYMBOL-LIB_ORDINAL: macho-invalid-symbol-lib_ordinal': truncated or malformed object (bad library ordinal: 7 for symbol at index 2)
OpenPOWER on IntegriCloud