This is an archive of the discontinued LLVM Phabricator instance.

[llvm-objdump] - llvm-objdump can miss printing bytes at the end of a section.
ClosedPublic

Authored by sidneym on Jan 31 2019, 2:49 PM.

Details

Summary

llvm-objdump can miss printing bytes at the end of a section.

This file:

.globl foo
.type foo, @object
foo:
.byte 't','h','i', 's',' ','i','s',' '
.byte 'a',' ','t','e','s','t'
.size foo, . - foo

Produces this output:
f.o: file format ELF64-x86-64

Disassembly of section .text:
0000000000000000 foo:

0:	 74 68 69 73 20 69 73 20         this is 
8:	 61 20 74 65 73 74               a

It should be:
f.o: file format ELF64-x86-64

Disassembly of section .text:
0000000000000000 foo:

0:	 74 68 69 73 20 69 73 20         this is 
8:	 61 20 74 65 73 74               a test

Diff Detail

Repository
rL LLVM

Event Timeline

sidneym created this revision.Jan 31 2019, 2:49 PM

Looks correct to me. Have a few comments/nits about the test case.

test/tools/llvm-objdump/X86/bytes.test
8 ↗(On Diff #184620)

I would simplify to
.ascii "this is a test"

11 ↗(On Diff #184620)

I am not sure this is a useful 2 lines of comments.
You are testing the ASCII output first of all.

13 ↗(On Diff #184620)

You do not need this line I think.

16 ↗(On Diff #184620)

So maybe just omit testing the bytes?

0:       {{*.}}         this is
8:       {{*.}}         a test
Herald added a project: Restricted Project. · View Herald TranscriptFeb 1 2019, 12:25 AM
sidneym updated this revision to Diff 184752.Feb 1 2019, 7:42 AM

Updated the testcase.

grimar accepted this revision.Feb 1 2019, 7:49 AM

LGTM.

This revision is now accepted and ready to land.Feb 1 2019, 7:49 AM
grimar added a comment.Feb 1 2019, 7:52 AM

Oh, maybe some better name for the test? Since it is not relative to bytes anymore. Maybe disasm-text.test or something like that?

This revision was automatically updated to reflect the committed changes.