Commit 58b4bd18 authored by Nathan Chancellor's avatar Nathan Chancellor Committed by Marc Zyngier
Browse files

tracing: Adjust cmd_check_undefined to show unexpected undefined symbols



When the check_undefined command in kernel/trace/Makefile fails, there
is no output, making it hard to understand why the build failed. Capture
the output of the $(NM) + grep command and print it when failing to make
it clearer what the problem is.

Fixes: a717943d ("tracing: Check for undefined symbols in simple_ring_buffer")
Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
Reviewed-by: default avatarVincent Donnefort <vdonnefort@google.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20260320-cmd_check_undefined-verbose-v1-1-54fc5b061f94@kernel.org


Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
parent d7729643
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -174,7 +174,13 @@ UNDEFINED_ALLOWLIST = __asan __gcov __kasan __kcsan __hwasan __sancov __sanitize
		      $(shell $(NM) -u $(obj)/undefsyms_base.o 2>/dev/null | awk '{print $$2}')

quiet_cmd_check_undefined = NM      $<
      cmd_check_undefined = test -z "`$(NM) -u $< | grep -v $(addprefix -e , $(UNDEFINED_ALLOWLIST))`"
      cmd_check_undefined = \
          undefsyms=$$($(NM) -u $< | grep -v $(addprefix -e , $(UNDEFINED_ALLOWLIST)) || true); \
          if [ -n "$$undefsyms" ]; then \
              echo "Unexpected symbols in $<:" >&2; \
              echo "$$undefsyms" >&2; \
              false; \
          fi

$(obj)/%.o.checked: $(obj)/%.o $(obj)/undefsyms_base.o FORCE
	$(call if_changed,check_undefined)