How can I make objdump display the size of the operand the assembly instruction is acting upon?

41 Views Asked by At

I have this little C program in the file test.c :

int main(){

    int a = 10;
    a++;

}

I've compiled this program on both macOS ( x86_64 ) and Ubuntu. On macOS I've used "clang test.c -o test" and on Ubuntu I've used "gcc test.c -o test".

When I inspect the file in macOS with "otool -tV test" I get :

(__TEXT,__text) section
_main:
0000000100003fa0        pushq   %rbp
0000000100003fa1        movq    %rsp, %rbp
0000000100003fa4        movl    $0xa, -0x4(%rbp)
0000000100003fab        movl    -0x4(%rbp), %eax
0000000100003fae        addl    $0x1, %eax
0000000100003fb1        movl    %eax, -0x4(%rbp)
0000000100003fb4        xorl    %eax, %eax
0000000100003fb6        popq    %rbp
0000000100003fb7        retq

When I inspect the executable in Ubuntu with "objdump -dw test" I get :

0000000000001129 <main>:
    1129:   f3 0f 1e fa             endbr64 
    112d:   55                      push   %rbp
    112e:   48 89 e5                mov    %rsp,%rbp
    1131:   c7 45 fc 0a 00 00 00    movl   $0xa,-0x4(%rbp)
    1138:   83 45 fc 01             addl   $0x1,-0x4(%rbp)
    113c:   b8 00 00 00 00          mov    $0x0,%eax
    1141:   5d                      pop    %rbp
    1142:   c3                      ret  

Now, If you take for example the first push assembly instruction in objdump it is indicated as "push" but with otool it is "pushq".

My question :

Is there an option for objdump to explicitly display these size operands as otool does ?

0

There are 0 best solutions below