libretiny: derive nm from CC path when $NM is unset

This commit is contained in:
J. Nick Koston
2026-04-15 16:08:58 -10:00
parent 1cc0ae5443
commit 384f8f6870
@@ -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