[PATCH] D32652: Gracefully handle empty .drectve sections
Shoaib Meenai via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun May 14 11:48:19 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL303014: [COFF] Gracefully handle empty .drectve sections (authored by smeenai).
Changed prior to commit:
https://reviews.llvm.org/D32652?vs=97391&id=98931#toc
Repository:
rL LLVM
https://reviews.llvm.org/D32652
Files:
llvm/trunk/lib/Object/COFFObjectFile.cpp
llvm/trunk/test/Object/Inputs/COFF/empty-drectve.yaml
llvm/trunk/test/Object/coff-empty-drectve.test
Index: llvm/trunk/lib/Object/COFFObjectFile.cpp
===================================================================
--- llvm/trunk/lib/Object/COFFObjectFile.cpp
+++ llvm/trunk/lib/Object/COFFObjectFile.cpp
@@ -1062,7 +1062,7 @@
// In COFF, a virtual section won't have any in-file
// content, so the file pointer to the content will be zero.
if (Sec->PointerToRawData == 0)
- return object_error::parse_failed;
+ return std::error_code();
// The only thing that we need to verify is that the contents is contained
// within the file bounds. We don't need to make sure it doesn't cover other
// data, as there's nothing that says that is not allowed.
Index: llvm/trunk/test/Object/coff-empty-drectve.test
===================================================================
--- llvm/trunk/test/Object/coff-empty-drectve.test
+++ llvm/trunk/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): {{$}}
Index: llvm/trunk/test/Object/Inputs/COFF/empty-drectve.yaml
===================================================================
--- llvm/trunk/test/Object/Inputs/COFF/empty-drectve.yaml
+++ llvm/trunk/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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32652.98931.patch
Type: text/x-patch
Size: 1723 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170514/fa84f3fc/attachment.bin>
More information about the llvm-commits
mailing list