From 384f8f687002f9f02231e54befe9245f209818cb Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 15 Apr 2026 16:08:58 -1000 Subject: [PATCH] libretiny: derive nm from CC path when $NM is unset --- esphome/components/libretiny/patch_linker.py.script | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/esphome/components/libretiny/patch_linker.py.script b/esphome/components/libretiny/patch_linker.py.script index 0be4df0a33..183759559a 100644 --- a/esphome/components/libretiny/patch_linker.py.script +++ b/esphome/components/libretiny/patch_linker.py.script @@ -114,7 +114,11 @@ def _post_link(target, source, env): elf = env.subst("$BUILD_DIR/${PROGNAME}.elf") if not os.path.isfile(elf): return - nm = env.subst("$NM") or env.subst("${TOOLCHAIN_PREFIX}nm") + # $NM may be unset; derive from $CC (e.g. arm-none-eabi-gcc -> arm-none-eabi-nm). + nm = env.subst("$NM") + if not nm: + cc = env.subst("$CC") + nm = cc.replace("-gcc", "-nm") if cc.endswith("-gcc") else "nm" try: out = subprocess.check_output( [nm, "--defined-only", "--demangle", elf], text=True