Skip to content

perf(elf): investigate larger FastLED native-ELF outputs than Wild 0.10.0 #205

Open

Description

@zackees

Context

While comparing linkers for FastLED's Linux debug-thin CI build, reld v0.2.0's native ELF engine produced a larger shared object for every output than upstream Wild v0.10.0. This is a size investigation, not yet proof of a reld defect: the two linkers may differ intentionally in section retention, unwind tables, symbol emission, or layout, and reld's ELF engine is based on an older Wild revision (related: #203).

Controlled replay from the same frozen object files at FastLED commit 5cce0fb6f9dd899643decaccae60325160a343f1, Clang 21.1.5, Linux x86-64. For each target, the same captured Ninja link command was run with only -fuse-ld=<absolute linker path> and -o <scratch output> changed; the leading zccache wrapper was bypassed. Three interleaved repetitions covered the core DSO, 311 unit-test DSOs, and 95 example DSOs (407 targets). RELD_LOG_ENGINE=1 reported reld: engine=reld (native, reason=default) on all 1,221 reld invocations; this is not the LLD bridge.

Output set Wild 0.10.0 reld 0.2.0 Difference
fastled.so 30,199,462 B 31,483,768 B +1,284,306 B (+4.3%)
311 unit-test DSOs, sum 68,886,416 B 79,123,342 B +10,236,926 B (+14.9%)
95 example DSOs, sum 14,189,655 B 16,837,076 B +2,647,421 B (+18.7%)
All 407 outputs, sum 113,275,533 B 127,444,186 B +14,168,653 B (+12.5%)

All 407 individual outputs were larger with reld; the smallest per-output increase was 26,778 B. A representative tests/cled_controller.so was 123,727 B with Wild versus 155,953 B with reld (+32,226 B). readelf -W -S -l shows the same 36 section headers, nine program headers, and 0x1000 LOAD alignment on both outputs, so the example difference is not explained simply by extra sections or a larger page alignment. Some differing section sizes are .text (Wild 0x5630, reld 0x7600), .eh_frame (0x1d24 vs 0x2ef4), .symtab (0x1b30 vs 0x3bd0), and .strtab (0x3f87 vs 0x6159). .debug_info and .debug_line have the same sizes in this example. These observations do not establish why the sections differ.

For context, median time to replay all 407 links was 12.94 s for Wild and 12.99 s for reld across the three corrected runs. That near-tie is not a meaningful performance distinction here; the size difference is deterministic. The comparator executables had SHA-256 5b2baebf62de0f8c185711b808c3f553da3b7166b1c289420df5276b027f5597 (Wild) and da80077093d11fb21f24d6521d8cf9ce2858bbcf8256be001c9ec1c557ebe846 (reld).

Reproduction

  1. At the FastLED commit above, build the Linux debug-thin native test graph (bash test --cpp --build-mode debug-thin).
  2. Get a representative link command, e.g. ninja -C .build/meson-debug-thin -t commands tests/cled_controller.so. Reuse its already-built object inputs. Omit any leading zccache wrapper, then run that command twice, changing only -fuse-ld=<absolute path to Wild 0.10.0 or reld 0.2.0> and -o <unique scratch output>.
  3. Set RELD_LOG_ENGINE=1 for the reld invocation. Compare stat -c%s and readelf -W -S -l on the two DSOs; inspect symbol/relocation counts and retained input sections to attribute the difference. Repeat on ci/meson/native/fastled.so and other test/example DSOs to check whether the same cause applies.

Proposal

Identify whether the extra output is intentional or a missed size optimization in reld's native ELF path. In particular, compare retained .text/unwind/symbol contents and relevant linker flags before attributing this to the Wild-version divergence in #203. If it is avoidable, reduce the output without changing loader behavior or breaking FastLED's sanitizer-enabled tests; if intentional, document the reason and trade-off.

Acceptance criteria

  • A focused RED reproduction records the same-input, native-engine size gap for at least the representative test DSO and core DSO, with section-level evidence.
  • The cause is identified and verified. If it is a reld regression or missed optimization, a GREEN change narrows the gap and passes relevant runtime/sanitizer tests; if intentional, document why the larger output is required.
  • Confirm whether the finding generalizes beyond FastLED's shared-object workload, without conflating output size with release-bundle/download size.

Decisions

  • Scope is Linux native ELF output; Windows/macOS LLD-bridge behavior and release archive size are separate topics.
  • Compare against the published upstream Wild 0.10.0 release, not the unreleased zackees/wild fork. Treat Move the wild engine into a zackees/wild fork and consume it as a git submodule #203 as related version-drift context, not a duplicate or a proven root cause.
  • Do not enforce an unconditional reld <= Wild threshold until the semantic differences are understood.

Open questions

Activity

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