LOGBOOK

HELP

Quiz Entry - updated: 2026.11.27

Why are caller and callee compiled from two separate .c files, and what do the flags in xtensa-esp32-elf-gcc -O3 -S -o callee.s callee.c do?

In separate files the compiler can't see callee's body while compiling caller, so it can't inline it and the call stays visible. -S stops after producing assembly, -O3 optimises hard, and -o names the output file.

At -O3 GCC aggressively inlines small functions: it pastes the body of callee into caller instead of calling it. With both in one file, caller would compile to a multiply and an add, with no call8, no entry in between and nothing left to show about calling conventions. Putting callee in its own file hides its body: when GCC compiles caller.c it sees only the declaration int callee(int u, int v);, so it must emit a real call.

The flags:

  • -S stops after compilation and writes human-readable assembly (.s) instead of an object file. Without it, GCC would go on to assemble and link.
  • -O3 is the highest standard optimisation level. That is why the code is so short: values stay in registers, with no stack traffic.
  • -o callee.s names the output file.

The same separation trick, or the attribute __attribute__((noinline)), is how you keep a function call intact when you want to study it.

Go deeper:

From Quiz: SIOT / Xtensa LX6 Registers, Calls and Branches in Assembly | Updated: Nov 27, 2026