This is an archive of the discontinued LLVM Phabricator instance.

[llvm-readobj] Implement LLVM style printer for --notes
ClosedPublic

Authored by rupprecht on Nov 7 2018, 12:32 PM.

Details

Summary

Port the GNU style printNotes method to the LLVMStyle subclass.

This is basically just a heavy refactor so that the note parsing/formatting logic from the GNUStyle::printNotes can be shared with LLVMStyle::printNotes.

Diff Detail

Repository
rL LLVM

Event Timeline

rupprecht created this revision.Nov 7 2018, 12:32 PM
MaskRay added inline comments.Nov 7 2018, 2:59 PM
tools/llvm-readobj/ELFDumper.cpp
4534 ↗(On Diff #173005)

Descriptor.size() is unnecessary.

printGNUNoteLLVMStyle<ELFT>(Type, Descriptor, W); The function signature can be changed accordingly.

4540 ↗(On Diff #173005)

ditto

MaskRay added inline comments.Nov 7 2018, 3:05 PM
tools/llvm-readobj/ELFDumper.cpp
3668 ↗(On Diff #173005)

How about #include "llvm/Support/FormatVariadic.h"

formatv("0x{0:x}", *(const typename ELFT::Addr *)Data.data())

On LP64 Linux uint64_t should (best) use %lx

rupprecht updated this revision to Diff 173044.Nov 7 2018, 3:08 PM
  • Remove unnecessary size parameter
rupprecht marked 2 inline comments as done.Nov 7 2018, 3:08 PM
rupprecht added inline comments.Nov 7 2018, 3:31 PM
tools/llvm-readobj/ELFDumper.cpp
3668 ↗(On Diff #173005)

I'm able to use formatv("{0:x}", ...) but the uint64_t cast still seems necessary to get hex formatting.
(Note: "x" includes the "0x" part by default)

rupprecht updated this revision to Diff 173057.Nov 7 2018, 3:31 PM
  • Use formatv
MaskRay accepted this revision.Nov 7 2018, 3:36 PM
This revision is now accepted and ready to land.Nov 7 2018, 3:36 PM
This revision was automatically updated to reflect the committed changes.