From 6dd7f45cc99f20efadf28cc829bb9b27e7d25bc2 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 8 Feb 2026 14:12:35 -0600 Subject: [PATCH] tweak --- esphome/analyze_memory/__init__.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/esphome/analyze_memory/__init__.py b/esphome/analyze_memory/__init__.py index 8de094ed37..62aa59e22c 100644 --- a/esphome/analyze_memory/__init__.py +++ b/esphome/analyze_memory/__init__.py @@ -57,9 +57,10 @@ SymbolInfoType = tuple[str, int, str] # RAM sections - symbols in these sections consume RAM RAM_SECTIONS = frozenset([".data", ".bss"]) -# nm symbol types for defined symbols (used for library symbol mapping) -# Uppercase = global, lowercase = local/static, W/V = weak -_NM_DEFINED_SYMBOL_TYPES = frozenset({"T", "t", "D", "d", "B", "b", "R", "r", "W", "V"}) +# nm symbol types for global/weak defined symbols (used for library symbol mapping) +# Only global (uppercase) and weak symbols are safe to use - local symbols (lowercase) +# can have name collisions across compilation units +_NM_DEFINED_GLOBAL_TYPES = frozenset({"T", "D", "B", "R", "W", "V"}) @dataclass @@ -526,8 +527,8 @@ class MemoryAnalyzer: sym_type = parts[-2] sym_name = parts[-1] - # Include all defined symbols (global, local, and weak) - if sym_type in _NM_DEFINED_SYMBOL_TYPES: + # Include global defined symbols (uppercase) and weak symbols (W/V) + if sym_type in _NM_DEFINED_GLOBAL_TYPES: symbol_map[sym_name] = lib_name return symbol_map