Index: lld/trunk/COFF/Driver.cpp =================================================================== --- lld/trunk/COFF/Driver.cpp +++ lld/trunk/COFF/Driver.cpp @@ -80,6 +80,9 @@ return std::unique_ptr(new ArchiveFile(MB)); if (Magic == file_magic::bitcode) return std::unique_ptr(new BitcodeFile(MB)); + if (Magic == file_magic::coff_cl_gl_object) + fatal(MB.getBufferIdentifier() + ": is not a native COFF file. " + "Recompile without /GL"); if (Config->OutputFile == "") Config->OutputFile = getOutputPath(MB.getBufferIdentifier()); return std::unique_ptr(new ObjectFile(MB)); Index: lld/trunk/test/COFF/cl-gl.test =================================================================== --- lld/trunk/test/COFF/cl-gl.test +++ lld/trunk/test/COFF/cl-gl.test @@ -0,0 +1,4 @@ +# RUN: not lld-link /out:%t.exe /entry:main %S/Inputs/cl-gl.obj >& %t.log +# RUN: FileCheck %s < %t.log + +# CHECK: is not a native COFF file. Recompile without /GL