forked from OSchip/llvm-project
[Object, ELF] Don't call llvm_unreachable() from createELFObjectFile.
Instead, return a proper error code from factory. llvm-svn: 239113
This commit is contained in:
parent
64c2f5a50f
commit
18ad2e54ab
|
@ -38,7 +38,7 @@ ObjectFile::createELFObjectFile(MemoryBufferRef Obj) {
|
|||
else if (Ident.second == ELF::ELFDATA2MSB)
|
||||
R.reset(new ELFObjectFile<ELFType<support::big, false>>(Obj, EC));
|
||||
else
|
||||
llvm_unreachable("Buffer is not an ELF object file!");
|
||||
return object_error::parse_failed;
|
||||
} else {
|
||||
assert(Ident.first == ELF::ELFCLASS64);
|
||||
if (Ident.second == ELF::ELFDATA2LSB)
|
||||
|
@ -46,7 +46,7 @@ ObjectFile::createELFObjectFile(MemoryBufferRef Obj) {
|
|||
else if (Ident.second == ELF::ELFDATA2MSB)
|
||||
R.reset(new ELFObjectFile<ELFType<support::big, true>>(Obj, EC));
|
||||
else
|
||||
llvm_unreachable("Buffer is not an ELF object file!");
|
||||
return object_error::parse_failed;
|
||||
}
|
||||
|
||||
if (EC)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
ELF'L:þB“ELFï
|
|
@ -1,4 +1,5 @@
|
|||
; Verify that llvm-dwarfdump doesn't crash on broken input files.
|
||||
|
||||
RUN: llvm-dwarfdump %p/Inputs/invalid.elf 2>&1 | FileCheck %s --check-prefix=INVALID-ELF
|
||||
RUN: llvm-dwarfdump %p/Inputs/invalid.elf.2 2>&1 | FileCheck %s --check-prefix=INVALID-ELF
|
||||
INVALID-ELF: Invalid data was encountered while parsing the file
|
||||
|
|
Loading…
Reference in New Issue