[LLVMdev] llvm-objdump
    Steve King 
    steve at metrokings.com
       
    Tue Aug 26 12:43:25 PDT 2014
    
    
  
Hi Kev,
I'm glad to hear llvm-objdump is getting attention.  I'm unclear on
how much output specialization one could (or should) do for ELF vs.
Mach-O.  If you're game, let's compare an example:
$ cat labeltest.s
.text
foo:
    nop
bar:
bum:
    nop
    jmp   bar
    jmp   bum
    jmp   baz
    nop
baz:
    nop
Assembling for x86 and llvm-objdump'ing, i get
$ llvm-mc -arch=x86 -filetype=obj labeltest.s -o x86_labeltest.o
$ llvm-objdump -d  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
baz:
       9: 90                                           nop
I get the dump above with or without -symbolize.
My personal golden reference, GNU objdump, does this:
$ 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 <baz>
   8: 90                   nop
00000009 <baz>:
   9: 90                   nop
What does otool produce?
On Tue, Aug 26, 2014 at 11:16 AM, Kevin Enderby <enderby at apple.com> wrote:
> For branch targets my preference is to print the target’s address (not the displacement of the branch), and preferably in hex.
I like this too.
> I don’t think having multiple addresses for a target is a real problem with the exception of the address 0 (which is often an unrelocated no addend value).  So the trick is to not print the symbol name in the object with the address of zero in those cases
Right, relocations are a special case.
    
    
More information about the llvm-dev
mailing list