[lld] r286921 - Identify object files compiled with cl.exe /GL.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 14 17:01:51 PST 2016
Author: ruiu
Date: Mon Nov 14 19:01:51 2016
New Revision: 286921
URL: http://llvm.org/viewvc/llvm-project?rev=286921&view=rev
Log:
Identify object files compiled with cl.exe /GL.
Object files compiled with cl.exe /GL contain intermediate code for LTO.
We can't (and don't want to) interpret such code, but we should print
out a user-friendly error message.
Differential Revision: https://reviews.llvm.org/D26647
Added:
lld/trunk/test/COFF/Inputs/cl-gl.obj (with props)
lld/trunk/test/COFF/cl-gl.test
Modified:
lld/trunk/COFF/Driver.cpp
Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=286921&r1=286920&r2=286921&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Mon Nov 14 19:01:51 2016
@@ -80,6 +80,9 @@ static std::unique_ptr<InputFile> create
return std::unique_ptr<InputFile>(new ArchiveFile(MB));
if (Magic == file_magic::bitcode)
return std::unique_ptr<InputFile>(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<InputFile>(new ObjectFile(MB));
Added: lld/trunk/test/COFF/Inputs/cl-gl.obj
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/Inputs/cl-gl.obj?rev=286921&view=auto
==============================================================================
Binary files lld/trunk/test/COFF/Inputs/cl-gl.obj (added) and lld/trunk/test/COFF/Inputs/cl-gl.obj Mon Nov 14 19:01:51 2016 differ
Propchange: lld/trunk/test/COFF/Inputs/cl-gl.obj
------------------------------------------------------------------------------
svn:executable = *
Added: lld/trunk/test/COFF/cl-gl.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/cl-gl.test?rev=286921&view=auto
==============================================================================
--- lld/trunk/test/COFF/cl-gl.test (added)
+++ lld/trunk/test/COFF/cl-gl.test Mon Nov 14 19:01:51 2016
@@ -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
More information about the llvm-commits
mailing list