/other/

AT&T syntax and Intel syntax

2017-09-03 14:16:31

#include 

<stdio.h>

int main() {

    int i;

    for(i=0; i &lt; 10; i++) {
        puts("Hello, world!\n");
    }

    return 0;
}

objdump -D firstprog | grep -A15 main.: > maindumpatt.txt

000000000040052d <main>:
  40052d:   55                      push   %rbp
  40052e:   48 89 e5                mov    %rsp,%rbp
  400531:   48 83 ec 10             sub    $0x10,%rsp
  400535:   c7 45 fc 00 00 00 00    movl   $0x0,-0x4(%rbp)
  40053c:   eb 0e                   jmp    40054c <main+0x1f>
  40053e:   bf e4 05 40 00          mov    $0x4005e4,%edi
  400543:   e8 c8 fe ff ff          callq  400410 <puts@plt>
  400548:   83 45 fc 01             addl   $0x1,-0x4(%rbp)
  40054c:   83 7d fc 09             cmpl   $0x9,-0x4(%rbp)
  400550:   7e ec                   jle    40053e <main+0x11>
  400552:   b8 00 00 00 00          mov    $0x0,%eax
  400557:   c9                      leaveq 
  400558:   c3                      retq   
  400559:   0f 1f 80 00 00 00 00    nopl   0x0(%rax)

objdump -M intel -D firstprog | grep -A15 main.: > maindumpintel.txt

000000000040052d <main>:
  40052d:   55                      push   rbp
  40052e:   48 89 e5                mov    rbp,rsp
  400531:   48 83 ec 10             sub    rsp,0x10
  400535:   c7 45 fc 00 00 00 00    mov    DWORD PTR [rbp-0x4],0x0
  40053c:   eb 0e                   jmp    40054c <main+0x1f>
  40053e:   bf e4 05 40 00          mov    edi,0x4005e4
  400543:   e8 c8 fe ff ff          call   400410 <puts@plt>
  400548:   83 45 fc 01             add    DWORD PTR [rbp-0x4],0x1
  40054c:   83 7d fc 09             cmp    DWORD PTR [rbp-0x4],0x9
  400550:   7e ec                   jle    40053e <main+0x11>
  400552:   b8 00 00 00 00          mov    eax,0x0
  400557:   c9                      leave  
  400558:   c3                      ret    
  400559:   0f 1f 80 00 00 00 00    nop    DWORD PTR [rax+0x0]