Skip to content

bash bloat --build analyses a different ELF than it builds, and reports stale numbers silently #4384

Closed

Description

@zackees

bash bloat <board> --build compiles one ELF and then analyses a different one. When the second is stale, it reports old numbers with no indication anything is wrong.

What happens

--build is documented as "Run bash compile <board> --examples <example> --platformio first to produce a fresh ELF". It does, and the build log shows it linking:

53.00 Linking .pio/build/esp32s3/firmware.elf
57.86 ========================= [SUCCESS] Took 55.82 seconds =========================

Then the analysis step picks a different path:

ELF:     .build/pio/esp32s3/.fbuild/build/release/firmware.elf  (fbuild-native)
$ fbuild symbols .build/pio/esp32s3/.fbuild/build/release/firmware.elf ...

Both exist under the same board directory, and they are not the same artifact:

2026-09-11 19:19  .build/pio/esp32s3/.pio/build/esp32s3/firmware.elf     <- just built
2026-09-06 16:12  .build/pio/esp32s3/.fbuild/build/release/firmware.elf  <- analysed

Five days stale, from a different backend.

How it surfaced

Diagnosing a bloat-gate failure on #4368, I ran bash bloat esp32s3 --build --top 200 on master, then again on the feature branch, and diffed the two report.json files. The diff was empty — identical symbol sets, and identical total_flash (399,293 B) — across a change that CI measured at +940 B.

The reported total is also unrelated to the gate's: 399,293 B locally against 342,483 B in CI for the same board and example, because they are different binaries.

I nearly reported "the change costs nothing locally" from that. Running fbuild symbols directly on the freshly built ELF gave 297,597 B on master and 298,561 B on the branch — +964 B, which matches CI's +940 B and immediately localised 750 B of it to six duplicated vtable thunks.

Why it matters

agents/docs/binary-size-analysis.md points agents and humans at this command, and the gate's own failure message does too:

to compare against another build, run bash bloat esp32s3 --top 25 locally and diff with .claude/symbolaudit/diff.py

Anyone following that advice after a --build gets a silently stale answer. The failure mode is the worst kind: plausible output, no error, and a conclusion ("my change is free") that is the opposite of the truth.

Suggested fix

Analyse the ELF the build just produced. Failing that, at minimum refuse to analyse an ELF older than the build step that preceded it, or print its mtime and provenance next to the ELF: line so a stale artifact is visible rather than silent.

Worth checking whether the .fbuild path is simply preferred unconditionally while --build uses the --platformio backend, in which case the two halves of the command disagree about which backend they are exercising.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions