Reading through the assembly GCC generates for C files in my project, I notice functions are not outputted in assembly in the same order they appear in the source file. What is
The later parts of the inter-procedural optimisation phase use a bottom-up traversal of the call graph; that's the ordering that you see. There's a paper about the original design of this part of GCC here (from a while ago; this stuff first appeared in GCC 3.4).
You can prevent the reordering using -fno-toplevel-reorder
(or -fno-unit-at-a-time
for less recent versions of GCC), but that disables some of the related optimisations.