This is an archive of the discontinued LLVM Phabricator instance.

Add a file magic for CL.exe's object file created with /GL.
ClosedPublic

Authored by ruiu on Nov 14 2016, 3:51 PM.

Details

Summary

This patch makes it possible to identify object files created by CL.exe
with /GL option. Such file contains Microsoft proprietary intermediate
code instead of target machine code to do LTO.

I need this to print out user-friendly error message from LLD.

Event Timeline

ruiu updated this revision to Diff 77902.Nov 14 2016, 3:51 PM
ruiu retitled this revision from to Add a file magic for CL.exe's object file created with /GL..
ruiu updated this object.
ruiu added a reviewer: pcc.
ruiu added a subscriber: llvm-commits.
ruiu added a comment.Nov 14 2016, 4:04 PM

Note that I couldn't find a documentation about the format of cl.exe /GL object files. I found that the header is the same as COFF bigobj, and also noticed that all object files has the same magic, so I guessed that this is the way to identify /GL object files.

pcc accepted this revision.Nov 14 2016, 5:01 PM
pcc edited edge metadata.

LGTM

lib/Support/Path.cpp
998

It doesn't really matter, but sizeof(COFF::ClGlObjMagic) here.

This revision is now accepted and ready to land.Nov 14 2016, 5:01 PM
ruiu added inline comments.Nov 14 2016, 5:04 PM
lib/Support/Path.cpp
998

I'd prefer the current code for consistency with the code above.

This revision was automatically updated to reflect the committed changes.