On OSX 64bit, compiling a dummy C program like that:
#include <stdio.h>
void foo1() {
}
void foo2() {
}
int main() {
        printf("Helloooo!\n");
        foo1();
        foo2();
        return 0;
}
Produces the following ASM code (obtained disassembling the binary with otool):
(__TEXT,__text) section
_foo1:
0000000100000f10    55                  pushq   %rbp
0000000100000f11    4889e5              movq    %rsp, %rbp
0000000100000f14    897dfc              movl    %edi, -0x4(%rbp)
0000000100000f17    5d                  popq    %rbp
0000000100000f18    c3                  retq
0000000100000f19    0f1f8000000000      nopl    (%rax)
_foo2:
0000000100000f20    55                  pushq   %rbp
0000000100000f21    4889e5              movq    %rsp, %rbp
0000000100000f24    5d                  popq    %rbp
0000000100000f25    c3                  retq
0000000100000f26    662e0f1f840000000000    nopw    %cs:(%rax,%rax)
_main:
0000000100000f30    55                  pushq   %rbp
0000000100000f31    4889e5              movq    %rsp, %rbp
0000000100000f34    4883ec10            subq    $0x10, %rsp
0000000100000f38    488d3d4b000000      leaq    0x4b(%rip), %rdi        ## literal pool for: "Helloooo!\n"
0000000100000f3f    c745fc00000000      movl    $0x0, -0x4(%rbp)
0000000100000f46    b000                movb    $0x0, %al
0000000100000f48    e81b000000          callq   0x100000f68             ## symbol stub for: _printf
0000000100000f4d    bf06000000          movl    $0x6, %edi
0000000100000f52    8945f8              movl    %eax, -0x8(%rbp)
0000000100000f55    e8b6ffffff          callq   _foo1
0000000100000f5a    e8c1ffffff          callq   _foo2
0000000100000f5f    31c0                xorl    %eax, %eax
0000000100000f61    4883c410            addq    $0x10, %rsp
0000000100000f65    5d                  popq    %rbp
0000000100000f66    c3                  retq
What are the "nop" instructions found right after the "ret" on functions foo1() and foo2()? They are, of course, never executed since the "ret" instructions return from the function call. Is that any kind of padding or it has a different meaning?
 
     
     
     
    