This is an archive of the discontinued LLVM Phabricator instance.

[llvm-objdump,ARM] Make dumpARMELFData line up with instructions.
ClosedPublic

Authored by simon_tatham on Jul 22 2022, 7:18 AM.

Details

Summary

The whitespace in output lines containing disassembled instructions
was extremely mismatched against that in .word lines produced from
dumping literal pools and other data in Arm ELF files. This patch
adjusts dumpARMELFData so that it uses the same alignment system as
in the instruction pretty-printers. Now the two classes of line are
aligned sensibly alongside each other.

Diff Detail

Event Timeline

simon_tatham created this revision.Jul 22 2022, 7:18 AM
simon_tatham requested review of this revision.Jul 22 2022, 7:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 22 2022, 7:18 AM
DavidSpickett accepted this revision.Jul 25 2022, 7:45 AM

LGTM

Makes me wonder if .word should also print the bytes together like you're changing instructions to do but that's a separate thing.

$ objdump -d /tmp/test.o
<...>
   0:   cafef00d        .word   0xcafef00d
$ ./bin/llvm-objdump -d /tmp/test.o
<...>
0000000000000000 <fn>:
       0:       0d f0 fe ca     .word   0xcafef00d
llvm/tools/llvm-objdump/llvm-objdump.cpp
1019

This becomes Bytes[Index] when you rebase to include https://reviews.llvm.org/D130360 I assume.

This revision is now accepted and ready to land.Jul 25 2022, 7:45 AM

Makes me wonder if .word should also print the bytes together like you're changing instructions to do but that's a separate thing.

I agree that it's separate. In particular, that's data rather than code, so you do have to pay attention to endianness, and I wasn't sure if it would get confusing in a big-endian disassembly to have code and data lines right next to each other both showing 32-bit hex numbers which are implicitly representing the contents of memory in conflicting endiannesses!

llvm/tools/llvm-objdump/llvm-objdump.cpp
1019

Yes, I reordered the patches because D130360 got review attention first, and haven't rebased this one yet.

This revision was landed with ongoing or failed builds.Jul 26 2022, 1:35 AM
This revision was automatically updated to reflect the committed changes.