diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -259,6 +259,7 @@
         make<SharedFile>(mbref, withLOption ? path::filename(path) : path));
     return;
   case file_magic::bitcode:
+  case file_magic::elf_executable:
   case file_magic::elf_relocatable:
     if (inLib)
       files.push_back(make<LazyObjFile>(mbref, "", 0));
diff --git a/lld/test/ELF/executable.test b/lld/test/ELF/executable.test
new file mode 100644
--- /dev/null
+++ b/lld/test/ELF/executable.test
@@ -0,0 +1,19 @@
+# REQUIRES: x86
+## Test an ET_EXEC can be linked like a relocatable object.
+
+# RUN: echo nop | llvm-mc -filetype=obj -triple=x86_64 - -o %t.o
+# RUN: ld.lld %t.o -o %t.exe
+
+# RUN: ld.lld %t.exe -o %t
+# RUN: cmp %t.exe %t
+
+## This demonstrates a use case that a linker script can
+## uses the section contents to create another output.
+# RUN: ld.lld -T %s %t.exe %t.exe -o %t2
+# RUN: llvm-readelf -x .foo %t2 | FileCheck %s
+
+# CHECK: 0x00000000 90cccccc 90
+
+SECTIONS {
+  .foo : { *(.text) }
+}
diff --git a/lld/test/ELF/invalid/core.test b/lld/test/ELF/invalid/core.test
new file mode 100644
--- /dev/null
+++ b/lld/test/ELF/invalid/core.test
@@ -0,0 +1,12 @@
+## Reject core files.
+# RUN: yaml2obj %s -o %t
+# RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s
+
+# CHECK: unknown file type
+
+!ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_CORE
+  Machine: EM_X86_64
diff --git a/lld/test/ELF/invalid/executable.s b/lld/test/ELF/invalid/executable.s
deleted file mode 100644
--- a/lld/test/ELF/invalid/executable.s
+++ /dev/null
@@ -1,9 +0,0 @@
-# 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 /dev/null %t1.exe 2>&1 | FileCheck %s
-# CHECK: unknown file type
-
-.global _start
-_start:
-  ret