Skip to content

feat(symbols): distinguish graph availability, linker roots and unexplained retention #1661

Closed

Description

@zackees

Context

Coordinated dashboard consumer: FastLED/dashboard#18

After explicit-tool reanalysis of all 96 dashboard profiles (fbuild 2.5.37; Blink, APA102 and Rainbow; Uno, ESP32-S3, ESP32 Dev and Teensy), every cross-disassembly pass succeeded. Nevertheless the audit finds 41,645 positive-size row occurrences with no called_by, no referenced_by, and no confirmed ELF-entry reason; 10,620 graph-name occurrences do not resolve to a row. Counts are across profiles, not unique symbols.

These are review candidates, not proof of dead code. Legitimate roots, vtables, linker-created labels, ROM targets, data-pointer references and anonymous map-derived fragments all need explicit accounting.

Examples from APA102/master:

  • Uno: 23 unexplained rows, 12 unresolved names, no map Cross Reference Table. __vectors appears in graph edges but not the sized-row index; entry is 0.
  • ESP32-S3: 724 unexplained rows, 274 unresolved names. strlen and other runtime/ROM names lack report rows.
  • ESP32 Dev: 607 unexplained rows, 205 unresolved names. One showPixels name identifies a 619-byte nm function, a 33,611-byte map-derived rodata pool, and a 40-byte literal fragment at different addresses. Names alone cannot identify graph nodes/fragment ownership reliably.
  • Teensy: 407 unexplained rows, including hab_csf (3,072 B .text.csf) and DMA buffers. No map Cross Reference Table. A name heuristic is not evidence of KEEP/vector/root retention.

Existing JSON stores empty arrays for both absent analysis and absent detected edges. called_by is obtained by reversing all recognized disassembly symbol annotations, rather than exporting typed call/data/address edge semantics.

Proposal

Expose a versioned graph-analysis contract with availability and diagnostics, stable node identities, edge kinds, known root/retention reasons (ELF entry, vector/initializer tables, linker KEEP/export rules where verifiable), explicit external/ROM/label targets and an unexplained-retention category. Model map-derived fragments and their owner relationship without treating name collisions as interchangeable symbol nodes. Keep unknown indirect references explicit.

Acceptance criteria

  • RED → GREEN fixtures distinguish an ordinary retained function missing a graph edge, a confirmed entry/KEEP/vector root, unavailable objdump/cref, an external target and a map-derived fragment sharing its owner's name.
  • Empty arrays never stand in for all those states without accompanying status/reason metadata.
  • Parser edges are typed sufficiently to avoid claiming every annotated target is a runtime function call.
  • Graph consumers resolve node identities without silently choosing the first same-name row.
  • Dashboard Outstanding work: ledger removal, send_op errors, async API, B5a hardening, espflash native, sector-selective flashing #18 adopts the transport through strict schemas and shows confirmed roots separately from unexplained candidates.
  • Reaudit the 96-profile matrix and explain remaining candidates; do not reduce counts by hiding unresolved rows or guessing roots from names.

Decisions

P2: ship the dashboard's honest provisional states now, then fix producer and consumer together. ELF entry can be confirmed immediately; other retention reasons require linker/ELF evidence. Complete runtime indirect-call reconstruction is not promised.

Related issues

#478 (incoming symbols) and #459 (TU-level linker cref) are foundations; this issue adds the missing completeness/retention contract around them.

Coordination

Dashboard consumer: FastLED/dashboard #18. Producer work is coordinated across #1659, #1660, and #1661; availability and typed-edge/root contracts must stay consistent.

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

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions