Index: ELF/Driver.cpp =================================================================== --- ELF/Driver.cpp +++ ELF/Driver.cpp @@ -849,7 +849,7 @@ } } - if (Files.empty() && ErrorCount == 0) + if ((!Config->Relocatable && Files.empty()) && ErrorCount == 0) error("no input files"); } Index: test/ELF/Inputs/relocatable-empty-archive.s =================================================================== --- test/ELF/Inputs/relocatable-empty-archive.s +++ test/ELF/Inputs/relocatable-empty-archive.s @@ -0,0 +1 @@ +! Index: test/ELF/relocatable-empty-archive.s =================================================================== --- test/ELF/relocatable-empty-archive.s +++ test/ELF/relocatable-empty-archive.s @@ -0,0 +1 @@ +# RUN: ld.lld -m elf_x86_64 %S/Inputs/relocatable-empty-archive.s -o %t -r