From 5d9c8ad43bf7638af531f12bddca5f07162dae89 Mon Sep 17 00:00:00 2001 From: Sid Manning Date: Fri, 1 Feb 2019 19:11:47 +0000 Subject: [PATCH] [llvm-objdump] - llvm-objdump can skip bytes at the end of a section. Differential Revision: https://reviews.llvm.org/D57549 llvm-svn: 352900 --- llvm/test/tools/llvm-objdump/X86/disasm-text.test | 11 +++++++++++ llvm/tools/llvm-objdump/llvm-objdump.cpp | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 llvm/test/tools/llvm-objdump/X86/disasm-text.test diff --git a/llvm/test/tools/llvm-objdump/X86/disasm-text.test b/llvm/test/tools/llvm-objdump/X86/disasm-text.test new file mode 100644 index 0000000..38422d8 --- /dev/null +++ b/llvm/test/tools/llvm-objdump/X86/disasm-text.test @@ -0,0 +1,11 @@ +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o -| \ +# RUN: llvm-objdump -d - | FileCheck %s + +.globl foo +.type foo, @object +foo: +.ascii "this is a test" + +# CHECK: foo: +# CHECK: 0:{{.*}}this is +# CHECK: 8:{{.*}}a test diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index a82ed09..735025b 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -1268,7 +1268,7 @@ static void disassembleObject(const Target *TheTarget, const ObjectFile *Obj, // Indent the space for less than 8 bytes data. // 2 spaces for byte and one for space between bytes IndentOffset = 3 * (8 - NumBytes); - for (int Excess = 8 - NumBytes; Excess < 8; Excess++) + for (int Excess = NumBytes; Excess < 8; Excess++) AsciiData[Excess] = '\0'; NumBytes = 8; } -- 2.7.4