Repository navigation
fix(symbols): flash-mapped output sections are not RAM (#1832) - #1838
Merged
Merged
Conversation
…1832) `fbuild symbols` reported 293 symbols of one ESP32 Arduino Blink ELF as `region: "ram"` although the linker had placed every one of them in `.flash.rodata`: `total_ram` read 25,565 B instead of 13,803 B. Two sites trusted something weaker than the actual placement: - `build_fine_grained_map` consulted the output section only for weak objects (`V`/`v`); everything else used the nm letter, so ESP-IDF `__func__`/`__FUNCTION__` string literals (`d`, folded into `.flash.rodata`) were counted as DRAM. - the debug-info pass for `V`/`v` re-derived the region from the *input* section flags; `.data.rel.ro` vtables are `SHF_WRITE` before relocation even though the linker lands them in flash-mapped `.flash.rodata`. Both now ask one shared rule, `is_flash_mapped_output_section`: bytes in a `.flash*` output section are part of the image, so the region is `flash` whatever the type letter or pre-relocation flags say. Everything else is unchanged — `.iram0.data` storage stays RAM, because it occupies real DRAM even though the image loads it.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
symbols: a flash-mapped output section beats nm's type letter (#1832)
fbuild symbolscounted 293 symbols of one ESP32-S3 Arduino Blink ELF asregion: "ram"although the linker had placed them in.flash.rodata:total_ramread 25,565 B instead of 13,803 B (+85% inflated), and 8 more(
vtable for …,typeinfo …) were still wrong after the first fix.Two independent sites derived the region from something weaker than the
actual placement:
fbuild-core/src/symbol_analysis/mod.rs—build_fine_grained_maponlyconsulted the output section for weak objects (
V/v). Everything elseused the nm letter, so ESP-IDF
__func__/__FUNCTION__string literals(
d, folded by the linker into.flash.rodata) were counted as DRAM.fbuild-build-engine/src/symbol_analyzer/reference_analysis.rs— thedebug-info pass for
V/vre-derived the region from the inputsection flags;
.data.rel.rovtables areSHF_WRITEbefore relocationeven though the linker lands them in flash-mapped
.flash.rodata.Both now ask one shared rule,
is_flash_mapped_output_section(name)(
.flash*output sections): those bytes are part of the image, so theregion is
flashwhatever the type letter or pre-relocation flags say.Everything else keeps its previous behaviour — in particular
.iram0.datastorage is still counted as RAM, because it occupies real DRAM even though
it is loaded from the image.
Verification
Unit (new,
build_fine_grained_map_flash_rodata_beats_nm_type_letter):a
din.flash.rodata-> flash, aVthere -> flash, adin.dram0.data-> ram, adin.iram0.data-> ram (the last one pins theno-regression case).
End to end on the real
bench/blinkESP32-S3 ELF (firmware.elf+firmware.map,xtensa-esp32s3-elf-nm), same inputs, CLI before/after:region=ramin.flash*total_ram.flash.rodataflash / ram splitThe 293 flips are
ram -> flashonly; no symbol moved in the otherdirection.
.dram0.data(209) and.dram0.bss(167) are unchanged.Gates run on this branch:
bash test4128 passed / 0 failed (47 suites,rc 0,
TMPDIR=/home/niteris/t),cargo clippy --workspace --all-targets -- -D warningsrc 0,cargo fmtclean, platform boundaryrows=44; dylint_rows=43rc 0,ci/check_test_layout.pyok. No new file exceeds the1000-LOC cap (
mod.rs943 -> 961,tests.rs920 -> 997).Closes #1832. Relates to FastLED/FastLED#4982 (budget guard that fired on
the inflated
total_ram).