summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorShoaib Meenai <smeenai@fb.com>2017-05-14 18:34:56 +0000
committerShoaib Meenai <smeenai@fb.com>2017-05-14 18:34:56 +0000
commitee97c5f0125e8f07ee53934bf607c5d518959cac (patch)
tree01dd3965aa76889366a401f7856c004932b59079 /llvm/test
parent5bef9c627e44077e4ec5024be062faecc4eab3e5 (diff)
downloadbcm5719-llvm-ee97c5f0125e8f07ee53934bf607c5d518959cac.tar.gz
bcm5719-llvm-ee97c5f0125e8f07ee53934bf607c5d518959cac.zip
[COFF] Gracefully handle empty .drectve sections
Running `llvm-readobj -coff-directives msvcrt.lib` resulted in this error: Invalid data was encountered while parsing the file This happened because some of the object files in the archive have empty `.drectve` sections. These empty sections result in a `parse_failed` error being returned from `COFFObjectFile::getSectionContents()`, which in turn caused `llvm-readobj` to stop. With this change, `getSectionContents` now returns success, and like before the resulting array is empty. Patch by Dave Lee. Differential Revision: https://reviews.llvm.org/D32652 llvm-svn: 303014
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Object/Inputs/COFF/empty-drectve.yaml14
-rw-r--r--llvm/test/Object/coff-empty-drectve.test3
2 files changed, 17 insertions, 0 deletions
diff --git a/llvm/test/Object/Inputs/COFF/empty-drectve.yaml b/llvm/test/Object/Inputs/COFF/empty-drectve.yaml
new file mode 100644
index 00000000000..af288807e3a
--- /dev/null
+++ b/llvm/test/Object/Inputs/COFF/empty-drectve.yaml
@@ -0,0 +1,14 @@
+--- !COFF
+header:
+ Machine: IMAGE_FILE_MACHINE_I386
+sections:
+ - Name: .drectve
+ Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ]
+ SectionData: ''
+symbols:
+ - Name: .drectve
+ Value: 0
+ SectionNumber: 1
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_STATIC
diff --git a/llvm/test/Object/coff-empty-drectve.test b/llvm/test/Object/coff-empty-drectve.test
new file mode 100644
index 00000000000..f76d7bf7271
--- /dev/null
+++ b/llvm/test/Object/coff-empty-drectve.test
@@ -0,0 +1,3 @@
+RUN: yaml2obj %p/Inputs/COFF/empty-drectve.yaml | llvm-readobj -coff-directives - | FileCheck %s
+
+CHECK: Directive(s): {{$}}
OpenPOWER on IntegriCloud