summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2017-07-20 23:08:41 +0000
committerKevin Enderby <enderby@apple.com>2017-07-20 23:08:41 +0000
commit3e95bd2239236df3e1417519d7fdae6b72c94c4e (patch)
tree57b7fe7517be98c897adff09e118ebf66314669c /llvm/test
parentb5e9070388fac4e0ad123565290ca0a78378982d (diff)
downloadbcm5719-llvm-3e95bd2239236df3e1417519d7fdae6b72c94c4e.tar.gz
bcm5719-llvm-3e95bd2239236df3e1417519d7fdae6b72c94c4e.zip
Add error handling to the dyld compact export entries in libObject.
lld needs a matching change for this will be my next commit. Expect it to fail build until that matching commit is picked up by the bots. Like the changes in r296527 for dyld bind entires and the changes in r298883 for lazy bind, weak bind and rebase entries the export entries are the last of the dyld compact info to have error handling added. This follows the model of iterators that can fail that Lang Hanes designed when fixing the problem for bad archives r275316 (or r275361). So that iterating through the exports now terminates if there is an error and returns an llvm::Error with an error message in all cases for malformed input. This change provides the plumbing for the error handling, all the needed testing of error conditions and test cases for all of the unique error messages. llvm-svn: 308690
Diffstat (limited to 'llvm/test')
-rwxr-xr-xllvm/test/tools/llvm-objdump/Inputs/macho-inconsistant-exportbin0 -> 8752 bytes
-rwxr-xr-xllvm/test/tools/llvm-objdump/Inputs/macho-trie-bad-export-info-malformed-uleb128bin0 -> 8760 bytes
-rwxr-xr-xllvm/test/tools/llvm-objdump/Inputs/macho-trie-bad-export-info-malformed-uleb128_too_bigbin0 -> 8768 bytes
-rwxr-xr-xllvm/test/tools/llvm-objdump/Inputs/macho-trie-bad-kindbin0 -> 8752 bytes
-rwxr-xr-xllvm/test/tools/llvm-objdump/Inputs/macho-trie-bad-library-ordinalbin0 -> 8752 bytes
-rwxr-xr-xllvm/test/tools/llvm-objdump/Inputs/macho-trie-children-count-bytebin0 -> 8752 bytes
-rwxr-xr-xllvm/test/tools/llvm-objdump/Inputs/macho-trie-edge-string-endbin0 -> 8912 bytes
-rwxr-xr-xllvm/test/tools/llvm-objdump/Inputs/macho-trie-export-info-size-too-bigbin0 -> 8752 bytes
-rwxr-xr-xllvm/test/tools/llvm-objdump/Inputs/macho-trie-import-name-endbin0 -> 8752 bytes
-rwxr-xr-xllvm/test/tools/llvm-objdump/Inputs/macho-trie-import-name-startbin0 -> 8752 bytes
-rwxr-xr-xllvm/test/tools/llvm-objdump/Inputs/macho-trie-node-loopbin0 -> 8752 bytes
-rwxr-xr-xllvm/test/tools/llvm-objdump/Inputs/macho-trie-not-export-nodebin0 -> 8756 bytes
-rw-r--r--llvm/test/tools/llvm-objdump/macho-bad-trie.test35
13 files changed, 35 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-objdump/Inputs/macho-inconsistant-export b/llvm/test/tools/llvm-objdump/Inputs/macho-inconsistant-export
new file mode 100755
index 00000000000..da137800a8d
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/Inputs/macho-inconsistant-export
Binary files differ
diff --git a/llvm/test/tools/llvm-objdump/Inputs/macho-trie-bad-export-info-malformed-uleb128 b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-bad-export-info-malformed-uleb128
new file mode 100755
index 00000000000..57ae7bd6c07
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-bad-export-info-malformed-uleb128
Binary files differ
diff --git a/llvm/test/tools/llvm-objdump/Inputs/macho-trie-bad-export-info-malformed-uleb128_too_big b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-bad-export-info-malformed-uleb128_too_big
new file mode 100755
index 00000000000..06e005d209d
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-bad-export-info-malformed-uleb128_too_big
Binary files differ
diff --git a/llvm/test/tools/llvm-objdump/Inputs/macho-trie-bad-kind b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-bad-kind
new file mode 100755
index 00000000000..809d0be2820
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-bad-kind
Binary files differ
diff --git a/llvm/test/tools/llvm-objdump/Inputs/macho-trie-bad-library-ordinal b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-bad-library-ordinal
new file mode 100755
index 00000000000..cbe8c2c62d7
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-bad-library-ordinal
Binary files differ
diff --git a/llvm/test/tools/llvm-objdump/Inputs/macho-trie-children-count-byte b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-children-count-byte
new file mode 100755
index 00000000000..63d389b6586
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-children-count-byte
Binary files differ
diff --git a/llvm/test/tools/llvm-objdump/Inputs/macho-trie-edge-string-end b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-edge-string-end
new file mode 100755
index 00000000000..573bf8ea710
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-edge-string-end
Binary files differ
diff --git a/llvm/test/tools/llvm-objdump/Inputs/macho-trie-export-info-size-too-big b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-export-info-size-too-big
new file mode 100755
index 00000000000..e41f314355f
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-export-info-size-too-big
Binary files differ
diff --git a/llvm/test/tools/llvm-objdump/Inputs/macho-trie-import-name-end b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-import-name-end
new file mode 100755
index 00000000000..f1d8f67ade0
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-import-name-end
Binary files differ
diff --git a/llvm/test/tools/llvm-objdump/Inputs/macho-trie-import-name-start b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-import-name-start
new file mode 100755
index 00000000000..4f7e93c4fc0
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-import-name-start
Binary files differ
diff --git a/llvm/test/tools/llvm-objdump/Inputs/macho-trie-node-loop b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-node-loop
new file mode 100755
index 00000000000..b94dfa2610e
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-node-loop
Binary files differ
diff --git a/llvm/test/tools/llvm-objdump/Inputs/macho-trie-not-export-node b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-not-export-node
new file mode 100755
index 00000000000..38882762cf0
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/Inputs/macho-trie-not-export-node
Binary files differ
diff --git a/llvm/test/tools/llvm-objdump/macho-bad-trie.test b/llvm/test/tools/llvm-objdump/macho-bad-trie.test
new file mode 100644
index 00000000000..5309123454c
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/macho-bad-trie.test
@@ -0,0 +1,35 @@
+RUN: not llvm-objdump -macho -exports-trie %p/Inputs/macho-trie-bad-kind 2>&1 | FileCheck -check-prefix BAD_KIND %s
+BAD_KIND: macho-trie-bad-kind': truncated or malformed object (unsupported exported symbol kind: 3 in flags: 0x13 in export trie data at node: 0x53)
+
+RUN: not llvm-objdump -macho -exports-trie %p/Inputs/macho-trie-bad-export-info-malformed-uleb128 2>&1 | FileCheck -check-prefix MALFORMED_ULEB128 %s
+MALFORMED_ULEB128: macho-trie-bad-export-info-malformed-uleb128': truncated or malformed object (export info size malformed uleb128, extends past end in export trie data at node: 0x5A)
+
+RUN: not llvm-objdump -macho -exports-trie %p/Inputs/macho-trie-bad-export-info-malformed-uleb128_too_big 2>&1 | FileCheck -check-prefix MALFORMED_ULEB128_TOO_BIG %s
+MALFORMED_ULEB128_TOO_BIG: macho-trie-bad-export-info-malformed-uleb128_too_big': truncated or malformed object (export info size uleb128 too big for uint64 in export trie data at node: 0x5A)
+
+RUN: not llvm-objdump -macho -exports-trie %p/Inputs/macho-trie-export-info-size-too-big 2>&1 | FileCheck -check-prefix EXPORT_INFO_SIZE_TOO_BIG %s
+EXPORT_INFO_SIZE_TOO_BIG: macho-trie-export-info-size-too-big': truncated or malformed object (export info size: 0x1234 in export trie data at node: 0x33 too big and extends past end of trie data)
+
+RUN: not llvm-objdump -macho -exports-trie %p/Inputs/macho-trie-children-count-byte 2>&1 | FileCheck -check-prefix CHILDREN_COUNT_BYTE %s
+CHILDREN_COUNT_BYTE: macho-trie-children-count-byte': truncated or malformed object (byte for count of childern in export trie data at node: 0x5 extends past end of trie data)
+
+RUN: not llvm-objdump -macho -exports-trie %p/Inputs/macho-trie-import-name-start 2>&1 | FileCheck -check-prefix IMPORT_NAME_START %s
+IMPORT_NAME_START: macho-trie-import-name-start': truncated or malformed object (import name of re-export in export trie data at node: 0x33 starts past end of trie data)
+
+RUN: not llvm-objdump -macho -exports-trie %p/Inputs/macho-trie-import-name-end 2>&1 | FileCheck -check-prefix IMPORT_NAME_END %s
+IMPORT_NAME_END: macho-trie-import-name-end': truncated or malformed object (import name of re-export in export trie data at node: 0x33 extends past end of trie data)
+
+RUN: not llvm-objdump -macho -exports-trie %p/Inputs/macho-trie-edge-string-end 2>&1 | FileCheck -check-prefix EDGE_STRING_END %s
+EDGE_STRING_END: macho-trie-edge-string-end': truncated or malformed object (edge sub-string in export trie data at node: 0x42 for child #0 extends past end of trie data)
+
+RUN: not llvm-objdump -macho -exports-trie %p/Inputs/macho-trie-not-export-node 2>&1 | FileCheck -check-prefix NOT_EXPORT_NODE %s
+NOT_EXPORT_NODE: macho-trie-not-export-node': truncated or malformed object (node is not an export node in export trie data at node: 0x5A)
+
+RUN: not llvm-objdump -macho -exports-trie %p/Inputs/macho-trie-node-loop 2>&1 | FileCheck -check-prefix LOOP_OF_CHILDERN %s
+LOOP_OF_CHILDERN: macho-trie-node-loop': truncated or malformed object (loop in childern in export trie data at node: 0x42 back to node: 0x5)
+
+RUN: not llvm-objdump -macho -exports-trie %p/Inputs/macho-trie-bad-library-ordinal 2>&1 | FileCheck -check-prefix BAD_LIBRARY_ORDINAL %s
+BAD_LIBRARY_ORDINAL: macho-trie-bad-library-ordinal': truncated or malformed object (bad library ordinal: 69 (max 3) in export trie data at node: 0x33)
+
+RUN: not llvm-objdump -macho -exports-trie %p/Inputs/macho-inconsistant-export 2>&1 | FileCheck -check-prefix INCONSISTANT_EXPORT_SIZE %s
+INCONSISTANT_EXPORT_SIZE: macho-inconsistant-export': truncated or malformed object (inconsistant export info size: 0x9 where actual size was: 0x5 in export trie data at node: 0x53)
OpenPOWER on IntegriCloud