Regression
A Teensy 4.1 Blink sketch that only includes FastLED still has framework Audio, SD, SdFat, and SerialFlash selected by fbuild lib-select, even after FastLED removes its Audio.h LDF hint and all source includes of Audio.h / SD.h.
fbuild lib-select .build/pio/teensy41 -e teensy41 --explain reports:
Audio triggered by the framework's own libraries/Audio/AudioControl.h
SD triggered by the framework's own libraries/SD/src/SD.cpp
SdFat triggered by the framework's own libraries/SdFat/src/DigitalIO/DigitalPin.h
SerialFlash selected transitively
This is a self-discovery cycle: once the resolver reaches library sources/headers, headers in that same library appear to be treated as new roots. The result is all of the library sources being compiled. SD.cpp contains the global SDClass SD, which survives LTO and contributes 1,236 B .bss to Blink.
Reproduction
- Check out FastLED branch implementing #3696 (no
<Audio.h> in src/platforms/arm/teensy/ldf_headers.h).
bash compile teensy41 --examples Blink
fbuild lib-select .build/pio/teensy41 -e teensy41 --explain
fbuild symbols .build/pio/teensy41/.fbuild/build/release/firmware.elf --top 100 --no-graph
Expected: only libraries reachable from the sketch/FastLED roots are selected; no Audio/SD/SdFat/SerialFlash for Blink.
Actual: the resolver selects 11 libraries including Audio (91 sources), SD, SdFat (46 sources), and SerialFlash. The linked ELF retains SD (1,236 B) and DMAChannel::begin despite the sketch not using any of them.
Acceptance
- Do not use a library's own transitive headers/sources as a root that selects that same library.
- A fresh resolver run for FastLED Blink on teensy41 does not select Audio, SD, SdFat, or SerialFlash.
- The resulting Blink ELF contains none of their symbols/global state.
- Preserve selection when the sketch or FastLED actually includes a feature-specific header.
Related: FastLED/FastLED#3696; historical fbuild #204 and #1088.
Regression
A Teensy 4.1 Blink sketch that only includes FastLED still has framework Audio, SD, SdFat, and SerialFlash selected by
fbuild lib-select, even after FastLED removes itsAudio.hLDF hint and all source includes ofAudio.h/SD.h.fbuild lib-select .build/pio/teensy41 -e teensy41 --explainreports:Audiotriggered by the framework's ownlibraries/Audio/AudioControl.hSDtriggered by the framework's ownlibraries/SD/src/SD.cppSdFattriggered by the framework's ownlibraries/SdFat/src/DigitalIO/DigitalPin.hSerialFlashselected transitivelyThis is a self-discovery cycle: once the resolver reaches library sources/headers, headers in that same library appear to be treated as new roots. The result is all of the library sources being compiled.
SD.cppcontains the globalSDClass SD, which survives LTO and contributes 1,236 B.bssto Blink.Reproduction
<Audio.h>insrc/platforms/arm/teensy/ldf_headers.h).bash compile teensy41 --examples Blinkfbuild lib-select .build/pio/teensy41 -e teensy41 --explainfbuild symbols .build/pio/teensy41/.fbuild/build/release/firmware.elf --top 100 --no-graphExpected: only libraries reachable from the sketch/FastLED roots are selected; no Audio/SD/SdFat/SerialFlash for Blink.
Actual: the resolver selects 11 libraries including Audio (91 sources), SD, SdFat (46 sources), and SerialFlash. The linked ELF retains
SD(1,236 B) andDMAChannel::begindespite the sketch not using any of them.Acceptance
Related: FastLED/FastLED#3696; historical fbuild #204 and #1088.