From 29b7c5a202813527a9ee1b07f806531f2a9d272c Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Thu, 3 Jun 2021 15:41:27 +0200 Subject: [PATCH] dde_linux/create_dummies: show symbol details When combining the 'show' command with a defined LINUX_KERNEL_DIR, each symbol gets annotated with the object file where it is defined. Issue #4188 --- tool/dde_linux/create_dummies | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tool/dde_linux/create_dummies b/tool/dde_linux/create_dummies index 30a1360410..98e69780f0 100755 --- a/tool/dde_linux/create_dummies +++ b/tool/dde_linux/create_dummies @@ -108,10 +108,15 @@ ifeq ($(DUMMY_FILE),) $(error You have to state a DUMMY_FILE, try help) endif +endif # COMMAND=generate + + # -# Prepare object database +# Prepare object database whenever LINUX_KERNEL_DIR is specified # +ifneq ($(realpath $(LINUX_KERNEL_DIR)),) + CROSS_DEV_PREFIX ?= /usr/local/genode/tool/current/bin/genode-$(TOOL_ARCH)- NM = $(CROSS_DEV_PREFIX)nm --print-file-name --defined-only C_FILE_DEF := $(shell $(NM) `find $(LINUX_KERNEL_DIR) -name "*.o" | grep -v vmlinux.o` | grep -i " t " | sed 's/o:[0-f]* [tT] /c:/') @@ -134,7 +139,8 @@ do_var_to_def = $(subst ];,] = {};,$(subst \/,/,$(subst extern ,,$(subst $$/ check_var_to_def = $(if $(2),$(call do_var_to_def,$(1),$(2)),) var_to_def = $(call check_var_to_def,$(1),$(call var_to_h_file,$(1))) -endif # COMMAND=generate +endif # LINUX_KERNEL_DIR specified + # # Collect undefined references for target @@ -193,9 +199,15 @@ check_fdef_only = $(if $(2),$(call print_func_only,$(2),$(DUMMY_FILE)),$(call ch check_fdef = $(if $(3),$(call print_func,$(2),$(3),$(DUMMY_FILE)),$(call check_not_func,$(1))) check_func = $(if $(2),$(call check_fdef,$(1),$(2),$(call func_to_def,$(1))),$(call check_fdef_only,$(1),$(call func_to_def,$(1)))) +ifeq ($(realpath $(LINUX_KERNEL_DIR)),) +show_symbol = "$1" +else +show_symbol = "$1 $(foreach F,$(call symbol_to_c_file,$1),(found at $(F:.c=.o)))" +endif + show: $(ECHO) "Missing symbols:" - @$(foreach sym,$(UNDEF_REFS),echo "$(sym)";) + @$(foreach sym,$(UNDEF_REFS),echo $(call show_symbol,$(sym));) $(ECHO) "Total sum of missing symbols is $(words $(UNDEF_REFS))" generate: