This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readobj] Teach readobj to output .res (WindowsResource).
ClosedPublic

Authored by mnbvmar on Sep 19 2017, 4:15 PM.

Details

Summary

This enables readobj to output Windows resource files (.res). This way, we'll be able to test .res outputs without comparing them with "magic binary files" generated by MS.

Code detecting WindowsResource "magic string" was already in LLVM. That is why I decided to use this detection method to tell .res files from other object types.

Diff Detail

Repository
rL LLVM

Event Timeline

mnbvmar created this revision.Sep 19 2017, 4:15 PM
mnbvmar added inline comments.Sep 19 2017, 4:20 PM
llvm/include/llvm/Object/Binary.h
47

This constant needed to be moved up; llvm-readobj expects all binary objects with IDs between ID_StartObjects and ID_EndObjects to inherit from ObjectFile.

mnbvmar updated this revision to Diff 115925.Sep 19 2017, 4:22 PM

Fixed file header.

rnk accepted this revision.Sep 19 2017, 6:09 PM

lgtm, thanks!

llvm/test/tools/llvm-readobj/res-resources.test
5

Please commit the test_resource.rc file next to the .res file. Actually, it's not clear from this patch if you did git add on the input. Just make sure they both get committed. :)

This revision is now accepted and ready to land.Sep 19 2017, 6:09 PM
mnbvmar added inline comments.
llvm/test/tools/llvm-readobj/res-resources.test
5

The file is already upstream (D32609 by @ecbeckmann).

This revision was automatically updated to reflect the committed changes.

Well, I thought to have fixed it. I'll take a look at it.