[PATCH] D26647: Identify object files compiled with cl.exe /GL.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 14 15:52:00 PST 2016


ruiu created this revision.
ruiu added a reviewer: pcc.
ruiu added a subscriber: llvm-commits.
Herald added a subscriber: mehdi_amini.

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.


https://reviews.llvm.org/D26647

Files:
  COFF/Driver.cpp
  test/COFF/Inputs/cl-gl.obj
  test/COFF/cl-gl.test


Index: test/COFF/cl-gl.test
===================================================================
--- /dev/null
+++ 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
Index: COFF/Driver.cpp
===================================================================
--- COFF/Driver.cpp
+++ COFF/Driver.cpp
@@ -80,6 +80,9 @@
     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));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26647.77904.patch
Type: text/x-patch
Size: 937 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161114/c7e00bb2/attachment.bin>


More information about the llvm-commits mailing list