summaryrefslogtreecommitdiffstats
path: root/llvm/test/Object/invalid.test
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-06-19 20:58:43 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-06-19 20:58:43 +0000
commit3dc0d05bf455ef75cd309a46be668966d692f4b5 (patch)
tree8dd6f3c5d0b23b4f4745e4155751240d3fd5e3a3 /llvm/test/Object/invalid.test
parent90b05b52fa52c78aa10ef97359e859f3c2242734 (diff)
downloadbcm5719-llvm-3dc0d05bf455ef75cd309a46be668966d692f4b5.tar.gz
bcm5719-llvm-3dc0d05bf455ef75cd309a46be668966d692f4b5.zip
Improve error handling of getRelocationAddend.
This patch changes getRelocationAddend to use ErrorOr and considers it an error to try to get the addend of a REL section. If, for example, a x86_64 file has a REL section, that file is corrupted and we should reject it. Using ErrorOr is not ideal since we check the section type once per relocation instead of once per section. Checking once per section would involve getRelocationAddend just asserting and callers checking the section before iterating over the relocations. In any case, this is an improvement and includes a test. llvm-svn: 240176
Diffstat (limited to 'llvm/test/Object/invalid.test')
-rw-r--r--llvm/test/Object/invalid.test2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/test/Object/invalid.test b/llvm/test/Object/invalid.test
new file mode 100644
index 00000000000..73bf62a1ed4
--- /dev/null
+++ b/llvm/test/Object/invalid.test
@@ -0,0 +1,2 @@
+RUN: not llvm-dwarfdump %p/Inputs/invalid-bad-rel-type.elf 2>&1 | FileCheck %s
+CHECK: Invalid data was encountered while parsing the file
OpenPOWER on IntegriCloud