From 8dba87014a3ea91981950b1d8bf41299077686ed Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 15 Apr 2026 14:07:31 -1000 Subject: [PATCH] libretiny: use strong linker assignments for SRAM text markers PROVIDE symbols without references get garbage-collected by the linker, so the post-link summary was falling back to the symbol-scrape path on every family. Use direct assignment so the markers always land in the ELF symbol table, giving an exact byte count for the ESPHome IRAM_ATTR contribution. --- esphome/components/libretiny/patch_linker.py.script | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/esphome/components/libretiny/patch_linker.py.script b/esphome/components/libretiny/patch_linker.py.script index 728a22b823..60b64a7316 100644 --- a/esphome/components/libretiny/patch_linker.py.script +++ b/esphome/components/libretiny/patch_linker.py.script @@ -20,10 +20,12 @@ import re _MARKER = "/* esphome .sram.text */" +# Strong assignments (not PROVIDE) so the symbols are always emitted in the +# ELF; PROVIDE symbols with no references can be garbage-collected. _KEEP_LINE = ( - " PROVIDE(__esphome_sram_text_start = .); " + " __esphome_sram_text_start = .; " "KEEP(*(.sram.text*)) " - "PROVIDE(__esphome_sram_text_end = .); " + "__esphome_sram_text_end = .; " + _MARKER + "\n" ) _BK_DATA = re.compile(r"(\.data\s*:\s*\{\s*\n)")