Repository navigation
Description
Summary
Remove the FL_NO_UNWIND / FL_NO_UNWIND_BEGIN / FL_NO_UNWIND_END / FL_NO_UNWIND_ACTIVE macro family and the two user-facing override macros (FASTLED_FORCE_NO_UNWIND_TABLES, FASTLED_FORCE_UNWIND_TABLES). The pragma-based mechanism (#2423) was empirically proven to be a no-op on GCC 14.2.0 / xtensa-esp-elf — see #2473 for the byte-level evidence — and the right place to handle eh_frame stripping is the build system (tracked in FastLED/fbuild#243), not the FastLED headers. Keeping dead-looking macros in the public surface invites future users to "fix" eh_frame by reaching for them.
Why purge now
Three reasons:
-
They don't work.
src/fl/stl/compiler_control.h:330emits_Pragma("GCC optimize(\"no-unwind-tables\")"), which only toggles-funwind-tables. The actual.eh_frameemitter on ESP32 is-fasynchronous-unwind-tables(default ON). Direct evidence from ESP32-S3 binary size: 657 KB on master vs 344 KB on 3.10.3 — remaining +313 KB delta breakdown #2473:platforms+.cpp.o— the one TU that IS wrapped withFL_NO_UNWIND_BEGIN— still ships 3,007 FDE entries and 34,960 B of.eh_frameout of GCC. Wrapped vs unwrapped sibling TUs show identical byte counts. -
Even fixing the pragma wouldn't make it reliable. Per GCC's official documentation,
__attribute__((optimize(...)))and the equivalent_Pragma("GCC optimize")are intended for-O*-style optimization levels, not arbitrary codegen flags.-fno-asynchronous-unwind-tablesis a codegen flag and its propagation throughoptimizeis undefined. The robust fix iscc1command-line flags, which is a build-system concern. -
The right fix is in fbuild. fastled/fbuild#243 tracks adding a per-architecture eh_frame policy (Xtensa: strip unconditionally when
-fno-exceptions; RISC-V: strip unlessCONFIG_ESP_SYSTEM_USE_EH_FRAME=y). Centralized in the build system, coverslibstdc++.aand user TUs (which FL_NO_UNWIND can't reach), and produces measurable bytes (~225 KB).
What gets removed
src/fl/stl/compiler_control.h:
- FL_NO_UNWIND family (lines ~226-353)
- FL_NO_UNWIND (per-function attribute)
- FL_NO_UNWIND_BEGIN/_END (TU/block-scoped pragmas)
- FL_NO_UNWIND_ACTIVE (query macro)
- User override macros:
- FASTLED_FORCE_NO_UNWIND_TABLES
- FASTLED_FORCE_UNWIND_TABLES
src/platforms/esp/32/_build.cpp.hpp:
- line 7: #include "fl/stl/compiler_control.h" (if no other use)
- line 8: FL_NO_UNWIND_BEGIN
- line 30: FL_NO_UNWIND_END
src/platforms/esp/32/drivers/_build.cpp.hpp:
- line 20: #include "fl/stl/compiler_control.h" (if no other use)
- line 21: FL_NO_UNWIND_BEGIN
- line 43: FL_NO_UNWIND_END
tests/fl/stl/compiler_control.cpp:
- "FL_NO_UNWIND family" test case (lines ~65-82, 815-830)
What to add to the docs
A short paragraph in src/fl/channels/README.md (already added under "Reducing Binary Size") points users to the right mechanism:
To strip
.eh_frame, add-fno-asynchronous-unwind-tables -fno-unwind-tablesto yourplatformio.inibuild_flags. The FL_NO_UNWIND macros that used to exist are gone — they were a pragma-based attempt that didn't actually suppress-fasynchronous-unwind-tableson GCC 14.2.0. fbuild#243 will eventually apply these flags automatically.
A CHANGELOG.md / release-notes entry for the next minor version, calling out the removal as a "user-facing API change" so anyone who had #define FASTLED_FORCE_NO_UNWIND_TABLES 1 in their platformio.ini knows to swap it for the build_flags form. (No source-level breakage since nothing inside FastLED depends on either macro doing anything.)
Migration for users who set the override macros
Before (didn't actually do anything, but no warning):
build_flags = -DFASTLED_FORCE_NO_UNWIND_TABLES=1After (actually strips .eh_frame):
build_flags =
-fno-asynchronous-unwind-tables
-fno-unwind-tablesSame fix, applied to the right level (compile command line vs no-op pragma). User binary actually gets smaller.
Acceptance criteria
-
src/fl/stl/compiler_control.h— FL_NO_UNWIND family + FASTLED_FORCE_*_UNWIND_TABLES macros removed -
src/platforms/esp/32/_build.cpp.hpp—FL_NO_UNWIND_BEGIN/_ENDwrappers removed;#include "fl/stl/compiler_control.h"removed if not otherwise needed -
src/platforms/esp/32/drivers/_build.cpp.hpp— same cleanup -
tests/fl/stl/compiler_control.cpp— "FL_NO_UNWIND family" test case removed (along with the helper functions at lines 65-82) - No new tests added (the absence test would be "this binary is the same size as before with neither the macros nor build flags" — which we already have via ESP32-S3 binary size: 657 KB on master vs 344 KB on 3.10.3 — remaining +313 KB delta breakdown #2473)
- Lint clean
- Release-notes entry for the migration above
- Cross-link this PR to [Tracking] ESP32-S3 timing regression + binary bloat from Channel API (from #2420) #2421 / feat(fl/stl): add FL_NO_UNWIND macros, apply to ESP32 unity headers #2423 / ESP32-S3 binary size: 657 KB on master vs 344 KB on 3.10.3 — remaining +313 KB delta breakdown #2473 / fbuild#243 in the PR description
Risk
Zero source-level risk to existing user code:
- The macros were no-ops, so removing them changes nothing at runtime.
- The override macros are user-defined
-D...flags; if a user had them set they still compile (just defined to nothing in user code), no error. - Worst case: a user who relied on the macro to do something it never actually did won't notice any change, because nothing was happening.
The only "loss" is the intent documentation embedded in the macro names. That's preserved by the README.md update which now explicitly tells users to use build_flags and links to fbuild#243.
Related
- [Tracking] ESP32-S3 timing regression + binary bloat from Channel API (from #2420) #2421 — original bloat investigation
- feat(fl/stl): add FL_NO_UNWIND macros, apply to ESP32 unity headers #2423 — the PR that added FL_NO_UNWIND (and that this issue partially reverts)
- ESP32-S3 binary size: 657 KB on master vs 344 KB on 3.10.3 — remaining +313 KB delta breakdown #2473 — full byte-level audit showing the pragma is a no-op
- ESP32: auto-strip .eh_frame when exception handling and panic backtrace are both off (~225 KB savings on FastLED Blink) fbuild#243 — the real fix, in the build system
Activity
refactor(stl): remove FL_NO_UNWIND macro family (closes FastLED#2474) (…