This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readobj] Include the PE magic value in printouts
ClosedPublic

Authored by mstorsjo on Jun 29 2017, 2:15 PM.

Diff Detail

Event Timeline

ruiu added inline comments.Jun 29 2017, 2:17 PM
tools/llvm-readobj/COFFDumper.cpp
681

I believe this is 0x8086 for x86, so you want to print it out in hex.

mstorsjo added inline comments.Jun 29 2017, 2:19 PM
tools/llvm-readobj/COFFDumper.cpp
681

No, it's not that (that's the COFF machine magic word); this is the PE type indicator, 0x10b for normal PE32 and 0x20b for PE32+ (for 64 bit object files). But you're right that it might make more sense to print it in hex.

mstorsjo updated this revision to Diff 104736.Jun 29 2017, 2:22 PM

Printing the value as hex.

ruiu edited edge metadata.Jun 29 2017, 2:25 PM

Basically every change needs a test. Can you add?

mstorsjo updated this revision to Diff 104738.Jun 29 2017, 2:27 PM

Added a check for this value in an existing test.

ruiu added a comment.Jun 29 2017, 2:29 PM

Can you also add a check to llvm/test/tools/llvm-readobj/file-headers.test?

mstorsjo updated this revision to Diff 104740.Jun 29 2017, 2:34 PM

Added a test for this in the only section of file-headers.test that included ImageOptionalHeader.

ruiu accepted this revision.Jun 29 2017, 2:35 PM

LGTM

This revision is now accepted and ready to land.Jun 29 2017, 2:35 PM
This revision was automatically updated to reflect the committed changes.