This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
How to make the output of objdump similar to otool (on Mac)?
- From: Peng Yu <pengyu dot ut at gmail dot com>
- To: binutils at sourceware dot org
- Date: Sun, 24 Feb 2019 11:03:24 -0600
- Subject: How to make the output of objdump similar to otool (on Mac)?
Hi,
otool on Mac prints this.
$ otool -tvj add.o
add.o:
(__TEXT,__text) section
_add4:
0000000000000000 55 pushq %rbp
0000000000000001 48 89 e5 movq %rsp, %rbp
0000000000000004 48 89 7d f8 movq %rdi, -0x8(%rbp)
0000000000000008 48 8b 7d f8 movq -0x8(%rbp), %rdi
000000000000000c 48 83 c7 04 addq $0x4, %rdi
0000000000000010 48 89 f8 movq %rdi, %rax
0000000000000013 5d popq %rbp
0000000000000014 c3 retq
0000000000000015 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:(%rax,%rax)
000000000000001f 90 nop
`objdump -d` on linux prints this. The function is shown as
`0000000000000000 <add4>:` Is there a way to show it as `add4:`
similar to otool, but show the full address for each instruction such
as `0000000000000000`? Thanks.
$ objdump -d add.o
add.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <add4>:
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: 48 89 7d f8 mov %rdi,-0x8(%rbp)
8: 48 8b 7d f8 mov -0x8(%rbp),%rdi
c: 48 83 c7 04 add $0x4,%rdi
10: 48 89 f8 mov %rdi,%rax
13: 5d pop %rbp
14: c3 retq
15: 66 66 2e 0f 1f 84 00 data16 nopw %cs:0x0(%rax,%rax,1)
1c: 00 00 00 00
--
Regards,
Peng