Simple functions like this will be inlined and removed.
For gcc, with an input like
#include <stdio.h>
void no_op () {}
int main () {
no_op();
no_op();
no_op();
no_op();
no_op();
no_op();
no_op();
no_op();
no_op();
no_op();
no_op();
no_op();
return 0;
}
The result (with -O1) is
.section __TEXT,__text,regular
.section __TEXT,__textcoal_nt,coalesced
.section __TEXT,__const_coal,coalesced
.section __TEXT,__picsymbolstub4,symbol_stubs,none,16
.text
.align 2
.globl _no_op
_no_op:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
@ lr needed for prologue
bx lr
.align 2
.globl _main
_main:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
@ lr needed for prologue
mov r0, #0
bx lr
.subsections_via_symbols
Note that no call to no_op in main is generated.