Delete the prior ELF so PIO's link step actually runs. PIO's build cache returns cached .o files on consecutive runs with overlapping object hashes — that's the right speed/correctness trade-off. But the link step decides whether to relink based on object-file timestamps, NOT on pla
()
| 326 | |
| 327 | |
| 328 | def _force_relink() -> None: |
| 329 | """Delete the prior ELF so PIO's link step actually runs. |
| 330 | |
| 331 | PIO's build cache returns cached .o files on consecutive runs with |
| 332 | overlapping object hashes — that's the right speed/correctness |
| 333 | trade-off. But the link step decides whether to relink based on |
| 334 | object-file timestamps, NOT on platformio.ini / sdkconfig changes. |
| 335 | Switching configs that affect only sdkconfig (e.g. stage3 ↔ |
| 336 | baseline) can therefore leave the previous config's ELF on disk |
| 337 | even after `bash compile` returns successfully — and the downstream |
| 338 | `bash bloat` step measures that stale ELF. |
| 339 | |
| 340 | Deleting the ELF before each compile forces the link to run; the |
| 341 | cached objects make the rebuild fast anyway. See #2940. |
| 342 | """ |
| 343 | if _ELF_PATH.is_file(): |
| 344 | _ELF_PATH.unlink() |
| 345 | |
| 346 | |
| 347 | def measure_one(cfg: OptInConfig, example: str) -> int | None: |