forked from OSchip/llvm-project
Don't accept unsuitable ELF files such as executables or core files.
Differential Revision: https://reviews.llvm.org/D42827 llvm-svn: 324041
This commit is contained in:
parent
42bcdffd24
commit
d0de239f70
|
@ -228,11 +228,15 @@ void LinkerDriver::addFile(StringRef Path, bool WithLOption) {
|
|||
Files.push_back(
|
||||
createSharedFile(MBRef, WithLOption ? path::filename(Path) : Path));
|
||||
return;
|
||||
default:
|
||||
case file_magic::bitcode:
|
||||
case file_magic::elf_relocatable:
|
||||
if (InLib)
|
||||
Files.push_back(make<LazyObjFile>(MBRef, "", 0));
|
||||
else
|
||||
Files.push_back(createObjectFile(MBRef));
|
||||
break;
|
||||
default:
|
||||
error(Path + ": unknown file type");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,9 @@
|
|||
# REQUIRES: x86
|
||||
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
|
||||
# RUN: ld.lld -o %t1.exe %t.o
|
||||
# RUN: not ld.lld -o %t2.exe %t1.exe 2>&1 | FileCheck %s
|
||||
# CHECK: unknown file type
|
||||
|
||||
.global _start
|
||||
_start:
|
||||
ret
|
|
@ -1,5 +0,0 @@
|
|||
# REQUIRES: x86
|
||||
|
||||
## too-short.elf file is a truncated ELF.
|
||||
# RUN: not ld.lld %S/Inputs/too-short.elf -o %t 2>&1 | FileCheck %s
|
||||
# CHECK: file is too short
|
Loading…
Reference in New Issue