SoC common : Build : Adjust the nm toolchain search rules. [1/1]
PD#SWPL-183669
Problem:
The existing search rules do not accommodate all architectures.
Solution:
fixed
Verify:
local
Change-Id: Ic5ca8f3a4e670e9573074c1ca91a32cc99fe14c7
Signed-off-by: shijie.xiong <shijie.xiong@amlogic.com>
diff --git a/symtable.mk b/symtable.mk
index 662e955..863a69c 100644
--- a/symtable.mk
+++ b/symtable.mk
@@ -1,10 +1,15 @@
-NM:=$(TOOLCHAIN_KEYWORD)-nm
-PATH:=$(TOOLCHAIN_PATH)/bin:$(PATH)
+# Copyright (c) 2021-2022 Amlogic, Inc. All rights reserved.
-quiet=silent_
+# SPDX-License-Identifier: MIT
+
+CAMKE_CACHE_FILE = $(kernel_BUILD_DIR)/CMakeCache.txt
+PATH_NM = $(shell awk -F':FILEPATH=' '/CMAKE_NM_COMPILER/ {print $$2}' $(1))
+
+quiet = silent_
+nm := $(call PATH_NM,$(CAMKE_CACHE_FILE))
cmd = $(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
-SYSTEM_MAP = $(NM) $(1) | \
+SYSTEM_MAP = $(nm) $(1) | \
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
LC_ALL=C sort | sed 's/0000000000//'
@@ -20,6 +25,7 @@
.PHONY: backtrace
backtrace:
+ @echo "Extracted backtrace toolchain: $(nm)"
@$(call cmd,smap)
.PHONY: clean