[PATCH] D54220: [llvm-readobj] Implement LLVM style printer for --notes

Jordan Rupprecht via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 7 15:31:18 PST 2018


rupprecht added inline comments.


================
Comment at: tools/llvm-readobj/ELFDumper.cpp:3668
     if (DataSize == sizeof(typename ELFT::uint))
-      OS << format("0x%llx\n",
+      OS << format("0x%llx",
                    (uint64_t)(*(const typename ELFT::Addr *)Data.data()));
----------------
MaskRay wrote:
> 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`
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)


Repository:
  rL LLVM

https://reviews.llvm.org/D54220





More information about the llvm-commits mailing list