This is an archive of the discontinued LLVM Phabricator instance.

[llvm-objdump] Print newlines before and after "Disassembly of section ...:"
ClosedPublic

Authored by MaskRay on Apr 25 2019, 6:29 AM.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

MaskRay created this revision.Apr 25 2019, 6:29 AM

This is what GNU objdump does. I don't know why llvm-objdump didn't do this in the first place..

    5a64:       e9 57 be ff ff          jmp    18c0 <__cxa_atexit@plt>                                         

Disassembly of section .fini:

0000000000005a6c <.fini>:
MaskRay updated this revision to Diff 196633.Apr 25 2019, 7:34 AM

Add 3 missed tests

Does GNU objdump print the blank line even before the first section?

It would be good to have, in one of the llvm-objdump-specific tests, a test for both this point, and more generally the blank lines before and after the section name. As far as I can tell, there is no direct testing for the before-newline in the llvm-objdump tests you've modified, except for where a very specific different feature of llvm-objdump is being tested.

lld/test/ELF/arm-tls-gd32.s
94 ↗(On Diff #196633)

This doesn't seem like a direct match to what was there before. What's the motivation here?

llvm/test/MC/X86/disassemble-zeroes.s
26 ↗(On Diff #196633)

Not that I'm particularly bothered either way, but is there a reason you've removed this?

MaskRay marked 2 inline comments as done.May 1 2019, 2:49 AM
MaskRay added inline comments.
lld/test/ELF/arm-tls-gd32.s
94 ↗(On Diff #196633)

GNU objdump

Disassembly of section .fini:

0000000000005a6c <.fini>:
    5a6c:       48 83 ec 08             sub    rsp,0x8

llvm-objdump

Disassembly of section .fini:
0000000000005a6c .fini:
    5a6c: 48 83 ec 08                   subq    $8, %rsp

Note that in llvm-objdump, there are two lines matching .fini:. I have to prepend the address to make the check line match the second line. Since I'm changing it, using CHECK-LABEL: improves error messages in case the address changes.

llvm/test/MC/X86/disassemble-zeroes.s
26 ↗(On Diff #196633)

I think the .text section was not intended to check in this test.

MaskRay updated this revision to Diff 197522.May 1 2019, 3:03 AM

Add dedicated test test/tools/llvm-objdump/X86/disassemble-section-name.s

GNU objdump prints the blank line even before the first section.

This revision is now accepted and ready to land.May 1 2019, 3:26 AM
This revision was automatically updated to reflect the committed changes.