diff options
-rw-r--r-- | llvm/lib/Object/COFFObjectFile.cpp | 2 | ||||
-rw-r--r-- | llvm/test/Object/Inputs/COFF/empty-drectve.yaml | 14 | ||||
-rw-r--r-- | llvm/test/Object/coff-empty-drectve.test | 3 |
3 files changed, 18 insertions, 1 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp index b7e4479bcad..28531feccfe 100644 --- a/llvm/lib/Object/COFFObjectFile.cpp +++ b/llvm/lib/Object/COFFObjectFile.cpp @@ -1062,7 +1062,7 @@ COFFObjectFile::getSectionContents(const coff_section *Sec, // 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. 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): {{$}} |