[LLVMdev] llvm-objdump

Steve King steve at metrokings.com
Tue Aug 26 14:46:36 PDT 2014


On Tue, Aug 26, 2014 at 1:17 PM, Kevin Enderby <enderby at apple.com> wrote:
> For me, operands of -3, -5 and 1 are of little use.

Agreed.
​This annoyance started me down this whole path.


>
> Also if I’m printing symbolic operands like “bar” I don’t want to see the
> address of bar or the displacement in that case.  Basically I want to see
as
> close to real assembly code as possible.


​Sounds right to me.  In '-bare' you get the address, otherwise you get the
symbol.



​> ​
We use things
> like 1f, 2b or L21 because we break sections into “atoms” at the symbol


Adding 'f' and 'b' style branches to the test case
​, but GNU objdump shows these as an address plus nearest label + offset
​.

$ cat labeltest.s
.text
foo:
   nop
bar:
bum:
   nop
   jmp   bar
   jmp   bum
   jmp   1f
   nop
1:
   nop
   jmp   1b

$llvm-objdump -d -symbolize  x86_labeltest.o

x86_labeltest.o: file format ELF32-i386

Disassembly of section .text:
foo:
       0: 90                                           nop

bum:
       1: 90                                           nop
       2: eb fd                                         jmp -3
       4: eb fb                                         jmp -5
       6: eb 01                                         jmp 1
       8: 90                                           nop
       9: 90                                           nop
       a: eb fd                                         jmp -3

$ objdump -dw x86_labeltest.o

x86_labeltest.o:     file format elf32-i386


Disassembly of section .text:

00000000 <foo>:
   0: 90                   nop

00000001 <bar>:
   1: 90                   nop
   2: eb fd                 jmp    1 <bar>
   4: eb fb                 jmp    1 <bar>
   6: eb 01                 jmp    9 <bar+0x8>
   8: 90                   nop
   9: 90                   nop
   a: eb fd                 jmp    9 <bar+0x8>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140826/4efeaec7/attachment.html>


More information about the llvm-dev mailing list