Why does GCC pad functions with NOPs?
First of all, gcc doesn’t always do this. The padding is controlled by -falign-functions, which is automatically turned on by -O2 and -O3: -falign-functions -falign-functions=n Align the start of functions to the next power-of-two greater than n, skipping up to n bytes. For instance, -falign-functions=32 aligns functions to the next 32-byte boundary, but -falign-functions=24 would … Read more