diff options
author | Greg Fitzgerald <gregf@codeaurora.org> | 2014-03-20 22:55:15 +0000 |
---|---|---|
committer | Greg Fitzgerald <gregf@codeaurora.org> | 2014-03-20 22:55:15 +0000 |
commit | aff0ab4e7ca5ee5e65b5b25fad8f6a17f364e072 (patch) | |
tree | b35d94a1ce363c72fc0ca72e6b99d93217a66818 /tools | |
parent | f59d05cf35c7d255b0379a69411c8068932bcdbb (diff) | |
download | llvm-aff0ab4e7ca5ee5e65b5b25fad8f6a17f364e072.tar.gz llvm-aff0ab4e7ca5ee5e65b5b25fad8f6a17f364e072.tar.bz2 llvm-aff0ab4e7ca5ee5e65b5b25fad8f6a17f364e072.tar.xz |
llvm-objdump output hex to match binutils' objdump
Patch by Ted Woodward
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204409 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvm-objdump/llvm-objdump.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/llvm-objdump/llvm-objdump.cpp b/tools/llvm-objdump/llvm-objdump.cpp index f5328a959e..42bbf731ff 100644 --- a/tools/llvm-objdump/llvm-objdump.cpp +++ b/tools/llvm-objdump/llvm-objdump.cpp @@ -382,6 +382,9 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) { } } + StringRef Fmt = Obj->getBytesInAddress() > 4 ? "\t\t%016" PRIx64 ": " : + "\t\t\t%08" PRIx64 ": "; + // Create a mapping, RelocSecs = SectionRelocMap[S], where sections // in RelocSecs contain the relocations for section S. error_code EC; @@ -536,7 +539,7 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) { if (error(rel_cur->getTypeName(name))) goto skip_print_rel; if (error(rel_cur->getValueString(val))) goto skip_print_rel; - outs() << format("\t\t\t%8" PRIx64 ": ", SectionAddr + addr) << name + outs() << format(Fmt.data(), SectionAddr + addr) << name << "\t" << val << "\n"; skip_print_rel: @@ -548,6 +551,8 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) { } static void PrintRelocations(const ObjectFile *Obj) { + StringRef Fmt = Obj->getBytesInAddress() > 4 ? "%016" PRIx64 : + "%08" PRIx64; for (const SectionRef &Section : Obj->sections()) { if (Section.relocation_begin() == Section.relocation_end()) continue; @@ -570,7 +575,8 @@ static void PrintRelocations(const ObjectFile *Obj) { continue; if (error(Reloc.getValueString(valuestr))) continue; - outs() << address << " " << relocname << " " << valuestr << "\n"; + outs() << format(Fmt.data(), address) << " " << relocname << " " + << valuestr << "\n"; } outs() << "\n"; } |