Skip to content

Purge FL_NO_UNWIND macro family + FASTLED_FORCE_*_UNWIND_TABLES — pragma form is a no-op on GCC 14.2.0 #2474

Closed

Description

@zackees

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:

  1. They don't work. src/fl/stl/compiler_control.h:330 emits _Pragma("GCC optimize(\"no-unwind-tables\")"), which only toggles -funwind-tables. The actual .eh_frame emitter 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 with FL_NO_UNWIND_BEGIN — still ships 3,007 FDE entries and 34,960 B of .eh_frame out of GCC. Wrapped vs unwrapped sibling TUs show identical byte counts.

  2. 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-tables is a codegen flag and its propagation through optimize is undefined. The robust fix is cc1 command-line flags, which is a build-system concern.

  3. 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 unless CONFIG_ESP_SYSTEM_USE_EH_FRAME=y). Centralized in the build system, covers libstdc++.a and 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-tables to your platformio.ini build_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-tables on 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=1

After (actually strips .eh_frame):

build_flags =
    -fno-asynchronous-unwind-tables
    -fno-unwind-tables

Same fix, applied to the right level (compile command line vs no-op pragma). User binary actually gets smaller.

Acceptance criteria

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

Activity

  1. added a commit that references this issue on May 13, 2026
    36abcfb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions