Index: ELF/Driver.cpp =================================================================== --- ELF/Driver.cpp +++ ELF/Driver.cpp @@ -228,11 +228,15 @@ 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(MBRef, "", 0)); else Files.push_back(createObjectFile(MBRef)); + break; + default: + error(Path + ": unknown file type"); } } Index: test/ELF/invalid/executable.s =================================================================== --- test/ELF/invalid/executable.s +++ test/ELF/invalid/executable.s @@ -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 Index: test/ELF/invalid/too-short.s =================================================================== --- test/ELF/invalid/too-short.s +++ test/ELF/invalid/too-short.s @@ -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