Skip to contentSkip to conversation

Perf tool build improvements

PATCH In review Ian Rogers 4 participants 34 messages Mar 11, 2023 – Mar 31, 2023 perf events

lore
Share & tools
lore

Ian Rogers

author reviewer
#0 lore raw

cover Perf tool build improvements

Make the default build options a more preferred set, such as making BPF skeletons default and failing the build if jevents or libtracevent dependencies fail. The binutil dependencies are opt-in given license restrictions. abi::__cxa_demangle demangling support is added so that libiberty, from binutils, isn't necessary for C++ demangling.

Some build/test dependencies are fixed and the code cleaned up.

Ian Rogers (13):
perf build: Support python/perf.so testing
perf build: Make BUILD_BPF_SKEL default, rename to NO_BPF_SKEL perf build: Remove unused HAVE_GLIBC_SUPPORT
perf build: Error if no libelf and NO_LIBELF isn't set perf util: Remove weak sched_getcpu
perf build: Error if jevents won't work and NO_JEVENTS=1 isn't set perf build: Make binutil libraries opt in
tools build: Add feature test for abi::__cxa_demangle perf symbol: Add abi::__cxa_demangle C++ demangling support perf build: Switch libpfm4 to opt-out rather than opt-in perf build: If libtraceevent isn't present error the build tools headers: Make the difference output easier to read perf build: Remove redundant NO_NEWT build option

 tools/build/Makefile.feature              |   1 +
 tools/build/feature/Makefile              |   4 +
 tools/build/feature/test-cxa-demangle.cpp |  17 ++
 tools/perf/Makefile.config                |  84 +++-----
 tools/perf/Makefile.perf                  |  21 +-
 tools/perf/builtin-lock.c                 |   2 +-
 tools/perf/builtin-record.c               |   2 +-
 tools/perf/builtin-version.c              |   2 +-
 tools/perf/check-headers.sh               | 229 ++++++++++++----------
 tools/perf/tests/make                     |  17 +-
 tools/perf/tests/shell/record_offcpu.sh   |   2 +-
 tools/perf/util/Build                     |   1 +
 tools/perf/util/cloexec.c                 |  13 --
 tools/perf/util/demangle-cxx.cpp          |  50 +++++
 tools/perf/util/demangle-cxx.h            |  16 ++
 tools/perf/util/symbol-elf.c              |  37 +---
 tools/perf/util/util.c                    |  16 ++
 17 files changed, 294 insertions(+), 220 deletions(-)
 create mode 100644 tools/build/feature/test-cxa-demangle.cpp
 create mode 100644 tools/perf/util/demangle-cxx.cpp
 create mode 100644 tools/perf/util/demangle-cxx.h
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
author reviewer
#1 lore raw

PATCH 1/13 perf build: Support python/perf.so testing

Add a build target to echo the python/perf.so's name from Makefile.perf. Use it in tests/make so the correct target is built and tested for.

Fixes caec54705adb ("perf build: Fix python/perf.so library's name")
---
 tools/perf/Makefile.perf | 7 +++++--
 tools/perf/tests/make    | 5 +++--
 2 files changed, 8 insertions(+), 4 deletions(-)
tools/perf/Makefile.perf +5 -2
index bac9272682b7..2fcee585b225 100644
@@ -647,13 +647,16 @@ all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS)
 # Create python binding output directory if not already present
 _dummy := $(shell [ -d '$(OUTPUT)python' ] || mkdir -p '$(OUTPUT)python')
 
-$(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBPERF)
+$(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBPERF) $(LIBSUBCMD)
 	$(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \
         CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' \
 	  $(PYTHON_WORD) util/setup.py \
 	  --quiet build_ext; \
 	cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/
 
+python_perf_target:
+	@echo "Target is: $(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX)"
+
 please_set_SHELL_PATH_to_a_more_modern_shell:
 	$(Q)$$(:)
 
@@ -1152,7 +1155,7 @@ FORCE:
 .PHONY: all install clean config-clean strip install-gtk
 .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
 .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope FORCE prepare
-.PHONY: archheaders
+.PHONY: archheaders python_perf_target
 
 endif # force_fixdep
 
tools/perf/tests/make +3 -2
index 009d6efb673c..deb37fb982e9 100644
@@ -62,10 +62,11 @@ lib = lib
 endif
 
 has = $(shell which $1 2>/dev/null)
+python_perf_so := $(shell $(MAKE) python_perf_target|grep "Target is:"|awk '{print $$3}')
 
 # standard single make variable specified
 make_clean_all      := clean all
-make_python_perf_so := python/perf.so
+make_python_perf_so := $(python_perf_so)
 make_debug          := DEBUG=1
 make_no_libperl     := NO_LIBPERL=1
 make_no_libpython   := NO_LIBPYTHON=1
@@ -204,7 +205,7 @@ test_make_doc    := $(test_ok)
 test_make_help_O := $(test_ok)
 test_make_doc_O  := $(test_ok)
 
-test_make_python_perf_so := test -f $(PERF_O)/python/perf.so
+test_make_python_perf_so := test -f $(PERF_O)/$(python_perf_so)
 
 test_make_perf_o           := test -f $(PERF_O)/perf.o
 test_make_util_map_o       := test -f $(PERF_O)/util/map.o
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
author reviewer
#2 lore raw

PATCH 2/13 perf build: Make BUILD_BPF_SKEL default, rename to NO_BPF_SKEL

In reply to Ian Rogers

BPF skeleton support is now key to a number of perf features. Rather than making it so that BPF support must be enabled for the build, make this the default and error if the build lacks a clang and libbpf that are sufficient. To avoid the error and build without BPF skeletons the NO_BPF_SKEL=1 flag can be used. Add a build-options flag to 'perf version' to enable detection of the BPF skeleton support and use this in the offcpu shell test.

---
 tools/perf/Makefile.config              | 19 ++++++++++++-------
 tools/perf/Makefile.perf                |  8 ++++----
 tools/perf/builtin-lock.c               |  2 +-
 tools/perf/builtin-record.c             |  2 +-
 tools/perf/builtin-version.c            |  1 +
 tools/perf/tests/shell/record_offcpu.sh |  2 +-
 6 files changed, 20 insertions(+), 14 deletions(-)
tools/perf/Makefile.config +12 -7
index 5f11834f189e..33d62d542fd5 100644
@@ -415,6 +415,7 @@ ifdef NO_LIBELF
   NO_LIBUNWIND := 1
   NO_LIBDW_DWARF_UNWIND := 1
   NO_LIBBPF := 1
+  NO_BPF_SKEL := 1
   NO_JVMTI := 1
 else
   ifeq ($(feature-libelf), 0)
@@ -662,18 +663,22 @@ ifndef NO_LIBBPF
     msg := $(warning BPF API too old. Please install recent kernel headers. BPF support in 'perf record' is disabled.)
     NO_LIBBPF := 1
   endif
+else
+  NO_BPF_SKEL := 1
 endif
 
-ifdef BUILD_BPF_SKEL
+ifndef NO_BPF_SKEL
   $(call feature_check,clang-bpf-co-re)
   ifeq ($(feature-clang-bpf-co-re), 0)
-    dummy := $(error Error: clang too old/not installed. Please install recent clang to build with BUILD_BPF_SKEL)
-  endif
-  ifeq ($(filter -DHAVE_LIBBPF_SUPPORT, $(CFLAGS)),)
-    dummy := $(error Error: BPF skeleton support requires libbpf)
+    dummy := $(error: ERROR: BPF skeletons unsupported. clang too old/not installed or build with NO_BPF_SKEL=1.)
+  else
+    ifeq ($(filter -DHAVE_LIBBPF_SUPPORT, $(CFLAGS)),)
+      dummy := $(error: ERROR: BPF skeletons unsupported. BPF skeleton support requires libbpf or build with NO_BPF_SKEL=1.)
+    else
+      $(call detected,CONFIG_PERF_BPF_SKEL)
+      CFLAGS += -DHAVE_BPF_SKEL
+    endif
   endif
-  $(call detected,CONFIG_PERF_BPF_SKEL)
-  CFLAGS += -DHAVE_BPF_SKEL
 endif
 
 dwarf-post-unwind := 1
tools/perf/Makefile.perf +4 -4
index 2fcee585b225..283ee4f56234 100644
@@ -126,7 +126,7 @@ include ../scripts/utilities.mak
 #
 # Define NO_LIBDEBUGINFOD if you do not want support debuginfod
 #
-# Define BUILD_BPF_SKEL to enable BPF skeletons
+# Define NO_BPF_SKEL to disable BPF skeletons
 #
 
 # As per kernel Makefile, avoid funny character set dependencies
@@ -1055,7 +1055,7 @@ SKELETONS += $(SKEL_OUT)/kwork_trace.skel.h
 $(SKEL_TMP_OUT) $(LIBAPI_OUTPUT) $(LIBBPF_OUTPUT) $(LIBPERF_OUTPUT) $(LIBSUBCMD_OUTPUT) $(LIBSYMBOL_OUTPUT):
 	$(Q)$(MKDIR) -p $@
 
-ifdef BUILD_BPF_SKEL
+ifndef NO_BPF_SKEL
 BPFTOOL := $(SKEL_TMP_OUT)/bootstrap/bpftool
 BPF_INCLUDE := -I$(SKEL_TMP_OUT)/.. -I$(LIBBPF_INCLUDE)
 
@@ -1088,11 +1088,11 @@ bpf-skel: $(SKELETONS)
 
 .PRECIOUS: $(SKEL_TMP_OUT)/%.bpf.o
 
-else # BUILD_BPF_SKEL
+else # NO_BPF_SKEL
 
 bpf-skel:
 
-endif # BUILD_BPF_SKEL
+endif # NO_BPF_SKEL
 
 bpf-skel-clean:
 	$(call QUIET_CLEAN, bpf-skel) $(RM) -r $(SKEL_TMP_OUT) $(SKELETONS)
tools/perf/builtin-lock.c +1 -1
index 054997edd98b..240d49a85524 100644
@@ -2371,7 +2371,7 @@ int cmd_lock(int argc, const char **argv)
 
 #ifndef HAVE_BPF_SKEL
 		set_option_nobuild(contention_options, 'b', "use-bpf",
-				   "no BUILD_BPF_SKEL=1", false);
+				   "NO_BPF_SKEL=1", false);
 #endif
 		if (argc) {
 			argc = parse_options(argc, argv, contention_options,
tools/perf/builtin-record.c +1 -1
index 8374117e66f6..495627437f97 100644
@@ -3971,7 +3971,7 @@ int cmd_record(int argc, const char **argv)
 
 #ifndef HAVE_BPF_SKEL
 # define set_nobuild(s, l, m, c) set_option_nobuild(record_options, s, l, m, c)
-	set_nobuild('\0', "off-cpu", "no BUILD_BPF_SKEL=1", true);
+	set_nobuild('\0', "off-cpu", "NO_BPF_SKEL=1", true);
 # undef set_nobuild
 #endif
 
tools/perf/builtin-version.c +1 -0
index a886929ec6e5..0d9cda238c07 100644
@@ -83,6 +83,7 @@ static void library_status(void)
 	STATUS(HAVE_ZSTD_SUPPORT, zstd);
 	STATUS(HAVE_LIBPFM, libpfm4);
 	STATUS(HAVE_LIBTRACEEVENT, libtraceevent);
+	STATUS(HAVE_BPF_SKEL, BPF skeletons);
 }
 
 int cmd_version(int argc, const char **argv)
tools/perf/tests/shell/record_offcpu.sh +1 -1
index e01973d4e0fb..24f81ff85793 100755
@@ -28,7 +28,7 @@ test_offcpu_priv() {
     err=2
     return
   fi
-  if perf record --off-cpu -o /dev/null --quiet true 2>&1 | grep BUILD_BPF_SKEL
+  if perf version --build-options 2>&1 | grep HAVE_BPF_SKEL | grep -q OFF
   then
     echo "off-cpu test [Skipped missing BPF support]"
     err=2
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
#3 lore raw

Re: [PATCH v1 02/13] perf build: Make BUILD_BPF_SKEL default, rename to NO_BPF_SKEL

Em Fri, Mar 10, 2023 at 10:57:42PM -0800, Ian Rogers escreveu:

Quoted 7 lines

BPF skeleton support is now key to a number of perf features. Rather than making it so that BPF support must be enabled for the build, make this the default and error if the build lacks a clang and libbpf that are sufficient. To avoid the error and build without BPF skeletons the NO_BPF_SKEL=1 flag can be used. Add a build-options flag to 'perf version' to enable detection of the BPF skeleton support and use this in the offcpu shell test.

Checking this:

cd . && make LIBBPF_DYNAMIC=1 FEATURES_DUMP=/var/home/acme/git/perf-tools-next/tools/perf/BUILD_TEST_FEATURE_DUMP -j32 O=/tmp/tmp.Rr5xDuXo13 DESTDIR=/tmp/tmp.cYdDvy09eY
BUILD: Doing 'make -j32' parallel build

  HOSTCC  /tmp/tmp.Rr5xDuXo13/fixdep.o
  HOSTLD  /tmp/tmp.Rr5xDuXo13/fixdep-in.o
  LINK    /tmp/tmp.Rr5xDuXo13/fixdep

Warning: Kernel ABI header at 'tools/include/uapi/linux/in.h' differs from latest version at 'include/uapi/linux/in.h'
diff -u tools/include/uapi/linux/in.h include/uapi/linux/in.h
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h' diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
Warning: Kernel ABI header at 'tools/arch/arm64/include/uapi/asm/perf_regs.h' differs from latest version at 'arch/arm64/include/uapi/asm/perf_regs.h' diff -u tools/arch/arm64/include/uapi/asm/perf_regs.h arch/arm64/include/uapi/asm/perf_regs.h
Warning: Kernel ABI header at 'tools/include/linux/coresight-pmu.h' differs from latest version at 'include/linux/coresight-pmu.h' diff -u tools/include/linux/coresight-pmu.h include/linux/coresight-pmu.h
Makefile.config:1130: No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel

  GEN     /tmp/tmp.Rr5xDuXo13/common-cmds.h
  CC      /tmp/tmp.Rr5xDuXo13/dlfilters/dlfilter-test-api-v0.o
  CC      /tmp/tmp.Rr5xDuXo13/dlfilters/dlfilter-show-cycles.o
  LINK    /tmp/tmp.Rr5xDuXo13/dlfilters/dlfilter-test-api-v0.so
  LINK    /tmp/tmp.Rr5xDuXo13/dlfilters/dlfilter-show-cycles.so
  INSTALL /tmp/tmp.Rr5xDuXo13/libsubcmd/include/subcmd/exec-cmd.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libsubcmd/include/subcmd/help.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libsubcmd/include/subcmd/pager.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libsubcmd/include/subcmd/parse-options.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libsubcmd/include/subcmd/run-command.h
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/exec-cmd.o
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/help.o
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/pager.o
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/parse-options.o
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/run-command.o
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/sigchain.o
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/subcmd-config.o
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/
  INSTALL libsubcmd_headers
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/hashmap.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/relo_core.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/libbpf_internal.h
  PERF_VERSION = 6.3.rc1.g0b82b38b7b56
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/bpf_perf.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/core.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/cpumap.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/threadmap.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libsymbol/include/symbol/kallsyms.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libapi/include/api/cpu.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/evlist.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libapi/include/api/debug.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/evsel.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libapi/include/api/io.h
  GEN     perf-archive
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/event.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libapi/include/api/fd/array.h
  GEN     perf-iostat
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/mmap.h
  CC      /tmp/tmp.Rr5xDuXo13/libperf/core.o
  CC      /tmp/tmp.Rr5xDuXo13/libsymbol/kallsyms.o
  CC      /tmp/tmp.Rr5xDuXo13/libapi/cpu.o
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/cpumap.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libapi/include/api/fs/fs.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libapi/include/api/fs/tracing_path.h
  MKDIR   /tmp/tmp.Rr5xDuXo13/libapi/fd/
  CC      /tmp/tmp.Rr5xDuXo13/libapi/debug.o
  CC      /tmp/tmp.Rr5xDuXo13/libapi/str_error_r.o
  CC      /tmp/tmp.Rr5xDuXo13/libperf/cpumap.o
  INSTALL libsymbol_headers
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/evlist.h
  CC      /tmp/tmp.Rr5xDuXo13/libperf/threadmap.o
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/evsel.h
  CC      /tmp/tmp.Rr5xDuXo13/libperf/evsel.o
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/lib.h
  CC      /tmp/tmp.Rr5xDuXo13/libperf/evlist.o
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/mmap.h
  MKDIR   /tmp/tmp.Rr5xDuXo13/libapi/fs/
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/threadmap.h
  CC      /tmp/tmp.Rr5xDuXo13/libapi/fd/array.o
  MKDIR   /tmp/tmp.Rr5xDuXo13/libapi/fs/
  CC      /tmp/tmp.Rr5xDuXo13/libperf/mmap.o
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/xyarray.h
  CC      /tmp/tmp.Rr5xDuXo13/libapi/fs/fs.o
  CC      /tmp/tmp.Rr5xDuXo13/libperf/zalloc.o
  CC      /tmp/tmp.Rr5xDuXo13/libperf/xyarray.o
  CC      /tmp/tmp.Rr5xDuXo13/libapi/fs/cgroup.o
  CC      /tmp/tmp.Rr5xDuXo13/libperf/lib.o
  INSTALL libapi_headers
  CC      /tmp/tmp.Rr5xDuXo13/libapi/fs/tracing_path.o
  INSTALL libperf_headers
  GEN     /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/bpf_helper_defs.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/bpf.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/libbpf.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/btf.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/libbpf_common.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/libbpf_legacy.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/bpf_helpers.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/bpf_tracing.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/bpf_endian.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/bpf_core_read.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/skel_internal.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/libbpf_version.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/usdt.bpf.h
  LD      /tmp/tmp.Rr5xDuXo13/libapi/fd/libapi-in.o
  LD      /tmp/tmp.Rr5xDuXo13/libsymbol/libsymbol-in.o
  AR      /tmp/tmp.Rr5xDuXo13/libsymbol/libsymbol.a
  LD      /tmp/tmp.Rr5xDuXo13/libapi/fs/libapi-in.o
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/bpf_helper_defs.h
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  INSTALL libbpf_headers
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  LD      /tmp/tmp.Rr5xDuXo13/libapi/libapi-in.o
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/libbpf.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/bpf.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/libbpf_probes.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/hashmap.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/nlattr.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/btf_dump.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/btf.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/libbpf_errno.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/str_error.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/netlink.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/ringbuf.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/bpf_prog_linfo.o
  LD      /tmp/tmp.Rr5xDuXo13/libperf/libperf-in.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/strset.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/linker.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/gen_loader.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/relo_core.o
  AR      /tmp/tmp.Rr5xDuXo13/libapi/libapi.a
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/usdt.o
  AR      /tmp/tmp.Rr5xDuXo13/libperf/libperf.a
  LD      /tmp/tmp.Rr5xDuXo13/libsubcmd/libsubcmd-in.o
  AR      /tmp/tmp.Rr5xDuXo13/libsubcmd/libsubcmd.a
  GEN     /tmp/tmp.Rr5xDuXo13/python/perf.cpython-311-x86_64-linux-gnu.so
  LD      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/libbpf-in.o
  LINK    /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/libbpf.a
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/main.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/common.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/json_writer.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/gen.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/btf.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/xlated_dumper.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/btf_dumper.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/disasm.o
  LINK    /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/bpftool
  GEN     /tmp/tmp.Rr5xDuXo13/util/bpf_skel/vmlinux.h
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bpf_prog_profiler.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bperf_leader.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bperf_follower.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bperf_cgroup.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/func_latency.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/off_cpu.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/lock_contention.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/kwork_trace.bpf.o
util/bpf_skel/lock_contention.bpf.c:192:7: error: call to undeclared function 'bpf_core_type_matches'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
                if (bpf_core_type_matches(struct rw_semaphore___old)) {
                    ^
util/bpf_skel/lock_contention.bpf.c:192:29: error: expected expression
                if (bpf_core_type_matches(struct rw_semaphore___old)) {
                                          ^
util/bpf_skel/lock_contention.bpf.c:195:36: error: expected expression
                } else if (bpf_core_type_matches(struct rw_semaphore___new)) {
                                                 ^

3 errors generated.
/usr/bin/ld: bpf architecture of input file /tmp/bperf_follower-74fba5.o' is incompatible with i386:x86-64 output /usr/bin/ld: bpf architecture of input file /tmp/bperf_leader-b2ec61.o' is incompatible with i386:x86-64 output /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) /usr/bin/ld: bpf architecture of input file `/tmp/func_latency-70b7d4.o' is incompatible with i386:x86-64 output make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/lock_contention.bpf.o] Error 1 make[4]: *** Waiting for unfinished jobs....
make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bperf_follower.bpf.o] Error 1 make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bperf_leader.bpf.o] Error 1 /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/func_latency.bpf.o] Error 1 /usr/bin/ld: bpf architecture of input file /tmp/bpf_prog_profiler-6e9720.o' is incompatible with i386:x86-64 output /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function _start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bpf_prog_profiler.bpf.o] Error 1 /usr/bin/ld: bpf architecture of input file /tmp/kwork_trace-8d5b4e.o' is incompatible with i386:x86-64 output /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function _start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/kwork_trace.bpf.o] Error 1 /usr/bin/ld: bpf architecture of input file /tmp/off_cpu-1cb75d.o' is incompatible with i386:x86-64 output /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function _start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/off_cpu.bpf.o] Error 1 /usr/bin/ld: bpf architecture of input file /tmp/bperf_cgroup-45eb44.o' is incompatible with i386:x86-64 output /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function _start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bperf_cgroup.bpf.o] Error 1 make[3]: *** [Makefile.perf:236: sub-make] Error 2
make[2]: *** [Makefile:70: all] Error 2
make[1]: *** [tests/make:326: make_libbpf_dynamic_O] Error 1
make: *** [Makefile:103: build-test] Error 2
make: Leaving directory '/var/home/acme/git/perf-tools-next/tools/perf'

real 5m55.192s
user 62m31.596s
sys 14m30.828s
⬢[acme@toolbox perf-tools-next]$

author reviewer
#4 lore raw

Re: [PATCH v1 02/13] perf build: Make BUILD_BPF_SKEL default, rename to NO_BPF_SKEL

Quoted 237 lines · Arnaldo Carvalho de Melo

Em Fri, Mar 10, 2023 at 10:57:42PM -0800, Ian Rogers escreveu:

Quoted 7 lines

BPF skeleton support is now key to a number of perf features. Rather than making it so that BPF support must be enabled for the build, make this the default and error if the build lacks a clang and libbpf that are sufficient. To avoid the error and build without BPF skeletons the NO_BPF_SKEL=1 flag can be used. Add a build-options flag to 'perf version' to enable detection of the BPF skeleton support and use this in the offcpu shell test.

Checking this:

cd . && make LIBBPF_DYNAMIC=1 FEATURES_DUMP=/var/home/acme/git/perf-tools-next/tools/perf/BUILD_TEST_FEATURE_DUMP -j32 O=/tmp/tmp.Rr5xDuXo13 DESTDIR=/tmp/tmp.cYdDvy09eY
BUILD: Doing 'make -j32' parallel build

  HOSTCC  /tmp/tmp.Rr5xDuXo13/fixdep.o
  HOSTLD  /tmp/tmp.Rr5xDuXo13/fixdep-in.o
  LINK    /tmp/tmp.Rr5xDuXo13/fixdep

Warning: Kernel ABI header at 'tools/include/uapi/linux/in.h' differs from latest version at 'include/uapi/linux/in.h'
diff -u tools/include/uapi/linux/in.h include/uapi/linux/in.h
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h' diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
Warning: Kernel ABI header at 'tools/arch/arm64/include/uapi/asm/perf_regs.h' differs from latest version at 'arch/arm64/include/uapi/asm/perf_regs.h' diff -u tools/arch/arm64/include/uapi/asm/perf_regs.h arch/arm64/include/uapi/asm/perf_regs.h
Warning: Kernel ABI header at 'tools/include/linux/coresight-pmu.h' differs from latest version at 'include/linux/coresight-pmu.h' diff -u tools/include/linux/coresight-pmu.h include/linux/coresight-pmu.h
Makefile.config:1130: No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel

  GEN     /tmp/tmp.Rr5xDuXo13/common-cmds.h
  CC      /tmp/tmp.Rr5xDuXo13/dlfilters/dlfilter-test-api-v0.o
  CC      /tmp/tmp.Rr5xDuXo13/dlfilters/dlfilter-show-cycles.o
  LINK    /tmp/tmp.Rr5xDuXo13/dlfilters/dlfilter-test-api-v0.so
  LINK    /tmp/tmp.Rr5xDuXo13/dlfilters/dlfilter-show-cycles.so
  INSTALL /tmp/tmp.Rr5xDuXo13/libsubcmd/include/subcmd/exec-cmd.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libsubcmd/include/subcmd/help.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libsubcmd/include/subcmd/pager.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libsubcmd/include/subcmd/parse-options.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libsubcmd/include/subcmd/run-command.h
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/exec-cmd.o
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/help.o
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/pager.o
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/parse-options.o
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/run-command.o
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/sigchain.o
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/subcmd-config.o
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/
  INSTALL libsubcmd_headers
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/hashmap.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/relo_core.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/libbpf_internal.h
  PERF_VERSION = 6.3.rc1.g0b82b38b7b56
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/bpf_perf.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/core.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/cpumap.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/threadmap.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libsymbol/include/symbol/kallsyms.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libapi/include/api/cpu.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/evlist.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libapi/include/api/debug.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/evsel.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libapi/include/api/io.h
  GEN     perf-archive
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/event.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libapi/include/api/fd/array.h
  GEN     perf-iostat
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/mmap.h
  CC      /tmp/tmp.Rr5xDuXo13/libperf/core.o
  CC      /tmp/tmp.Rr5xDuXo13/libsymbol/kallsyms.o
  CC      /tmp/tmp.Rr5xDuXo13/libapi/cpu.o
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/cpumap.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libapi/include/api/fs/fs.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libapi/include/api/fs/tracing_path.h
  MKDIR   /tmp/tmp.Rr5xDuXo13/libapi/fd/
  CC      /tmp/tmp.Rr5xDuXo13/libapi/debug.o
  CC      /tmp/tmp.Rr5xDuXo13/libapi/str_error_r.o
  CC      /tmp/tmp.Rr5xDuXo13/libperf/cpumap.o
  INSTALL libsymbol_headers
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/evlist.h
  CC      /tmp/tmp.Rr5xDuXo13/libperf/threadmap.o
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/evsel.h
  CC      /tmp/tmp.Rr5xDuXo13/libperf/evsel.o
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/lib.h
  CC      /tmp/tmp.Rr5xDuXo13/libperf/evlist.o
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/mmap.h
  MKDIR   /tmp/tmp.Rr5xDuXo13/libapi/fs/
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/threadmap.h
  CC      /tmp/tmp.Rr5xDuXo13/libapi/fd/array.o
  MKDIR   /tmp/tmp.Rr5xDuXo13/libapi/fs/
  CC      /tmp/tmp.Rr5xDuXo13/libperf/mmap.o
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/xyarray.h
  CC      /tmp/tmp.Rr5xDuXo13/libapi/fs/fs.o
  CC      /tmp/tmp.Rr5xDuXo13/libperf/zalloc.o
  CC      /tmp/tmp.Rr5xDuXo13/libperf/xyarray.o
  CC      /tmp/tmp.Rr5xDuXo13/libapi/fs/cgroup.o
  CC      /tmp/tmp.Rr5xDuXo13/libperf/lib.o
  INSTALL libapi_headers
  CC      /tmp/tmp.Rr5xDuXo13/libapi/fs/tracing_path.o
  INSTALL libperf_headers
  GEN     /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/bpf_helper_defs.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/bpf.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/libbpf.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/btf.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/libbpf_common.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/libbpf_legacy.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/bpf_helpers.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/bpf_tracing.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/bpf_endian.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/bpf_core_read.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/skel_internal.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/libbpf_version.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/usdt.bpf.h
  LD      /tmp/tmp.Rr5xDuXo13/libapi/fd/libapi-in.o
  LD      /tmp/tmp.Rr5xDuXo13/libsymbol/libsymbol-in.o
  AR      /tmp/tmp.Rr5xDuXo13/libsymbol/libsymbol.a
  LD      /tmp/tmp.Rr5xDuXo13/libapi/fs/libapi-in.o
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/bpf_helper_defs.h
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  INSTALL libbpf_headers
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  LD      /tmp/tmp.Rr5xDuXo13/libapi/libapi-in.o
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/libbpf.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/bpf.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/libbpf_probes.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/hashmap.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/nlattr.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/btf_dump.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/btf.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/libbpf_errno.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/str_error.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/netlink.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/ringbuf.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/bpf_prog_linfo.o
  LD      /tmp/tmp.Rr5xDuXo13/libperf/libperf-in.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/strset.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/linker.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/gen_loader.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/relo_core.o
  AR      /tmp/tmp.Rr5xDuXo13/libapi/libapi.a
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/usdt.o
  AR      /tmp/tmp.Rr5xDuXo13/libperf/libperf.a
  LD      /tmp/tmp.Rr5xDuXo13/libsubcmd/libsubcmd-in.o
  AR      /tmp/tmp.Rr5xDuXo13/libsubcmd/libsubcmd.a
  GEN     /tmp/tmp.Rr5xDuXo13/python/perf.cpython-311-x86_64-linux-gnu.so
  LD      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/libbpf-in.o
  LINK    /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/libbpf.a
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/main.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/common.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/json_writer.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/gen.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/btf.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/xlated_dumper.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/btf_dumper.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/disasm.o
  LINK    /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/bpftool
  GEN     /tmp/tmp.Rr5xDuXo13/util/bpf_skel/vmlinux.h
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bpf_prog_profiler.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bperf_leader.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bperf_follower.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bperf_cgroup.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/func_latency.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/off_cpu.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/lock_contention.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/kwork_trace.bpf.o
util/bpf_skel/lock_contention.bpf.c:192:7: error: call to undeclared function 'bpf_core_type_matches'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
                if (bpf_core_type_matches(struct rw_semaphore___old)) {
                    ^
util/bpf_skel/lock_contention.bpf.c:192:29: error: expected expression
                if (bpf_core_type_matches(struct rw_semaphore___old)) {
                                          ^
util/bpf_skel/lock_contention.bpf.c:195:36: error: expected expression
                } else if (bpf_core_type_matches(struct rw_semaphore___new)) {
                                                 ^

3 errors generated.
/usr/bin/ld: bpf architecture of input file /tmp/bperf_follower-74fba5.o' is incompatible with i386:x86-64 output /usr/bin/ld: bpf architecture of input file /tmp/bperf_leader-b2ec61.o' is incompatible with i386:x86-64 output /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) /usr/bin/ld: bpf architecture of input file `/tmp/func_latency-70b7d4.o' is incompatible with i386:x86-64 output make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/lock_contention.bpf.o] Error 1 make[4]: *** Waiting for unfinished jobs....
make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bperf_follower.bpf.o] Error 1 make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bperf_leader.bpf.o] Error 1 /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/func_latency.bpf.o] Error 1 /usr/bin/ld: bpf architecture of input file /tmp/bpf_prog_profiler-6e9720.o' is incompatible with i386:x86-64 output /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function _start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bpf_prog_profiler.bpf.o] Error 1 /usr/bin/ld: bpf architecture of input file /tmp/kwork_trace-8d5b4e.o' is incompatible with i386:x86-64 output /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function _start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/kwork_trace.bpf.o] Error 1 /usr/bin/ld: bpf architecture of input file /tmp/off_cpu-1cb75d.o' is incompatible with i386:x86-64 output /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function _start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/off_cpu.bpf.o] Error 1 /usr/bin/ld: bpf architecture of input file /tmp/bperf_cgroup-45eb44.o' is incompatible with i386:x86-64 output /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function _start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bperf_cgroup.bpf.o] Error 1 make[3]: *** [Makefile.perf:236: sub-make] Error 2
make[2]: *** [Makefile:70: all] Error 2
make[1]: *** [tests/make:326: make_libbpf_dynamic_O] Error 1
make: *** [Makefile:103: build-test] Error 2
make: Leaving directory '/var/home/acme/git/perf-tools-next/tools/perf'

Quoted 4 lines
real    5m55.192s
user    62m31.596s
sys     14m30.828s

⬢[acme@toolbox perf-tools-next]$

Sorry, I was testing this on top of:
https://lore.kernel.org/lkml/[email protected]/
The issue being that we're trying to use an old libbpf that the has meant disabling things but:
NO_BPF_SKEL := 1
hadn't been set as part of this. I can address in v2, but with the "assume libbpf 1.0+" patch I hadn't been worrying about this as we'd error out for this case - rather than build error. The erroring out can be worked around by just not having libbpf be dynamic (ie static or not at all by adding NO_LIBBPF=1).

Thanks,
Ian

Quoted 1 line
#5 lore raw

Re: [PATCH v1 02/13] perf build: Make BUILD_BPF_SKEL default, rename to NO_BPF_SKEL

Em Mon, Mar 13, 2023 at 01:27:21PM -0700, Ian Rogers escreveu:

Quoted 244 lines
Quoted 237 lines · Arnaldo Carvalho de Melo

Em Fri, Mar 10, 2023 at 10:57:42PM -0800, Ian Rogers escreveu:

Quoted 7 lines

BPF skeleton support is now key to a number of perf features. Rather than making it so that BPF support must be enabled for the build, make this the default and error if the build lacks a clang and libbpf that are sufficient. To avoid the error and build without BPF skeletons the NO_BPF_SKEL=1 flag can be used. Add a build-options flag to 'perf version' to enable detection of the BPF skeleton support and use this in the offcpu shell test.

Checking this:

cd . && make LIBBPF_DYNAMIC=1 FEATURES_DUMP=/var/home/acme/git/perf-tools-next/tools/perf/BUILD_TEST_FEATURE_DUMP -j32 O=/tmp/tmp.Rr5xDuXo13 DESTDIR=/tmp/tmp.cYdDvy09eY
BUILD: Doing 'make -j32' parallel build

  HOSTCC  /tmp/tmp.Rr5xDuXo13/fixdep.o
  HOSTLD  /tmp/tmp.Rr5xDuXo13/fixdep-in.o
  LINK    /tmp/tmp.Rr5xDuXo13/fixdep

Warning: Kernel ABI header at 'tools/include/uapi/linux/in.h' differs from latest version at 'include/uapi/linux/in.h'
diff -u tools/include/uapi/linux/in.h include/uapi/linux/in.h
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h' diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
Warning: Kernel ABI header at 'tools/arch/arm64/include/uapi/asm/perf_regs.h' differs from latest version at 'arch/arm64/include/uapi/asm/perf_regs.h' diff -u tools/arch/arm64/include/uapi/asm/perf_regs.h arch/arm64/include/uapi/asm/perf_regs.h
Warning: Kernel ABI header at 'tools/include/linux/coresight-pmu.h' differs from latest version at 'include/linux/coresight-pmu.h' diff -u tools/include/linux/coresight-pmu.h include/linux/coresight-pmu.h
Makefile.config:1130: No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel

  GEN     /tmp/tmp.Rr5xDuXo13/common-cmds.h
  CC      /tmp/tmp.Rr5xDuXo13/dlfilters/dlfilter-test-api-v0.o
  CC      /tmp/tmp.Rr5xDuXo13/dlfilters/dlfilter-show-cycles.o
  LINK    /tmp/tmp.Rr5xDuXo13/dlfilters/dlfilter-test-api-v0.so
  LINK    /tmp/tmp.Rr5xDuXo13/dlfilters/dlfilter-show-cycles.so
  INSTALL /tmp/tmp.Rr5xDuXo13/libsubcmd/include/subcmd/exec-cmd.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libsubcmd/include/subcmd/help.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libsubcmd/include/subcmd/pager.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libsubcmd/include/subcmd/parse-options.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libsubcmd/include/subcmd/run-command.h
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/exec-cmd.o
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/help.o
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/pager.o
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/parse-options.o
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/run-command.o
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/sigchain.o
  CC      /tmp/tmp.Rr5xDuXo13/libsubcmd/subcmd-config.o
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/
  INSTALL libsubcmd_headers
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/hashmap.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/relo_core.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/libbpf_internal.h
  PERF_VERSION = 6.3.rc1.g0b82b38b7b56
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/bpf_perf.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/core.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/cpumap.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/threadmap.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libsymbol/include/symbol/kallsyms.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libapi/include/api/cpu.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/evlist.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libapi/include/api/debug.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/evsel.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libapi/include/api/io.h
  GEN     perf-archive
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/event.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libapi/include/api/fd/array.h
  GEN     perf-iostat
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/perf/mmap.h
  CC      /tmp/tmp.Rr5xDuXo13/libperf/core.o
  CC      /tmp/tmp.Rr5xDuXo13/libsymbol/kallsyms.o
  CC      /tmp/tmp.Rr5xDuXo13/libapi/cpu.o
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/cpumap.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libapi/include/api/fs/fs.h
  INSTALL /tmp/tmp.Rr5xDuXo13/libapi/include/api/fs/tracing_path.h
  MKDIR   /tmp/tmp.Rr5xDuXo13/libapi/fd/
  CC      /tmp/tmp.Rr5xDuXo13/libapi/debug.o
  CC      /tmp/tmp.Rr5xDuXo13/libapi/str_error_r.o
  CC      /tmp/tmp.Rr5xDuXo13/libperf/cpumap.o
  INSTALL libsymbol_headers
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/evlist.h
  CC      /tmp/tmp.Rr5xDuXo13/libperf/threadmap.o
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/evsel.h
  CC      /tmp/tmp.Rr5xDuXo13/libperf/evsel.o
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/lib.h
  CC      /tmp/tmp.Rr5xDuXo13/libperf/evlist.o
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/mmap.h
  MKDIR   /tmp/tmp.Rr5xDuXo13/libapi/fs/
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/threadmap.h
  CC      /tmp/tmp.Rr5xDuXo13/libapi/fd/array.o
  MKDIR   /tmp/tmp.Rr5xDuXo13/libapi/fs/
  CC      /tmp/tmp.Rr5xDuXo13/libperf/mmap.o
  INSTALL /tmp/tmp.Rr5xDuXo13/libperf/include/internal/xyarray.h
  CC      /tmp/tmp.Rr5xDuXo13/libapi/fs/fs.o
  CC      /tmp/tmp.Rr5xDuXo13/libperf/zalloc.o
  CC      /tmp/tmp.Rr5xDuXo13/libperf/xyarray.o
  CC      /tmp/tmp.Rr5xDuXo13/libapi/fs/cgroup.o
  CC      /tmp/tmp.Rr5xDuXo13/libperf/lib.o
  INSTALL libapi_headers
  CC      /tmp/tmp.Rr5xDuXo13/libapi/fs/tracing_path.o
  INSTALL libperf_headers
  GEN     /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/bpf_helper_defs.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/bpf.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/libbpf.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/btf.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/libbpf_common.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/libbpf_legacy.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/bpf_helpers.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/bpf_tracing.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/bpf_endian.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/bpf_core_read.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/skel_internal.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/libbpf_version.h
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/usdt.bpf.h
  LD      /tmp/tmp.Rr5xDuXo13/libapi/fd/libapi-in.o
  LD      /tmp/tmp.Rr5xDuXo13/libsymbol/libsymbol-in.o
  AR      /tmp/tmp.Rr5xDuXo13/libsymbol/libsymbol.a
  LD      /tmp/tmp.Rr5xDuXo13/libapi/fs/libapi-in.o
  INSTALL /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/include/bpf/bpf_helper_defs.h
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  INSTALL libbpf_headers
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  LD      /tmp/tmp.Rr5xDuXo13/libapi/libapi-in.o
  MKDIR   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/libbpf.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/bpf.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/libbpf_probes.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/hashmap.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/nlattr.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/btf_dump.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/btf.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/libbpf_errno.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/str_error.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/netlink.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/ringbuf.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/bpf_prog_linfo.o
  LD      /tmp/tmp.Rr5xDuXo13/libperf/libperf-in.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/strset.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/linker.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/gen_loader.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/relo_core.o
  AR      /tmp/tmp.Rr5xDuXo13/libapi/libapi.a
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/usdt.o
  AR      /tmp/tmp.Rr5xDuXo13/libperf/libperf.a
  LD      /tmp/tmp.Rr5xDuXo13/libsubcmd/libsubcmd-in.o
  AR      /tmp/tmp.Rr5xDuXo13/libsubcmd/libsubcmd.a
  GEN     /tmp/tmp.Rr5xDuXo13/python/perf.cpython-311-x86_64-linux-gnu.so
  LD      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/staticobjs/libbpf-in.o
  LINK    /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/libbpf/libbpf.a
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/main.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/common.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/json_writer.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/gen.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/btf.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/xlated_dumper.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/btf_dumper.o
  CC      /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/disasm.o
  LINK    /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bootstrap/bpftool
  GEN     /tmp/tmp.Rr5xDuXo13/util/bpf_skel/vmlinux.h
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bpf_prog_profiler.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bperf_leader.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bperf_follower.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bperf_cgroup.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/func_latency.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/off_cpu.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/lock_contention.bpf.o
  CLANG   /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/kwork_trace.bpf.o
util/bpf_skel/lock_contention.bpf.c:192:7: error: call to undeclared function 'bpf_core_type_matches'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
                if (bpf_core_type_matches(struct rw_semaphore___old)) {
                    ^
util/bpf_skel/lock_contention.bpf.c:192:29: error: expected expression
                if (bpf_core_type_matches(struct rw_semaphore___old)) {
                                          ^
util/bpf_skel/lock_contention.bpf.c:195:36: error: expected expression
                } else if (bpf_core_type_matches(struct rw_semaphore___new)) {
                                                 ^

3 errors generated.
/usr/bin/ld: bpf architecture of input file /tmp/bperf_follower-74fba5.o' is incompatible with i386:x86-64 output /usr/bin/ld: bpf architecture of input file /tmp/bperf_leader-b2ec61.o' is incompatible with i386:x86-64 output /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) /usr/bin/ld: bpf architecture of input file `/tmp/func_latency-70b7d4.o' is incompatible with i386:x86-64 output make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/lock_contention.bpf.o] Error 1 make[4]: *** Waiting for unfinished jobs....
make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bperf_follower.bpf.o] Error 1 make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bperf_leader.bpf.o] Error 1 /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/func_latency.bpf.o] Error 1 /usr/bin/ld: bpf architecture of input file /tmp/bpf_prog_profiler-6e9720.o' is incompatible with i386:x86-64 output /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function _start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bpf_prog_profiler.bpf.o] Error 1 /usr/bin/ld: bpf architecture of input file /tmp/kwork_trace-8d5b4e.o' is incompatible with i386:x86-64 output /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function _start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/kwork_trace.bpf.o] Error 1 /usr/bin/ld: bpf architecture of input file /tmp/off_cpu-1cb75d.o' is incompatible with i386:x86-64 output /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function _start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/off_cpu.bpf.o] Error 1 /usr/bin/ld: bpf architecture of input file /tmp/bperf_cgroup-45eb44.o' is incompatible with i386:x86-64 output /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/12/../../../../lib64/crt1.o: in function _start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bperf_cgroup.bpf.o] Error 1 make[3]: *** [Makefile.perf:236: sub-make] Error 2
make[2]: *** [Makefile:70: all] Error 2
make[1]: *** [tests/make:326: make_libbpf_dynamic_O] Error 1
make: *** [Makefile:103: build-test] Error 2
make: Leaving directory '/var/home/acme/git/perf-tools-next/tools/perf'

Quoted 4 lines
real    5m55.192s
user    62m31.596s
sys     14m30.828s

⬢[acme@toolbox perf-tools-next]$

Quoted 10 lines

Sorry, I was testing this on top of:
https://lore.kernel.org/lkml/[email protected]/
The issue being that we're trying to use an old libbpf that the has meant disabling things but:
NO_BPF_SKEL := 1
hadn't been set as part of this. I can address in v2, but with the "assume libbpf 1.0+" patch I hadn't been worrying about this as we'd error out for this case - rather than build error. The erroring out can be worked around by just not having libbpf be dynamic (ie static or not at all by adding NO_LIBBPF=1).

I'll try adding that 3-patch series before this one.

- Arnaldo

#6 lore raw

Re: [PATCH v1 02/13] perf build: Make BUILD_BPF_SKEL default, rename to NO_BPF_SKEL

Em Mon, Mar 13, 2023 at 05:34:06PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 29 lines

Em Mon, Mar 13, 2023 at 01:27:21PM -0700, Ian Rogers escreveu:

Quoted 17 lines

On Mon, Mar 13, 2023 at 1:19 PM Arnaldo Carvalho de Melo

Quoted 11 lines

(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bperf_cgroup.bpf.o] Error 1 make[3]: *** [Makefile.perf:236: sub-make] Error 2
make[2]: *** [Makefile:70: all] Error 2
make[1]: *** [tests/make:326: make_libbpf_dynamic_O] Error 1
make: *** [Makefile:103: build-test] Error 2
make: Leaving directory '/var/home/acme/git/perf-tools-next/tools/perf'

Quoted 4 lines
real    5m55.192s
user    62m31.596s
sys     14m30.828s

⬢[acme@toolbox perf-tools-next]$

Quoted 10 lines

Sorry, I was testing this on top of:
https://lore.kernel.org/lkml/[email protected]/
The issue being that we're trying to use an old libbpf that the has meant disabling things but:
NO_BPF_SKEL := 1
hadn't been set as part of this. I can address in v2, but with the "assume libbpf 1.0+" patch I hadn't been worrying about this as we'd error out for this case - rather than build error. The erroring out can be worked around by just not having libbpf be dynamic (ie static or not at all by adding NO_LIBBPF=1).

Quoted 1 line

I'll try adding that 3-patch series before this one.

⬢[acme@toolbox perf-tools-next]$ git log --oneline -16
76c8a07f51703787 (HEAD -> perf-tools-next) perf build: Error if no libelf and NO_LIBELF isn't set 030a6c72b38e334d perf build: Remove redundant NO_NEWT build option 5d1360fc84cd2e3b perf build: If libtraceevent isn't present error the build e25e0db4700aa39a perf build: Switch libpfm4 to opt-out rather than opt-in 39f53202a8961d3d perf symbol: Add abi::__cxa_demangle C++ demangling support d857f258f3d1214a tools build: Add feature test for abi::__cxa_demangle 7aae0d8341c9c373 perf build: Make binutil libraries opt in
dc4890e772aba1e9 perf build: Error if jevents won't work and NO_JEVENTS=1 isn't set 334e64172816623d perf util: Remove weak sched_getcpu
e44d7e7c60fc4ded perf build: Remove unused HAVE_GLIBC_SUPPORT
14ea53be45758450 perf build: Make BUILD_BPF_SKEL default, rename to NO_BPF_SKEL eb03903c5c119254 perf build: Support python/perf.so testing
f8b579c1996ba4a9 perf bpf: Remove pre libbpf 1.0 conditional logic 2cce43c63d4d0abc perf build: Remove libbpf pre-1.0 feature tests
a24ebff6cce14a34 tools build: Pass libbpf feature only if libbpf 1.0+ 17535a33a9c1e4fb perf lock contention: Fix compiler builtin detection ⬢[acme@toolbox perf-tools-next]$

       make_libbpf_dynamic_O: cd . && make LIBBPF_DYNAMIC=1 FEATURES_DUMP=/var/home/acme/git/perf-tools-next/tools/perf/BUILD_TEST_FEATURE_DUMP -j32 O=/tmp/tmp.cO9WpgtAvo DESTDIR=/tmp/tmp.jjguTPlLWt
ldd: /tmp/tmp.cO9WpgtAvo/perf: No such file or directory
cd . && make LIBBPF_DYNAMIC=1 FEATURES_DUMP=/var/home/acme/git/perf-tools-next/tools/perf/BUILD_TEST_FEATURE_DUMP -j32 O=/tmp/tmp.cO9WpgtAvo DESTDIR=/tmp/tmp.jjguTPlLWt
  BUILD:   Doing 'make -j32' parallel build
  HOSTCC  /tmp/tmp.cO9WpgtAvo/fixdep.o
  HOSTLD  /tmp/tmp.cO9WpgtAvo/fixdep-in.o
  LINK    /tmp/tmp.cO9WpgtAvo/fixdep

Warning: Kernel ABI header at 'tools/include/uapi/linux/in.h' differs from latest version at 'include/uapi/linux/in.h'
diff -u tools/include/uapi/linux/in.h include/uapi/linux/in.h
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h' diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
Warning: Kernel ABI header at 'tools/arch/arm64/include/uapi/asm/perf_regs.h' differs from latest version at 'arch/arm64/include/uapi/asm/perf_regs.h' diff -u tools/arch/arm64/include/uapi/asm/perf_regs.h arch/arm64/include/uapi/asm/perf_regs.h
Warning: Kernel ABI header at 'tools/include/linux/coresight-pmu.h' differs from latest version at 'include/linux/coresight-pmu.h' diff -u tools/include/linux/coresight-pmu.h include/linux/coresight-pmu.h
Makefile.config:563: *** Error: No libbpf devel library found, please install libbpf-devel. Stop.
make[3]: *** [Makefile.perf:236: sub-make] Error 2
make[2]: *** [Makefile:70: all] Error 2
make[1]: *** [tests/make:326: make_libbpf_dynamic_O] Error 1

But:

⬢[acme@toolbox perf-tools-next]$ rpm -qa | grep libbpf libbpf-0.8.0-2.fc37.x86_64 libbpf-devel-0.8.0-2.fc37.x86_64 ⬢[acme@toolbox perf-tools-next]$

⬢[acme@toolbox perf-tools-next]$ cat /etc/os-release NAME="Fedora Linux"
VERSION="37 (Container Image)"

I'll see if this is just a matter of tweaking the error message to something like "libbpf-devel not found or older than 1.0.0, please install/update"

- Arnaldo

#7 lore raw

Re: [PATCH v1 02/13] perf build: Make BUILD_BPF_SKEL default, rename to NO_BPF_SKEL

Em Mon, Mar 13, 2023 at 05:59:35PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 79 lines

Em Mon, Mar 13, 2023 at 05:34:06PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 29 lines

Em Mon, Mar 13, 2023 at 01:27:21PM -0700, Ian Rogers escreveu:

Quoted 17 lines

On Mon, Mar 13, 2023 at 1:19 PM Arnaldo Carvalho de Melo

Quoted 11 lines

(.text+0x1b): undefined reference to `main'
/usr/bin/ld: final link failed: file in wrong format
collect2: error: ld returned 1 exit status
clang-15: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation) make[4]: *** [Makefile.perf:1081: /tmp/tmp.Rr5xDuXo13/util/bpf_skel/.tmp/bperf_cgroup.bpf.o] Error 1 make[3]: *** [Makefile.perf:236: sub-make] Error 2
make[2]: *** [Makefile:70: all] Error 2
make[1]: *** [tests/make:326: make_libbpf_dynamic_O] Error 1
make: *** [Makefile:103: build-test] Error 2
make: Leaving directory '/var/home/acme/git/perf-tools-next/tools/perf'

Quoted 4 lines
real    5m55.192s
user    62m31.596s
sys     14m30.828s

⬢[acme@toolbox perf-tools-next]$

Quoted 10 lines

Sorry, I was testing this on top of:
https://lore.kernel.org/lkml/[email protected]/
The issue being that we're trying to use an old libbpf that the has meant disabling things but:
NO_BPF_SKEL := 1
hadn't been set as part of this. I can address in v2, but with the "assume libbpf 1.0+" patch I hadn't been worrying about this as we'd error out for this case - rather than build error. The erroring out can be worked around by just not having libbpf be dynamic (ie static or not at all by adding NO_LIBBPF=1).

Quoted 1 line

I'll try adding that 3-patch series before this one.

⬢[acme@toolbox perf-tools-next]$ git log --oneline -16
76c8a07f51703787 (HEAD -> perf-tools-next) perf build: Error if no libelf and NO_LIBELF isn't set 030a6c72b38e334d perf build: Remove redundant NO_NEWT build option 5d1360fc84cd2e3b perf build: If libtraceevent isn't present error the build e25e0db4700aa39a perf build: Switch libpfm4 to opt-out rather than opt-in 39f53202a8961d3d perf symbol: Add abi::__cxa_demangle C++ demangling support d857f258f3d1214a tools build: Add feature test for abi::__cxa_demangle 7aae0d8341c9c373 perf build: Make binutil libraries opt in
dc4890e772aba1e9 perf build: Error if jevents won't work and NO_JEVENTS=1 isn't set 334e64172816623d perf util: Remove weak sched_getcpu
e44d7e7c60fc4ded perf build: Remove unused HAVE_GLIBC_SUPPORT
14ea53be45758450 perf build: Make BUILD_BPF_SKEL default, rename to NO_BPF_SKEL eb03903c5c119254 perf build: Support python/perf.so testing
f8b579c1996ba4a9 perf bpf: Remove pre libbpf 1.0 conditional logic 2cce43c63d4d0abc perf build: Remove libbpf pre-1.0 feature tests
a24ebff6cce14a34 tools build: Pass libbpf feature only if libbpf 1.0+ 17535a33a9c1e4fb perf lock contention: Fix compiler builtin detection ⬢[acme@toolbox perf-tools-next]$

       make_libbpf_dynamic_O: cd . && make LIBBPF_DYNAMIC=1 FEATURES_DUMP=/var/home/acme/git/perf-tools-next/tools/perf/BUILD_TEST_FEATURE_DUMP -j32 O=/tmp/tmp.cO9WpgtAvo DESTDIR=/tmp/tmp.jjguTPlLWt
ldd: /tmp/tmp.cO9WpgtAvo/perf: No such file or directory
cd . && make LIBBPF_DYNAMIC=1 FEATURES_DUMP=/var/home/acme/git/perf-tools-next/tools/perf/BUILD_TEST_FEATURE_DUMP -j32 O=/tmp/tmp.cO9WpgtAvo DESTDIR=/tmp/tmp.jjguTPlLWt
  BUILD:   Doing 'make -j32' parallel build
  HOSTCC  /tmp/tmp.cO9WpgtAvo/fixdep.o
  HOSTLD  /tmp/tmp.cO9WpgtAvo/fixdep-in.o
  LINK    /tmp/tmp.cO9WpgtAvo/fixdep

Warning: Kernel ABI header at 'tools/include/uapi/linux/in.h' differs from latest version at 'include/uapi/linux/in.h'
diff -u tools/include/uapi/linux/in.h include/uapi/linux/in.h
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h' diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
Warning: Kernel ABI header at 'tools/arch/arm64/include/uapi/asm/perf_regs.h' differs from latest version at 'arch/arm64/include/uapi/asm/perf_regs.h' diff -u tools/arch/arm64/include/uapi/asm/perf_regs.h arch/arm64/include/uapi/asm/perf_regs.h
Warning: Kernel ABI header at 'tools/include/linux/coresight-pmu.h' differs from latest version at 'include/linux/coresight-pmu.h' diff -u tools/include/linux/coresight-pmu.h include/linux/coresight-pmu.h
Makefile.config:563: *** Error: No libbpf devel library found, please install libbpf-devel. Stop.
make[3]: *** [Makefile.perf:236: sub-make] Error 2
make[2]: *** [Makefile:70: all] Error 2
make[1]: *** [tests/make:326: make_libbpf_dynamic_O] Error 1

But:

⬢[acme@toolbox perf-tools-next]$ rpm -qa | grep libbpf libbpf-0.8.0-2.fc37.x86_64 libbpf-devel-0.8.0-2.fc37.x86_64 ⬢[acme@toolbox perf-tools-next]$

Quoted 7 lines

⬢[acme@toolbox perf-tools-next]$ cat /etc/os-release NAME="Fedora Linux"
VERSION="37 (Container Image)"

I'll see if this is just a matter of tweaking the error message to something like "libbpf-devel not found or older than 1.0.0, please install/update"

Yeah, I'll tweak the warning:

⬢[acme@toolbox perf-tools-next]$ cat /tmp/build/perf-tools-next/feature/test-libbpf.make.output test-libbpf.c:5:2: error: #error At least libbpf 1.0 is required for Linux tools.
5 | #error At least libbpf 1.0 is required for Linux tools.
| ^~~~~
⬢[acme@toolbox perf-tools-next]$

- Arnaldo

author reviewer
#8 lore raw

PATCH 3/13 perf build: Remove unused HAVE_GLIBC_SUPPORT

In reply to Ian Rogers

HAVE_GLIBC_SUPPORT is only used in perf version --build-options but doesn't control any behavior. Remove from the build to simplify it.

---
 tools/perf/Makefile.config   | 4 ----
 tools/perf/builtin-version.c | 1 -
 2 files changed, 5 deletions(-)
tools/perf/Makefile.config +0 -4
index 33d62d542fd5..a68a3e9b47ae 100644
@@ -476,10 +476,6 @@ else
   endif # libelf support
 endif # NO_LIBELF
 
-ifeq ($(feature-glibc), 1)
-  CFLAGS += -DHAVE_GLIBC_SUPPORT
-endif
-
 ifeq ($(feature-libaio), 1)
   ifndef NO_AIO
     CFLAGS += -DHAVE_AIO_SUPPORT
tools/perf/builtin-version.c +0 -1
index 0d9cda238c07..c5d03a11e565 100644
@@ -59,7 +59,6 @@ static void library_status(void)
 {
 	STATUS(HAVE_DWARF_SUPPORT, dwarf);
 	STATUS(HAVE_DWARF_GETLOCATIONS_SUPPORT, dwarf_getlocations);
-	STATUS(HAVE_GLIBC_SUPPORT, glibc);
 #ifndef HAVE_SYSCALL_TABLE_SUPPORT
 	STATUS(HAVE_LIBAUDIT_SUPPORT, libaudit);
 #endif
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
author reviewer
#9 lore raw

PATCH 4/13 perf build: Error if no libelf and NO_LIBELF isn't set

In reply to Ian Rogers

Building without libelf support is going disable a lot of functionality. Require that the NO_LIBELF=1 build option is passed if this is intentional.

---
 tools/perf/Makefile.config | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
tools/perf/Makefile.config +1 -9
index a68a3e9b47ae..5691e2ffb1b9 100644
@@ -426,15 +426,7 @@ else
       LIBC_SUPPORT := 1
     endif
     ifeq ($(LIBC_SUPPORT),1)
-      msg := $(warning No libelf found. Disables 'probe' tool, jvmti and BPF support in 'perf record'. Please install libelf-dev, libelf-devel or elfutils-libelf-devel);
-
-      NO_LIBELF := 1
-      NO_DWARF := 1
-      NO_DEMANGLE := 1
-      NO_LIBUNWIND := 1
-      NO_LIBDW_DWARF_UNWIND := 1
-      NO_LIBBPF := 1
-      NO_JVMTI := 1
+      msg := $(error ERROR: No libelf found. Disables 'probe' tool, jvmti and BPF support. Please install libelf-dev, libelf-devel, elfutils-libelf-devel or build with NO_LIBELF=1.)
     else
       ifneq ($(filter s% -fsanitize=address%,$(EXTRA_CFLAGS),),)
         ifneq ($(shell ldconfig -p | grep libasan >/dev/null 2>&1; echo $$?), 0)
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
#10 lore raw

Re: [PATCH v1 04/13] perf build: Error if no libelf and NO_LIBELF isn't set

Em Fri, Mar 10, 2023 at 10:57:44PM -0800, Ian Rogers escreveu:

Quoted 3 lines

Building without libelf support is going disable a lot of functionality. Require that the NO_LIBELF=1 build option is passed if this is intentional.

'make -C tools/perf build-test' is failing:

⬢[acme@toolbox perf-tools-next]$ git log --oneline -1 ; time make -C tools/perf build-test
ace4d44d094ce850 (HEAD -> perf-tools-next) perf build: Remove redundant NO_NEWT build option
make: Entering directory '/var/home/acme/git/perf-tools-next/tools/perf'
Warning: Kernel ABI header at 'tools/include/uapi/linux/in.h' differs from latest version at 'include/uapi/linux/in.h'
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
Warning: Kernel ABI header at 'tools/arch/arm64/include/uapi/asm/perf_regs.h' differs from latest version at 'arch/arm64/include/uapi/asm/perf_regs.h'
Warning: Kernel ABI header at 'tools/include/linux/coresight-pmu.h' differs from latest version at 'include/linux/coresight-pmu.h'
- tarpkg: ./tests/perf-targz-src-pkg .

                 make_static: cd . && make LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 NO_JVMTI=1 -j32  DESTDIR=/tmp/tmp.jqGYXdF9cQ
cd . && make LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 NO_JVMTI=1 -j32 DESTDIR=/tmp/tmp.jqGYXdF9cQ
  BUILD:   Doing 'make -j32' parallel build
  HOSTCC  fixdep.o
  HOSTLD  fixdep-in.o
  LINK    fixdep

Warning: Kernel ABI header at 'tools/include/uapi/linux/in.h' differs from latest version at 'include/uapi/linux/in.h'
diff -u tools/include/uapi/linux/in.h include/uapi/linux/in.h
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
Warning: Kernel ABI header at 'tools/arch/arm64/include/uapi/asm/perf_regs.h' differs from latest version at 'arch/arm64/include/uapi/asm/perf_regs.h'
diff -u tools/arch/arm64/include/uapi/asm/perf_regs.h arch/arm64/include/uapi/asm/perf_regs.h
Warning: Kernel ABI header at 'tools/include/linux/coresight-pmu.h' differs from latest version at 'include/linux/coresight-pmu.h'
diff -u tools/include/linux/coresight-pmu.h include/linux/coresight-pmu.h
Makefile.config:429: *** ERROR: No libelf found. Disables 'probe' tool, jvmti and BPF support. Please install libelf-dev, libelf-devel, elfutils-libelf-devel or build with NO_LIBELF=1.. Stop. make[3]: *** [Makefile.perf:236: sub-make] Error 2
make[2]: *** [Makefile:70: all] Error 2
test: test -x ./perf
make[1]: *** [tests/make:316: make_static] Error 1
make: *** [Makefile:103: build-test] Error 2

Same thing for the libtraceevent, I'll add NO_LIBTRACEEVENT=1 and NO_LIBELF=1 to the static build test in tools/perf/tests/make

author reviewer
#11 lore raw

Re: [PATCH v1 04/13] perf build: Error if no libelf and NO_LIBELF isn't set

Quoted 38 lines · Arnaldo Carvalho de Melo

Em Fri, Mar 10, 2023 at 10:57:44PM -0800, Ian Rogers escreveu:

Quoted 3 lines

Building without libelf support is going disable a lot of functionality. Require that the NO_LIBELF=1 build option is passed if this is intentional.

'make -C tools/perf build-test' is failing:

⬢[acme@toolbox perf-tools-next]$ git log --oneline -1 ; time make -C tools/perf build-test
ace4d44d094ce850 (HEAD -> perf-tools-next) perf build: Remove redundant NO_NEWT build option
make: Entering directory '/var/home/acme/git/perf-tools-next/tools/perf'
Warning: Kernel ABI header at 'tools/include/uapi/linux/in.h' differs from latest version at 'include/uapi/linux/in.h'
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
Warning: Kernel ABI header at 'tools/arch/arm64/include/uapi/asm/perf_regs.h' differs from latest version at 'arch/arm64/include/uapi/asm/perf_regs.h'
Warning: Kernel ABI header at 'tools/include/linux/coresight-pmu.h' differs from latest version at 'include/linux/coresight-pmu.h'
- tarpkg: ./tests/perf-targz-src-pkg .

                 make_static: cd . && make LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 NO_JVMTI=1 -j32  DESTDIR=/tmp/tmp.jqGYXdF9cQ
cd . && make LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 NO_JVMTI=1 -j32 DESTDIR=/tmp/tmp.jqGYXdF9cQ
  BUILD:   Doing 'make -j32' parallel build
  HOSTCC  fixdep.o
  HOSTLD  fixdep-in.o
  LINK    fixdep

Warning: Kernel ABI header at 'tools/include/uapi/linux/in.h' differs from latest version at 'include/uapi/linux/in.h'
diff -u tools/include/uapi/linux/in.h include/uapi/linux/in.h
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
Warning: Kernel ABI header at 'tools/arch/arm64/include/uapi/asm/perf_regs.h' differs from latest version at 'arch/arm64/include/uapi/asm/perf_regs.h'
diff -u tools/arch/arm64/include/uapi/asm/perf_regs.h arch/arm64/include/uapi/asm/perf_regs.h
Warning: Kernel ABI header at 'tools/include/linux/coresight-pmu.h' differs from latest version at 'include/linux/coresight-pmu.h'
diff -u tools/include/linux/coresight-pmu.h include/linux/coresight-pmu.h
Makefile.config:429: *** ERROR: No libelf found. Disables 'probe' tool, jvmti and BPF support. Please install libelf-dev, libelf-devel, elfutils-libelf-devel or build with NO_LIBELF=1.. Stop. make[3]: *** [Makefile.perf:236: sub-make] Error 2
make[2]: *** [Makefile:70: all] Error 2
test: test -x ./perf
make[1]: *** [tests/make:316: make_static] Error 1
make: *** [Makefile:103: build-test] Error 2

Quoted 1 line

Same thing for the libtraceevent, I'll add NO_LIBTRACEEVENT=1 and NO_LIBELF=1 to the static build test in tools/perf/tests/make

Right, this is kind of the point of the patch set. Make it harder for people to make a reduced perf binary without explicitly flagging that this is what they want. For the build tests it may be better to make the flag conditional on what is installed in the image.

Thanks,
Ian

author reviewer
#12 lore raw

PATCH 5/13 perf util: Remove weak sched_getcpu

In reply to Ian Rogers

sched_getcpu may not be present and so a feature test and definition exist to workaround this in the build. The feature test is used to define HAVE_SCHED_GETCPU_SUPPORT and so this is sufficient to know whether the local sched_getcpu is needed and a weak symbol can be avoided.

---
 tools/perf/util/cloexec.c | 13 -------------
 tools/perf/util/util.c    | 16 ++++++++++++++++
 2 files changed, 16 insertions(+), 13 deletions(-)
tools/perf/util/cloexec.c +0 -13
index fa8248aadb59..8830604c3a8d 100644
@@ -13,19 +13,6 @@
 
 static unsigned long flag = PERF_FLAG_FD_CLOEXEC;
 
-int __weak sched_getcpu(void)
-{
-#ifdef __NR_getcpu
-	unsigned cpu;
-	int err = syscall(__NR_getcpu, &cpu, NULL, NULL);
-	if (!err)
-		return cpu;
-#else
-	errno = ENOSYS;
-#endif
-	return -1;
-}
-
 static int perf_flag_probe(void)
 {
 	/* use 'safest' configuration as used in evsel__fallback() */
tools/perf/util/util.c +16 -0
index 391c1e928bd7..b356c9f7f0c3 100644
@@ -533,3 +533,19 @@ int do_realloc_array_as_needed(void **arr, size_t *arr_sz, size_t x, size_t msz,
 	*arr_sz = new_sz;
 	return 0;
 }
+
+#ifndef HAVE_SCHED_GETCPU_SUPPORT
+int sched_getcpu(void)
+{
+#ifdef __NR_getcpu
+	unsigned int cpu;
+	int err = syscall(__NR_getcpu, &cpu, NULL, NULL);
+
+	if (!err)
+		return cpu;
+#else
+	errno = ENOSYS;
+#endif
+	return -1;
+}
+#endif
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
author reviewer
#13 lore raw

PATCH 6/13 perf build: Error if jevents won't work and NO_JEVENTS=1 isn't set

In reply to Ian Rogers

Rather than disabling jevents if a sufficient python isn't present error in the build. This avoids the build progressing but the binary being degraded. The build can still succeed by specifying NO_JEVENTS=1 to the build and this is conveyed in the error message.

---
 tools/perf/Makefile.config | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
tools/perf/Makefile.config +2 -4
index 5691e2ffb1b9..2557654d8e29 100644
@@ -872,14 +872,12 @@ endif
 ifneq ($(NO_JEVENTS),1)
   NO_JEVENTS := 0
   ifndef PYTHON
-    $(warning No python interpreter disabling jevent generation)
-    NO_JEVENTS := 1
+    $(error ERROR: No python interpreter needed for jevents generation. Install python or build with NO_JEVENTS=1.)
   else
     # jevents.py uses f-strings present in Python 3.6 released in Dec. 2016.
     JEVENTS_PYTHON_GOOD := $(shell $(PYTHON) -c 'import sys;print("1" if(sys.version_info.major >= 3 and sys.version_info.minor >= 6) else "0")' 2> /dev/null)
     ifneq ($(JEVENTS_PYTHON_GOOD), 1)
-      $(warning Python interpreter too old (older than 3.6) disabling jevent generation)
-      NO_JEVENTS := 1
+      $(error ERROR: Python interpreter needed for jevents generation too old (older than 3.6). Install a newer python or build with NO_JEVENTS=1.)
     endif
   endif
 endif
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
author reviewer
#14 lore raw

PATCH 7/13 perf build: Make binutil libraries opt in

In reply to Ian Rogers

binutils is GPLv3 so distributions cannot ship perf linked against libbfd and libiberty as the licenses are incompatible. Rather than defaulting the build to opting in to libbfd and libiberty support and opting out via NO_LIBBFD=1 and NO_DEMANGLE=1, make building against the libraries optional and enabled with BUILD_NONDISTRO=1.

---
 tools/perf/Makefile.config | 25 ++++++++++---------------
 tools/perf/Makefile.perf   |  2 ++
 tools/perf/tests/make      |  2 ++
 3 files changed, 14 insertions(+), 15 deletions(-)
tools/perf/Makefile.config +10 -15
index 2557654d8e29..5756498248e0 100644
@@ -882,7 +882,7 @@ ifneq ($(NO_JEVENTS),1)
   endif
 endif
 
-ifndef NO_LIBBFD
+ifdef BUILD_NONDISTRO
   ifeq ($(feature-libbfd), 1)
     EXTLIBS += -lbfd -lopcodes
   else
@@ -905,6 +905,7 @@ ifndef NO_LIBBFD
     $(call feature_check,disassembler-init-styled)
   endif
 
+  CFLAGS += -DHAVE_LIBBFD_SUPPORT
   ifeq ($(feature-libbfd-buildid), 1)
     CFLAGS += -DHAVE_LIBBFD_BUILDID_SUPPORT
   else
@@ -915,32 +916,26 @@ endif
 ifdef NO_DEMANGLE
   CFLAGS += -DNO_DEMANGLE
 else
-  ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
-    EXTLIBS += -liberty
-  else
+  ifdef BUILD_NONDISTRO
     ifeq ($(filter -liberty,$(EXTLIBS)),)
-      $(call feature_check,cplus-demangle)
-
-      # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
-      # or any of 'bfd iberty z' trinity
-      ifeq ($(feature-cplus-demangle), 1)
+      ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
         EXTLIBS += -liberty
       else
-        msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling)
-        CFLAGS += -DNO_DEMANGLE
+        $(call feature_check,cplus-demangle)
+        ifeq ($(feature-cplus-demangle), 1)
+          EXTLIBS += -liberty
+        endif
       endif
     endif
   endif
 
   ifneq ($(filter -liberty,$(EXTLIBS)),)
     CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
+  else
+    CFLAGS += -DNO_DEMANGLE
   endif
 endif
 
-ifneq ($(filter -lbfd,$(EXTLIBS)),)
-  CFLAGS += -DHAVE_LIBBFD_SUPPORT
-endif
-
 ifndef NO_ZLIB
   ifeq ($(feature-zlib), 1)
     CFLAGS += -DHAVE_ZLIB_SUPPORT
tools/perf/Makefile.perf +2 -0
index 283ee4f56234..a35bc995d5d8 100644
@@ -128,6 +128,8 @@ include ../scripts/utilities.mak
 #
 # Define NO_BPF_SKEL to disable BPF skeletons
 #
+# Define BUILD_NONDISTRO to enable building an linking against libbfd and
+# libiberty distribution license incompatible libraries.
 
 # As per kernel Makefile, avoid funny character set dependencies
 unexport LC_ALL
tools/perf/tests/make +2 -0
index deb37fb982e9..c2f74ed43418 100644
@@ -68,6 +68,7 @@ python_perf_so := $(shell $(MAKE) python_perf_target|grep "Target is:"|awk '{pri
 make_clean_all      := clean all
 make_python_perf_so := $(python_perf_so)
 make_debug          := DEBUG=1
+make_nondistro      := BUILD_NONDISTRO=1
 make_no_libperl     := NO_LIBPERL=1
 make_no_libpython   := NO_LIBPYTHON=1
 make_no_scripts     := NO_LIBPYTHON=1 NO_LIBPERL=1
@@ -134,6 +135,7 @@ MAKE_F := $(MAKE) -f $(MK)
 endif
 run += make_python_perf_so
 run += make_debug
+run += make_nondistro
 run += make_no_libperl
 run += make_no_libpython
 run += make_no_scripts
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
#15 lore raw

Re: [PATCH v1 07/13] perf build: Make binutil libraries opt in

Em Fri, Mar 10, 2023 at 10:57:47PM -0800, Ian Rogers escreveu:

Quoted 5 lines

binutils is GPLv3 so distributions cannot ship perf linked against libbfd and libiberty as the licenses are incompatible. Rather than defaulting the build to opting in to libbfd and libiberty support and opting out via NO_LIBBFD=1 and NO_DEMANGLE=1, make building against the libraries optional and enabled with BUILD_NONDISTRO=1.

So now I get this:

⬢[acme@toolbox perf-tools-next]$ perf -vv
perf version 6.3.rc1.gace4d44d094c

                 dwarf: [ on  ]  # HAVE_DWARF_SUPPORT
    dwarf_getlocations: [ on  ]  # HAVE_DWARF_GETLOCATIONS_SUPPORT
         syscall_table: [ on  ]  # HAVE_SYSCALL_TABLE_SUPPORT
                libbfd: [ OFF ]  # HAVE_LIBBFD_SUPPORT
            debuginfod: [ on  ]  # HAVE_DEBUGINFOD_SUPPORT
                libelf: [ on  ]  # HAVE_LIBELF_SUPPORT
               libnuma: [ on  ]  # HAVE_LIBNUMA_SUPPORT
numa_num_possible_cpus: [ on  ]  # HAVE_LIBNUMA_SUPPORT
               libperl: [ on  ]  # HAVE_LIBPERL_SUPPORT
             libpython: [ on  ]  # HAVE_LIBPYTHON_SUPPORT
              libslang: [ on  ]  # HAVE_SLANG_SUPPORT
             libcrypto: [ on  ]  # HAVE_LIBCRYPTO_SUPPORT
             libunwind: [ on  ]  # HAVE_LIBUNWIND_SUPPORT
    libdw-dwarf-unwind: [ on  ]  # HAVE_DWARF_SUPPORT
                  zlib: [ on  ]  # HAVE_ZLIB_SUPPORT
                  lzma: [ on  ]  # HAVE_LZMA_SUPPORT
             get_cpuid: [ on  ]  # HAVE_AUXTRACE_SUPPORT
                   bpf: [ on  ]  # HAVE_LIBBPF_SUPPORT
                   aio: [ on  ]  # HAVE_AIO_SUPPORT
                  zstd: [ on  ]  # HAVE_ZSTD_SUPPORT
               libpfm4: [ on  ]  # HAVE_LIBPFM
         libtraceevent: [ on  ]  # HAVE_LIBTRACEEVENT
         BPF skeletons: [ on  ]  # HAVE_BPF_SKEL

⬢[acme@toolbox perf-tools-next]$

Shouldn't we have, right next to libbpf that libstdc++ feature status?

- Arnaldo

Quoted 105 lines
---
 tools/perf/Makefile.config | 25 ++++++++++---------------
 tools/perf/Makefile.perf   |  2 ++
 tools/perf/tests/make      |  2 ++
 3 files changed, 14 insertions(+), 15 deletions(-)
tools/perf/Makefile.config +10 -15
index 2557654d8e29..5756498248e0 100644
@@ -882,7 +882,7 @@ ifneq ($(NO_JEVENTS),1)
   endif
 endif
 
-ifndef NO_LIBBFD
+ifdef BUILD_NONDISTRO
   ifeq ($(feature-libbfd), 1)
     EXTLIBS += -lbfd -lopcodes
   else
@@ -905,6 +905,7 @@ ifndef NO_LIBBFD
     $(call feature_check,disassembler-init-styled)
   endif
 
+  CFLAGS += -DHAVE_LIBBFD_SUPPORT
   ifeq ($(feature-libbfd-buildid), 1)
     CFLAGS += -DHAVE_LIBBFD_BUILDID_SUPPORT
   else
@@ -915,32 +916,26 @@ endif
 ifdef NO_DEMANGLE
   CFLAGS += -DNO_DEMANGLE
 else
-  ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
-    EXTLIBS += -liberty
-  else
+  ifdef BUILD_NONDISTRO
     ifeq ($(filter -liberty,$(EXTLIBS)),)
-      $(call feature_check,cplus-demangle)
-
-      # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
-      # or any of 'bfd iberty z' trinity
-      ifeq ($(feature-cplus-demangle), 1)
+      ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
         EXTLIBS += -liberty
       else
-        msg := $(warning No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling)
-        CFLAGS += -DNO_DEMANGLE
+        $(call feature_check,cplus-demangle)
+        ifeq ($(feature-cplus-demangle), 1)
+          EXTLIBS += -liberty
+        endif
       endif
     endif
   endif
 
   ifneq ($(filter -liberty,$(EXTLIBS)),)
     CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
+  else
+    CFLAGS += -DNO_DEMANGLE
   endif
 endif
 
-ifneq ($(filter -lbfd,$(EXTLIBS)),)
-  CFLAGS += -DHAVE_LIBBFD_SUPPORT
-endif
-
 ifndef NO_ZLIB
   ifeq ($(feature-zlib), 1)
     CFLAGS += -DHAVE_ZLIB_SUPPORT
tools/perf/Makefile.perf +2 -0
index 283ee4f56234..a35bc995d5d8 100644
@@ -128,6 +128,8 @@ include ../scripts/utilities.mak
 #
 # Define NO_BPF_SKEL to disable BPF skeletons
 #
+# Define BUILD_NONDISTRO to enable building an linking against libbfd and
+# libiberty distribution license incompatible libraries.
 
 # As per kernel Makefile, avoid funny character set dependencies
 unexport LC_ALL
tools/perf/tests/make +2 -0
index deb37fb982e9..c2f74ed43418 100644
@@ -68,6 +68,7 @@ python_perf_so := $(shell $(MAKE) python_perf_target|grep "Target is:"|awk '{pri
 make_clean_all      := clean all
 make_python_perf_so := $(python_perf_so)
 make_debug          := DEBUG=1
+make_nondistro      := BUILD_NONDISTRO=1
 make_no_libperl     := NO_LIBPERL=1
 make_no_libpython   := NO_LIBPYTHON=1
 make_no_scripts     := NO_LIBPYTHON=1 NO_LIBPERL=1
@@ -134,6 +135,7 @@ MAKE_F := $(MAKE) -f $(MK)
 endif
 run += make_python_perf_so
 run += make_debug
+run += make_nondistro
 run += make_no_libperl
 run += make_no_libpython
 run += make_no_scripts
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
Signature · 1 line
- Arnaldo
author reviewer
#16 lore raw

PATCH 8/13 tools build: Add feature test for abi::__cxa_demangle

In reply to Ian Rogers

cxxabi.h is part of libsdtc++ and LLVM's libcxx, providing abi::__cxa_demangle a portable C++ demangler. Add a feature test to detect that the function is available.

---
 tools/build/Makefile.feature              |  1 +
 tools/build/feature/Makefile              |  4 ++++
 tools/build/feature/test-cxa-demangle.cpp | 17 +++++++++++++++++
 3 files changed, 22 insertions(+)
 create mode 100644 tools/build/feature/test-cxa-demangle.cpp
tools/build/Makefile.feature +1 -0
index 38f8851bd7cb..214622d7537c 100644
@@ -80,6 +80,7 @@ FEATURE_TESTS_EXTRA :=                  \
          compile-32                     \
          compile-x32                    \
          cplus-demangle                 \
+         cxa-demangle                   \
          gtk2                           \
          gtk2-infobar                   \
          hello                          \
tools/build/feature/Makefile +4 -0
index dc9323e01e42..0a3b9281f8b0 100644
@@ -23,6 +23,7 @@ FILES=                                          \
          test-libbfd-liberty.bin                \
          test-libbfd-liberty-z.bin              \
          test-cplus-demangle.bin                \
+         test-cxa-demangle.bin                  \
          test-libcap.bin			\
          test-libelf.bin                        \
          test-libelf-getphdrnum.bin             \
@@ -262,6 +263,9 @@ $(OUTPUT)test-libbfd-liberty-z.bin:
 $(OUTPUT)test-cplus-demangle.bin:
 	$(BUILD) -liberty
 
+$(OUTPUT)test-cxa-demangle.bin:
+	$(BUILDXX)
+
 $(OUTPUT)test-backtrace.bin:
 	$(BUILD)
 
tools/build/feature/test-cxa-demangle.cpp new file +17 -0
new file mode 100644
index 000000000000..a3e712f65c37
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <stdio.h>
+#include <stdlib.h>
+#include <cxxabi.h>
+
+int main(void)
+{
+  size_t len = 256;
+  char *output = (char*)malloc(len);
+        int status;
+
+        output = abi::__cxa_demangle("FieldName__9ClassNameFd", output, &len, &status);
+
+        printf("demangled symbol: {%s}\n", output);
+
+        return 0;
+}
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
author reviewer
#17 lore raw

PATCH 9/13 perf symbol: Add abi::__cxa_demangle C++ demangling support

In reply to Ian Rogers

Refactor C++ demangling out of symbol-elf into its own files similar to other languages. Add abi::__cxa_demangle support. As the other demanglers are not shippable with distributions, this brings back C++ demangling in a common case. It isn't perfect as the support for optionally demangling arguments and modifiers isn't present.

---
 tools/perf/Makefile.config       | 29 +++++++++---------
 tools/perf/util/Build            |  1 +
 tools/perf/util/demangle-cxx.cpp | 50 ++++++++++++++++++++++++++++++++
 tools/perf/util/demangle-cxx.h   | 16 ++++++++++
 tools/perf/util/symbol-elf.c     | 37 +++++------------------
 5 files changed, 88 insertions(+), 45 deletions(-)
 create mode 100644 tools/perf/util/demangle-cxx.cpp
 create mode 100644 tools/perf/util/demangle-cxx.h
tools/perf/Makefile.config +14 -15
index 5756498248e0..fdeca45cf15f 100644
@@ -906,6 +906,7 @@ ifdef BUILD_NONDISTRO
   endif
 
   CFLAGS += -DHAVE_LIBBFD_SUPPORT
+  CXXFLAGS += -DHAVE_LIBBFD_SUPPORT
   ifeq ($(feature-libbfd-buildid), 1)
     CFLAGS += -DHAVE_LIBBFD_BUILDID_SUPPORT
   else
@@ -913,26 +914,24 @@ ifdef BUILD_NONDISTRO
   endif
 endif
 
-ifdef NO_DEMANGLE
-  CFLAGS += -DNO_DEMANGLE
-else
+ifndef NO_DEMANGLE
+  $(call feature_check,cxa-demangle)
+  ifeq ($(feature-cxa-demangle), 1)
+    EXTLIBS += -lstdc++
+    CFLAGS += -DHAVE_CXA_DEMANGLE_SUPPORT
+    CXXFLAGS += -DHAVE_CXA_DEMANGLE_SUPPORT
+  endif
   ifdef BUILD_NONDISTRO
     ifeq ($(filter -liberty,$(EXTLIBS)),)
-      ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
+      $(call feature_check,cplus-demangle)
+      ifeq ($(feature-cplus-demangle), 1)
         EXTLIBS += -liberty
-      else
-        $(call feature_check,cplus-demangle)
-        ifeq ($(feature-cplus-demangle), 1)
-          EXTLIBS += -liberty
-        endif
       endif
     endif
-  endif
-
-  ifneq ($(filter -liberty,$(EXTLIBS)),)
-    CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
-  else
-    CFLAGS += -DNO_DEMANGLE
+    ifneq ($(filter -liberty,$(EXTLIBS)),)
+      CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
+      CXXFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
+    endif
   endif
 endif
 
tools/perf/util/Build +1 -0
index 918b501f9bd8..8607575183a9 100644
@@ -211,6 +211,7 @@ perf-$(CONFIG_ZSTD) += zstd.o
 
 perf-$(CONFIG_LIBCAP) += cap.o
 
+perf-y += demangle-cxx.o
 perf-y += demangle-ocaml.o
 perf-y += demangle-java.o
 perf-y += demangle-rust.o
tools/perf/util/demangle-cxx.cpp new file +50 -0

50 lines not on this page · raw message

tools/perf/util/demangle-cxx.h new file +16 -0
new file mode 100644
index 000000000000..26b5b66c0b4e
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __PERF_DEMANGLE_CXX
+#define __PERF_DEMANGLE_CXX 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char *cxx_demangle_sym(const char *str, bool params, bool modifiers);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __PERF_DEMANGLE_CXX */
tools/perf/util/symbol-elf.c +7 -30
index 41882ae8452e..c0a2de42c51b 100644
@@ -12,6 +12,7 @@
 #include "maps.h"
 #include "symbol.h"
 #include "symsrc.h"
+#include "demangle-cxx.h"
 #include "demangle-ocaml.h"
 #include "demangle-java.h"
 #include "demangle-rust.h"
@@ -25,6 +26,11 @@
 #include <symbol/kallsyms.h>
 #include <internal/lib.h>
 
+#ifdef HAVE_LIBBFD_SUPPORT
+#define PACKAGE 'perf'
+#include <bfd.h>
+#endif
+
 #ifndef EM_AARCH64
 #define EM_AARCH64	183  /* ARM 64 bit */
 #endif
@@ -45,34 +51,6 @@
 
 typedef Elf64_Nhdr GElf_Nhdr;
 
-#ifndef DMGL_PARAMS
-#define DMGL_NO_OPTS     0              /* For readability... */
-#define DMGL_PARAMS      (1 << 0)       /* Include function args */
-#define DMGL_ANSI        (1 << 1)       /* Include const, volatile, etc */
-#endif
-
-#ifdef HAVE_LIBBFD_SUPPORT
-#define PACKAGE 'perf'
-#include <bfd.h>
-#else
-#ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
-extern char *cplus_demangle(const char *, int);
-
-static inline char *bfd_demangle(void __maybe_unused *v, const char *c, int i)
-{
-	return cplus_demangle(c, i);
-}
-#else
-#ifdef NO_DEMANGLE
-static inline char *bfd_demangle(void __maybe_unused *v,
-				 const char __maybe_unused *c,
-				 int __maybe_unused i)
-{
-	return NULL;
-}
-#endif
-#endif
-#endif
 
 #ifndef HAVE_ELF_GETPHDRNUM_SUPPORT
 static int elf_getphdrnum(Elf *elf, size_t *dst)
@@ -295,7 +273,6 @@ static bool want_demangle(bool is_kernel_sym)
 
 static char *demangle_sym(struct dso *dso, int kmodule, const char *elf_name)
 {
-	int demangle_flags = verbose > 0 ? (DMGL_PARAMS | DMGL_ANSI) : DMGL_NO_OPTS;
 	char *demangled = NULL;
 
 	/*
@@ -306,7 +283,7 @@ static char *demangle_sym(struct dso *dso, int kmodule, const char *elf_name)
 	if (!want_demangle(dso->kernel || kmodule))
 	    return demangled;
 
-	demangled = bfd_demangle(NULL, elf_name, demangle_flags);
+	demangled = cxx_demangle_sym(elf_name, verbose > 0, verbose > 0);
 	if (demangled == NULL) {
 		demangled = ocaml_demangle_sym(elf_name);
 		if (demangled == NULL) {
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
#18 lore raw

Re: [PATCH v1 09/13] perf symbol: Add abi::__cxa_demangle C++ demangling support

Quoted 30 lines · Ian Rogers

Refactor C++ demangling out of symbol-elf into its own files similar to other languages. Add abi::__cxa_demangle support. As the other demanglers are not shippable with distributions, this brings back C++ demangling in a common case. It isn't perfect as the support for optionally demangling arguments and modifiers isn't present.

---
 tools/perf/Makefile.config       | 29 +++++++++---------
 tools/perf/util/Build            |  1 +
 tools/perf/util/demangle-cxx.cpp | 50 ++++++++++++++++++++++++++++++++
 tools/perf/util/demangle-cxx.h   | 16 ++++++++++
 tools/perf/util/symbol-elf.c     | 37 +++++------------------
 5 files changed, 88 insertions(+), 45 deletions(-)
 create mode 100644 tools/perf/util/demangle-cxx.cpp
 create mode 100644 tools/perf/util/demangle-cxx.h
tools/perf/Makefile.config +1 -0
index 5756498248e0..fdeca45cf15f 100644
@@ -906,6 +906,7 @@ ifdef BUILD_NONDISTRO
   endif
 
   CFLAGS += -DHAVE_LIBBFD_SUPPORT
+  CXXFLAGS += -DHAVE_LIBBFD_SUPPORT
   ifeq ($(feature-libbfd-buildid), 1)
     CFLAGS += -DHAVE_LIBBFD_BUILDID_SUPPORT
   else

tools/perf/Makefile.config ifdef BUILD_NONDISTRO · line 920

Quoted 10 lines
tools/perf/Makefile.config +4 -3
@@ -913,26 +914,24 @@ ifdef BUILD_NONDISTRO
   endif
 endif
 
-ifdef NO_DEMANGLE
-  CFLAGS += -DNO_DEMANGLE
-else
+ifndef NO_DEMANGLE
+  $(call feature_check,cxa-demangle)
+  ifeq ($(feature-cxa-demangle), 1)
+    EXTLIBS += -lstdc++

Hi Ian,

I think cross compilation for arm on x86 isn't working after this change (at least on Ubuntu).

Even with all of the arm64 libstdc++ stuff installed, you can only link to it using g++, but the perf build tries to link to it using gcc. Not sure it's some quirk with the search paths on Ubuntu or something else:

  $ aarch64-linux-gnu-gcc -lstdc++

/usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-
gnu/bin/ld: cannot find -lstdc++: No such file or directory
collect2: error: ld returned 1 exit status

g++ gets further:

  $ aarch64-linux-gnu-g++ -lstdc++

...
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status

At the end of the perf build it looks like something similar is happening (with all the non interesting bits deleted):

   $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -C tools/perf
NO_BPF_SKEL=1 V=1

aarch64-linux-gnu-gcc ... -o perf

/usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-gnu/bin/ld:
cannot find -lstdc++: No such file or directory

If I build with NO_DEMANGLE=1 then the build works, but I think it would at be best to autodetect rather than have to do this. Or maybe even link at the end with g++ if we're going to use libstdc++?

Thanks
James

Quoted 195 lines
tools/perf/Makefile.config +9 -12
+    CFLAGS += -DHAVE_CXA_DEMANGLE_SUPPORT
+    CXXFLAGS += -DHAVE_CXA_DEMANGLE_SUPPORT
+  endif
   ifdef BUILD_NONDISTRO
     ifeq ($(filter -liberty,$(EXTLIBS)),)
-      ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
+      $(call feature_check,cplus-demangle)
+      ifeq ($(feature-cplus-demangle), 1)
         EXTLIBS += -liberty
-      else
-        $(call feature_check,cplus-demangle)
-        ifeq ($(feature-cplus-demangle), 1)
-          EXTLIBS += -liberty
-        endif
       endif
     endif
-  endif
-
-  ifneq ($(filter -liberty,$(EXTLIBS)),)
-    CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
-  else
-    CFLAGS += -DNO_DEMANGLE
+    ifneq ($(filter -liberty,$(EXTLIBS)),)
+      CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
+      CXXFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
+    endif
   endif
 endif
 
tools/perf/util/Build +1 -0
index 918b501f9bd8..8607575183a9 100644
@@ -211,6 +211,7 @@ perf-$(CONFIG_ZSTD) += zstd.o
 
 perf-$(CONFIG_LIBCAP) += cap.o
 
+perf-y += demangle-cxx.o
 perf-y += demangle-ocaml.o
 perf-y += demangle-java.o
 perf-y += demangle-rust.o
tools/perf/util/demangle-cxx.cpp new file +50 -0
new file mode 100644
index 000000000000..8708bcafd370
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "demangle-cxx.h"
+#include <stdlib.h>
+#include <string.h>
+#include <linux/compiler.h>
+
+#ifdef HAVE_LIBBFD_SUPPORT
+#define PACKAGE 'perf'
+#include <bfd.h>
+#endif
+
+#ifdef HAVE_CXA_DEMANGLE_SUPPORT
+#include <cxxabi.h>
+#endif
+
+#if defined(HAVE_LIBBFD_SUPPORT) || defined(HAVE_CPLUS_DEMANGLE_SUPPORT)
+#ifndef DMGL_PARAMS
+#define DMGL_PARAMS     (1 << 0)  /* Include function args */
+#define DMGL_ANSI       (1 << 1)  /* Include const, volatile, etc */
+#endif
+#endif
+
+/*
+ * Demangle C++ function signature
+ *
+ * Note: caller is responsible for freeing demangled string
+ */
+extern "C"
+char *cxx_demangle_sym(const char *str, bool params __maybe_unused,
+                       bool modifiers __maybe_unused)
+{
+#ifdef HAVE_LIBBFD_SUPPORT
+        int flags = (params ? DMGL_PARAMS : 0) | (modifiers ? DMGL_ANSI : 0);
+
+        return bfd_demangle(NULL, str, flags);
+#elif defined(HAVE_CPLUS_DEMANGLE_SUPPORT)
+        int flags = (params ? DMGL_PARAMS : 0) | (modifiers ? DMGL_ANSI : 0);
+
+        return cplus_demangle(str, flags);
+#elif defined(HAVE_CXA_DEMANGLE_SUPPORT)
+        size_t len = strlen(str);
+        char *output = (char*)malloc(len);
+        int status;
+
+        output = abi::__cxa_demangle(str, output, &len, &status);
+        return output;
+#else
+        return NULL;
+#endif
+}
tools/perf/util/demangle-cxx.h new file +16 -0
new file mode 100644
index 000000000000..26b5b66c0b4e
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __PERF_DEMANGLE_CXX
+#define __PERF_DEMANGLE_CXX 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char *cxx_demangle_sym(const char *str, bool params, bool modifiers);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __PERF_DEMANGLE_CXX */
tools/perf/util/symbol-elf.c +7 -30
index 41882ae8452e..c0a2de42c51b 100644
@@ -12,6 +12,7 @@
 #include "maps.h"
 #include "symbol.h"
 #include "symsrc.h"
+#include "demangle-cxx.h"
 #include "demangle-ocaml.h"
 #include "demangle-java.h"
 #include "demangle-rust.h"
@@ -25,6 +26,11 @@
 #include <symbol/kallsyms.h>
 #include <internal/lib.h>
 
+#ifdef HAVE_LIBBFD_SUPPORT
+#define PACKAGE 'perf'
+#include <bfd.h>
+#endif
+
 #ifndef EM_AARCH64
 #define EM_AARCH64	183  /* ARM 64 bit */
 #endif
@@ -45,34 +51,6 @@
 
 typedef Elf64_Nhdr GElf_Nhdr;
 
-#ifndef DMGL_PARAMS
-#define DMGL_NO_OPTS     0              /* For readability... */
-#define DMGL_PARAMS      (1 << 0)       /* Include function args */
-#define DMGL_ANSI        (1 << 1)       /* Include const, volatile, etc */
-#endif
-
-#ifdef HAVE_LIBBFD_SUPPORT
-#define PACKAGE 'perf'
-#include <bfd.h>
-#else
-#ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
-extern char *cplus_demangle(const char *, int);
-
-static inline char *bfd_demangle(void __maybe_unused *v, const char *c, int i)
-{
-	return cplus_demangle(c, i);
-}
-#else
-#ifdef NO_DEMANGLE
-static inline char *bfd_demangle(void __maybe_unused *v,
-				 const char __maybe_unused *c,
-				 int __maybe_unused i)
-{
-	return NULL;
-}
-#endif
-#endif
-#endif
 
 #ifndef HAVE_ELF_GETPHDRNUM_SUPPORT
 static int elf_getphdrnum(Elf *elf, size_t *dst)
@@ -295,7 +273,6 @@ static bool want_demangle(bool is_kernel_sym)
 
 static char *demangle_sym(struct dso *dso, int kmodule, const char *elf_name)
 {
-	int demangle_flags = verbose > 0 ? (DMGL_PARAMS | DMGL_ANSI) : DMGL_NO_OPTS;
 	char *demangled = NULL;
 
 	/*
@@ -306,7 +283,7 @@ static char *demangle_sym(struct dso *dso, int kmodule, const char *elf_name)
 	if (!want_demangle(dso->kernel || kmodule))
 	    return demangled;
 
-	demangled = bfd_demangle(NULL, elf_name, demangle_flags);
+	demangled = cxx_demangle_sym(elf_name, verbose > 0, verbose > 0);
 	if (demangled == NULL) {
 		demangled = ocaml_demangle_sym(elf_name);
 		if (demangled == NULL) {
author reviewer
#19 lore raw

Re: [PATCH v1 09/13] perf symbol: Add abi::__cxa_demangle C++ demangling support

Quoted 74 lines · James Clark
Quoted 30 lines · Ian Rogers

Refactor C++ demangling out of symbol-elf into its own files similar to other languages. Add abi::__cxa_demangle support. As the other demanglers are not shippable with distributions, this brings back C++ demangling in a common case. It isn't perfect as the support for optionally demangling arguments and modifiers isn't present.

---
 tools/perf/Makefile.config       | 29 +++++++++---------
 tools/perf/util/Build            |  1 +
 tools/perf/util/demangle-cxx.cpp | 50 ++++++++++++++++++++++++++++++++
 tools/perf/util/demangle-cxx.h   | 16 ++++++++++
 tools/perf/util/symbol-elf.c     | 37 +++++------------------
 5 files changed, 88 insertions(+), 45 deletions(-)
 create mode 100644 tools/perf/util/demangle-cxx.cpp
 create mode 100644 tools/perf/util/demangle-cxx.h
tools/perf/Makefile.config +1 -0
index 5756498248e0..fdeca45cf15f 100644
@@ -906,6 +906,7 @@ ifdef BUILD_NONDISTRO
   endif
 
   CFLAGS += -DHAVE_LIBBFD_SUPPORT
+  CXXFLAGS += -DHAVE_LIBBFD_SUPPORT
   ifeq ($(feature-libbfd-buildid), 1)
     CFLAGS += -DHAVE_LIBBFD_BUILDID_SUPPORT
   else

tools/perf/Makefile.config ifdef BUILD_NONDISTRO · line 920

Quoted 10 lines
tools/perf/Makefile.config +4 -3
@@ -913,26 +914,24 @@ ifdef BUILD_NONDISTRO
   endif
 endif
 
-ifdef NO_DEMANGLE
-  CFLAGS += -DNO_DEMANGLE
-else
+ifndef NO_DEMANGLE
+  $(call feature_check,cxa-demangle)
+  ifeq ($(feature-cxa-demangle), 1)
+    EXTLIBS += -lstdc++

Hi Ian,

I think cross compilation for arm on x86 isn't working after this change (at least on Ubuntu).

Even with all of the arm64 libstdc++ stuff installed, you can only link to it using g++, but the perf build tries to link to it using gcc. Not sure it's some quirk with the search paths on Ubuntu or something else:

  $ aarch64-linux-gnu-gcc -lstdc++
   /usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-

gnu/bin/ld: cannot find -lstdc++: No such file or directory
collect2: error: ld returned 1 exit status

g++ gets further:

  $ aarch64-linux-gnu-g++ -lstdc++

...
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status

At the end of the perf build it looks like something similar is happening (with all the non interesting bits deleted):

   $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -C tools/perf
NO_BPF_SKEL=1 V=1
Quoted 8 lines

aarch64-linux-gnu-gcc ... -o perf

/usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-gnu/bin/ld:
cannot find -lstdc++: No such file or directory

If I build with NO_DEMANGLE=1 then the build works, but I think it would at be best to autodetect rather than have to do this. Or maybe even link at the end with g++ if we're going to use libstdc++?

Hi James,

sorry for the problems you are having, I'll see if I can get a repo. I did add a feature test with this change in the same set:
https://lore.kernel.org/lkml/[email protected]/
So it should be feature testing and only enabling when HAVE_CXA_DEMANGLE_SUPPORT is present. Obviously something is up, so I'll have a think about it.

Thanks,
Ian

Quoted 198 lines

Thanks
James

Quoted 195 lines
tools/perf/Makefile.config +9 -12
+    CFLAGS += -DHAVE_CXA_DEMANGLE_SUPPORT
+    CXXFLAGS += -DHAVE_CXA_DEMANGLE_SUPPORT
+  endif
   ifdef BUILD_NONDISTRO
     ifeq ($(filter -liberty,$(EXTLIBS)),)
-      ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
+      $(call feature_check,cplus-demangle)
+      ifeq ($(feature-cplus-demangle), 1)
         EXTLIBS += -liberty
-      else
-        $(call feature_check,cplus-demangle)
-        ifeq ($(feature-cplus-demangle), 1)
-          EXTLIBS += -liberty
-        endif
       endif
     endif
-  endif
-
-  ifneq ($(filter -liberty,$(EXTLIBS)),)
-    CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
-  else
-    CFLAGS += -DNO_DEMANGLE
+    ifneq ($(filter -liberty,$(EXTLIBS)),)
+      CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
+      CXXFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
+    endif
   endif
 endif
 
tools/perf/util/Build +1 -0
index 918b501f9bd8..8607575183a9 100644
@@ -211,6 +211,7 @@ perf-$(CONFIG_ZSTD) += zstd.o
 
 perf-$(CONFIG_LIBCAP) += cap.o
 
+perf-y += demangle-cxx.o
 perf-y += demangle-ocaml.o
 perf-y += demangle-java.o
 perf-y += demangle-rust.o
tools/perf/util/demangle-cxx.cpp new file +50 -0
new file mode 100644
index 000000000000..8708bcafd370
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "demangle-cxx.h"
+#include <stdlib.h>
+#include <string.h>
+#include <linux/compiler.h>
+
+#ifdef HAVE_LIBBFD_SUPPORT
+#define PACKAGE 'perf'
+#include <bfd.h>
+#endif
+
+#ifdef HAVE_CXA_DEMANGLE_SUPPORT
+#include <cxxabi.h>
+#endif
+
+#if defined(HAVE_LIBBFD_SUPPORT) || defined(HAVE_CPLUS_DEMANGLE_SUPPORT)
+#ifndef DMGL_PARAMS
+#define DMGL_PARAMS     (1 << 0)  /* Include function args */
+#define DMGL_ANSI       (1 << 1)  /* Include const, volatile, etc */
+#endif
+#endif
+
+/*
+ * Demangle C++ function signature
+ *
+ * Note: caller is responsible for freeing demangled string
+ */
+extern "C"
+char *cxx_demangle_sym(const char *str, bool params __maybe_unused,
+                       bool modifiers __maybe_unused)
+{
+#ifdef HAVE_LIBBFD_SUPPORT
+        int flags = (params ? DMGL_PARAMS : 0) | (modifiers ? DMGL_ANSI : 0);
+
+        return bfd_demangle(NULL, str, flags);
+#elif defined(HAVE_CPLUS_DEMANGLE_SUPPORT)
+        int flags = (params ? DMGL_PARAMS : 0) | (modifiers ? DMGL_ANSI : 0);
+
+        return cplus_demangle(str, flags);
+#elif defined(HAVE_CXA_DEMANGLE_SUPPORT)
+        size_t len = strlen(str);
+        char *output = (char*)malloc(len);
+        int status;
+
+        output = abi::__cxa_demangle(str, output, &len, &status);
+        return output;
+#else
+        return NULL;
+#endif
+}
tools/perf/util/demangle-cxx.h new file +16 -0
new file mode 100644
index 000000000000..26b5b66c0b4e
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __PERF_DEMANGLE_CXX
+#define __PERF_DEMANGLE_CXX 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char *cxx_demangle_sym(const char *str, bool params, bool modifiers);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __PERF_DEMANGLE_CXX */
tools/perf/util/symbol-elf.c +7 -30
index 41882ae8452e..c0a2de42c51b 100644
@@ -12,6 +12,7 @@
 #include "maps.h"
 #include "symbol.h"
 #include "symsrc.h"
+#include "demangle-cxx.h"
 #include "demangle-ocaml.h"
 #include "demangle-java.h"
 #include "demangle-rust.h"
@@ -25,6 +26,11 @@
 #include <symbol/kallsyms.h>
 #include <internal/lib.h>
 
+#ifdef HAVE_LIBBFD_SUPPORT
+#define PACKAGE 'perf'
+#include <bfd.h>
+#endif
+
 #ifndef EM_AARCH64
 #define EM_AARCH64   183  /* ARM 64 bit */
 #endif
@@ -45,34 +51,6 @@
 
 typedef Elf64_Nhdr GElf_Nhdr;
 
-#ifndef DMGL_PARAMS
-#define DMGL_NO_OPTS     0              /* For readability... */
-#define DMGL_PARAMS      (1 << 0)       /* Include function args */
-#define DMGL_ANSI        (1 << 1)       /* Include const, volatile, etc */
-#endif
-
-#ifdef HAVE_LIBBFD_SUPPORT
-#define PACKAGE 'perf'
-#include <bfd.h>
-#else
-#ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
-extern char *cplus_demangle(const char *, int);
-
-static inline char *bfd_demangle(void __maybe_unused *v, const char *c, int i)
-{
-     return cplus_demangle(c, i);
-}
-#else
-#ifdef NO_DEMANGLE
-static inline char *bfd_demangle(void __maybe_unused *v,
-                              const char __maybe_unused *c,
-                              int __maybe_unused i)
-{
-     return NULL;
-}
-#endif
-#endif
-#endif
 
 #ifndef HAVE_ELF_GETPHDRNUM_SUPPORT
 static int elf_getphdrnum(Elf *elf, size_t *dst)
@@ -295,7 +273,6 @@ static bool want_demangle(bool is_kernel_sym)
 
 static char *demangle_sym(struct dso *dso, int kmodule, const char *elf_name)
 {
-     int demangle_flags = verbose > 0 ? (DMGL_PARAMS | DMGL_ANSI) : DMGL_NO_OPTS;
      char *demangled = NULL;
 
      /*
@@ -306,7 +283,7 @@ static char *demangle_sym(struct dso *dso, int kmodule, const char *elf_name)
      if (!want_demangle(dso->kernel || kmodule))
          return demangled;
 
-     demangled = bfd_demangle(NULL, elf_name, demangle_flags);
+     demangled = cxx_demangle_sym(elf_name, verbose > 0, verbose > 0);
      if (demangled == NULL) {
              demangled = ocaml_demangle_sym(elf_name);
              if (demangled == NULL) {
author reviewer
#20 lore raw

Re: [PATCH v1 09/13] perf symbol: Add abi::__cxa_demangle C++ demangling support

Quoted 94 lines · Ian Rogers
Quoted 74 lines · James Clark
Quoted 30 lines · Ian Rogers

Refactor C++ demangling out of symbol-elf into its own files similar to other languages. Add abi::__cxa_demangle support. As the other demanglers are not shippable with distributions, this brings back C++ demangling in a common case. It isn't perfect as the support for optionally demangling arguments and modifiers isn't present.

---
 tools/perf/Makefile.config       | 29 +++++++++---------
 tools/perf/util/Build            |  1 +
 tools/perf/util/demangle-cxx.cpp | 50 ++++++++++++++++++++++++++++++++
 tools/perf/util/demangle-cxx.h   | 16 ++++++++++
 tools/perf/util/symbol-elf.c     | 37 +++++------------------
 5 files changed, 88 insertions(+), 45 deletions(-)
 create mode 100644 tools/perf/util/demangle-cxx.cpp
 create mode 100644 tools/perf/util/demangle-cxx.h
tools/perf/Makefile.config +1 -0
index 5756498248e0..fdeca45cf15f 100644
@@ -906,6 +906,7 @@ ifdef BUILD_NONDISTRO
   endif
 
   CFLAGS += -DHAVE_LIBBFD_SUPPORT
+  CXXFLAGS += -DHAVE_LIBBFD_SUPPORT
   ifeq ($(feature-libbfd-buildid), 1)
     CFLAGS += -DHAVE_LIBBFD_BUILDID_SUPPORT
   else

tools/perf/Makefile.config ifdef BUILD_NONDISTRO · line 920

Quoted 10 lines
tools/perf/Makefile.config +4 -3
@@ -913,26 +914,24 @@ ifdef BUILD_NONDISTRO
   endif
 endif
 
-ifdef NO_DEMANGLE
-  CFLAGS += -DNO_DEMANGLE
-else
+ifndef NO_DEMANGLE
+  $(call feature_check,cxa-demangle)
+  ifeq ($(feature-cxa-demangle), 1)
+    EXTLIBS += -lstdc++

Hi Ian,

I think cross compilation for arm on x86 isn't working after this change (at least on Ubuntu).

Even with all of the arm64 libstdc++ stuff installed, you can only link to it using g++, but the perf build tries to link to it using gcc. Not sure it's some quirk with the search paths on Ubuntu or something else:

  $ aarch64-linux-gnu-gcc -lstdc++
   /usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-

gnu/bin/ld: cannot find -lstdc++: No such file or directory
collect2: error: ld returned 1 exit status

g++ gets further:

  $ aarch64-linux-gnu-g++ -lstdc++

...
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status

At the end of the perf build it looks like something similar is happening (with all the non interesting bits deleted):

   $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -C tools/perf
NO_BPF_SKEL=1 V=1
Quoted 8 lines

aarch64-linux-gnu-gcc ... -o perf

/usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-gnu/bin/ld:
cannot find -lstdc++: No such file or directory

If I build with NO_DEMANGLE=1 then the build works, but I think it would at be best to autodetect rather than have to do this. Or maybe even link at the end with g++ if we're going to use libstdc++?

Hi James,

sorry for the problems you are having, I'll see if I can get a repo. I did add a feature test with this change in the same set:
https://lore.kernel.org/lkml/[email protected]/
So it should be feature testing and only enabling when HAVE_CXA_DEMANGLE_SUPPORT is present. Obviously something is up, so I'll have a think about it.

Quoted 2 lines

Thanks,
Ian

Sorry to say I couldn't repro on Debian:

$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -C tools/perf
NO_LIBELF=1 NO_LIBTRACEEVENT=1
make: Entering directory '/home/irogers/kernel.org/tools/perf'
 BUILD:   Doing 'make -j16' parallel build
Warning: Kernel ABI header at 'tools/include/uapi/linux/in.h' differs
from latest version at 'include/uapi/linux/in.h'
diff -u tools/include/uapi/linux/in.h include/uapi/linux/in.h
Warning: Kernel ABI header at
'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version
at 'arch/x86/include/asm/cpufeatures.h'
diff -u tools/arch/x86/include/asm/cpufeatures.h
arch/x86/include/asm/cpufeatures.h
Warning: Kernel ABI header at
'tools/arch/arm64/include/uapi/asm/perf_regs.h' differs from latest
version at 'arch/arm64/include/uapi/asm/perf_regs.h'
diff -u tools/arch/arm64/include/uapi/asm/perf_regs.h
arch/arm64/include/uapi/asm/perf_regs.h
Warning: Kernel ABI header at 'tools/include/linux/coresight-pmu.h'
differs from latest version at 'include/linux/coresight-pmu.h'
diff -u tools/include/linux/coresight-pmu.h include/linux/coresight-pmu.h
Makefile.config:588: No sys/sdt.h found, no SDT events are defined,
please install systemtap-sdt-devel or systemtap-sdt-dev
Makefile.config:679: Disabling post unwind, no support found.
Makefile.config:747: No libcrypto.h found, disables jitted code
injection, please install openssl-devel or libssl-dev
Makefile.config:759: slang not found, disables TUI support. Please
install slang-devel, libslang-devor libslang2-dev
Makefile.config:806: Missing perl devel files. Disabling perl
scripting support, please install perl-ExtUtils-Embed/libperl-dev
Makefile.config:846: No 'Python.h' was found: disables Python support
- please install python-devel/python-dev
Makefile.config:951: No liblzma found, disables xz kernel module
decompression, please install xz-devel/liblzma-dev
Makefile.config:964: No libzstd found, disables trace compression,
please install libzstd-dev[el] and/or set LIBZSTD_DIR
Makefile.config:975: No libcap found, disables capability support,
please install libcap-devel/libcap-dev
Makefile.config:988: No numa.h found, disables 'perf bench numa mem'
benchmark, please install numactl-devel/libnuma-devel/libnuma-dev
Makefile.config:1047: No libbabeltrace found, disables 'perf data' CTF
format support, please install
libbabeltrace-dev[el]/libbabeltrace-ctf-dev
Makefile.config:1138: libpfm4 not found, disables libpfm4 support.
Please install libpfm4-dev

Auto-detecting system features:
... dwarf: [ OFF ]
... dwarf_getlocations: [ OFF ]
... glibc: [ on ]
... libbfd: [ OFF ]
... libbfd-buildid: [ OFF ]
... libcap: [ OFF ]
... libelf: [ OFF ]
... libnuma: [ OFF ]
... numa_num_possible_cpus: [ OFF ]
... libperl: [ OFF ]

...                               libpython: [ OFF ]
...                               libcrypto: [ OFF ]
...                               libunwind: [ OFF ]

... libdw-dwarf-unwind: [ OFF ]
... zlib: [ OFF ]
... lzma: [ OFF ]
... get_cpuid: [ OFF ]
... bpf: [ on ]
... libaio: [ on ]
... libzstd: [ OFF ]

INSTALL libsubcmd_headers
INSTALL libsymbol_headers
INSTALL libapi_headers
INSTALL libperf_headers

 FLEX    util/parse-events-flex.c
 FLEX    util/pmu-flex.c
 CC      util/pmu-bison.o
 FLEX    util/expr-flex.c
 CC      util/expr-bison.o
 CXX     util/demangle-cxx.o
 CC      util/demangle-ocaml.o
 CC      util/demangle-java.o
 CC      util/demangle-rust.o
 CC      util/perf-hooks.o
 CC      util/parse-events.o
 CC      util/parse-events-flex.o
 CC      util/pmu.o
 CC      util/pmu-flex.o
 CC      util/expr-flex.o
 CC      util/expr.o
 LD      util/perf-in.o
 LD      perf-in.o
 LINK    perf

make: Leaving directory '.../tools/perf'

Thanks,
Ian

Quoted 198 lines
Quoted 198 lines

Thanks
James

Quoted 195 lines
tools/perf/Makefile.config +9 -12
+    CFLAGS += -DHAVE_CXA_DEMANGLE_SUPPORT
+    CXXFLAGS += -DHAVE_CXA_DEMANGLE_SUPPORT
+  endif
   ifdef BUILD_NONDISTRO
     ifeq ($(filter -liberty,$(EXTLIBS)),)
-      ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
+      $(call feature_check,cplus-demangle)
+      ifeq ($(feature-cplus-demangle), 1)
         EXTLIBS += -liberty
-      else
-        $(call feature_check,cplus-demangle)
-        ifeq ($(feature-cplus-demangle), 1)
-          EXTLIBS += -liberty
-        endif
       endif
     endif
-  endif
-
-  ifneq ($(filter -liberty,$(EXTLIBS)),)
-    CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
-  else
-    CFLAGS += -DNO_DEMANGLE
+    ifneq ($(filter -liberty,$(EXTLIBS)),)
+      CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
+      CXXFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
+    endif
   endif
 endif
 
tools/perf/util/Build +1 -0
index 918b501f9bd8..8607575183a9 100644
@@ -211,6 +211,7 @@ perf-$(CONFIG_ZSTD) += zstd.o
 
 perf-$(CONFIG_LIBCAP) += cap.o
 
+perf-y += demangle-cxx.o
 perf-y += demangle-ocaml.o
 perf-y += demangle-java.o
 perf-y += demangle-rust.o
tools/perf/util/demangle-cxx.cpp new file +50 -0
new file mode 100644
index 000000000000..8708bcafd370
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "demangle-cxx.h"
+#include <stdlib.h>
+#include <string.h>
+#include <linux/compiler.h>
+
+#ifdef HAVE_LIBBFD_SUPPORT
+#define PACKAGE 'perf'
+#include <bfd.h>
+#endif
+
+#ifdef HAVE_CXA_DEMANGLE_SUPPORT
+#include <cxxabi.h>
+#endif
+
+#if defined(HAVE_LIBBFD_SUPPORT) || defined(HAVE_CPLUS_DEMANGLE_SUPPORT)
+#ifndef DMGL_PARAMS
+#define DMGL_PARAMS     (1 << 0)  /* Include function args */
+#define DMGL_ANSI       (1 << 1)  /* Include const, volatile, etc */
+#endif
+#endif
+
+/*
+ * Demangle C++ function signature
+ *
+ * Note: caller is responsible for freeing demangled string
+ */
+extern "C"
+char *cxx_demangle_sym(const char *str, bool params __maybe_unused,
+                       bool modifiers __maybe_unused)
+{
+#ifdef HAVE_LIBBFD_SUPPORT
+        int flags = (params ? DMGL_PARAMS : 0) | (modifiers ? DMGL_ANSI : 0);
+
+        return bfd_demangle(NULL, str, flags);
+#elif defined(HAVE_CPLUS_DEMANGLE_SUPPORT)
+        int flags = (params ? DMGL_PARAMS : 0) | (modifiers ? DMGL_ANSI : 0);
+
+        return cplus_demangle(str, flags);
+#elif defined(HAVE_CXA_DEMANGLE_SUPPORT)
+        size_t len = strlen(str);
+        char *output = (char*)malloc(len);
+        int status;
+
+        output = abi::__cxa_demangle(str, output, &len, &status);
+        return output;
+#else
+        return NULL;
+#endif
+}
tools/perf/util/demangle-cxx.h new file +16 -0
new file mode 100644
index 000000000000..26b5b66c0b4e
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __PERF_DEMANGLE_CXX
+#define __PERF_DEMANGLE_CXX 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char *cxx_demangle_sym(const char *str, bool params, bool modifiers);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __PERF_DEMANGLE_CXX */
tools/perf/util/symbol-elf.c +7 -30
index 41882ae8452e..c0a2de42c51b 100644
@@ -12,6 +12,7 @@
 #include "maps.h"
 #include "symbol.h"
 #include "symsrc.h"
+#include "demangle-cxx.h"
 #include "demangle-ocaml.h"
 #include "demangle-java.h"
 #include "demangle-rust.h"
@@ -25,6 +26,11 @@
 #include <symbol/kallsyms.h>
 #include <internal/lib.h>
 
+#ifdef HAVE_LIBBFD_SUPPORT
+#define PACKAGE 'perf'
+#include <bfd.h>
+#endif
+
 #ifndef EM_AARCH64
 #define EM_AARCH64   183  /* ARM 64 bit */
 #endif
@@ -45,34 +51,6 @@
 
 typedef Elf64_Nhdr GElf_Nhdr;
 
-#ifndef DMGL_PARAMS
-#define DMGL_NO_OPTS     0              /* For readability... */
-#define DMGL_PARAMS      (1 << 0)       /* Include function args */
-#define DMGL_ANSI        (1 << 1)       /* Include const, volatile, etc */
-#endif
-
-#ifdef HAVE_LIBBFD_SUPPORT
-#define PACKAGE 'perf'
-#include <bfd.h>
-#else
-#ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
-extern char *cplus_demangle(const char *, int);
-
-static inline char *bfd_demangle(void __maybe_unused *v, const char *c, int i)
-{
-     return cplus_demangle(c, i);
-}
-#else
-#ifdef NO_DEMANGLE
-static inline char *bfd_demangle(void __maybe_unused *v,
-                              const char __maybe_unused *c,
-                              int __maybe_unused i)
-{
-     return NULL;
-}
-#endif
-#endif
-#endif
 
 #ifndef HAVE_ELF_GETPHDRNUM_SUPPORT
 static int elf_getphdrnum(Elf *elf, size_t *dst)
@@ -295,7 +273,6 @@ static bool want_demangle(bool is_kernel_sym)
 
 static char *demangle_sym(struct dso *dso, int kmodule, const char *elf_name)
 {
-     int demangle_flags = verbose > 0 ? (DMGL_PARAMS | DMGL_ANSI) : DMGL_NO_OPTS;
      char *demangled = NULL;
 
      /*
@@ -306,7 +283,7 @@ static char *demangle_sym(struct dso *dso, int kmodule, const char *elf_name)
      if (!want_demangle(dso->kernel || kmodule))
          return demangled;
 
-     demangled = bfd_demangle(NULL, elf_name, demangle_flags);
+     demangled = cxx_demangle_sym(elf_name, verbose > 0, verbose > 0);
      if (demangled == NULL) {
              demangled = ocaml_demangle_sym(elf_name);
              if (demangled == NULL) {
#21 lore raw

Re: [PATCH v1 09/13] perf symbol: Add abi::__cxa_demangle C++ demangling support

Quoted 95 lines · Ian Rogers
Quoted 94 lines · Ian Rogers
Quoted 74 lines · James Clark
Quoted 30 lines · Ian Rogers

Refactor C++ demangling out of symbol-elf into its own files similar to other languages. Add abi::__cxa_demangle support. As the other demanglers are not shippable with distributions, this brings back C++ demangling in a common case. It isn't perfect as the support for optionally demangling arguments and modifiers isn't present.

---
 tools/perf/Makefile.config       | 29 +++++++++---------
 tools/perf/util/Build            |  1 +
 tools/perf/util/demangle-cxx.cpp | 50 ++++++++++++++++++++++++++++++++
 tools/perf/util/demangle-cxx.h   | 16 ++++++++++
 tools/perf/util/symbol-elf.c     | 37 +++++------------------
 5 files changed, 88 insertions(+), 45 deletions(-)
 create mode 100644 tools/perf/util/demangle-cxx.cpp
 create mode 100644 tools/perf/util/demangle-cxx.h
tools/perf/Makefile.config +1 -0
index 5756498248e0..fdeca45cf15f 100644
@@ -906,6 +906,7 @@ ifdef BUILD_NONDISTRO
   endif
 
   CFLAGS += -DHAVE_LIBBFD_SUPPORT
+  CXXFLAGS += -DHAVE_LIBBFD_SUPPORT
   ifeq ($(feature-libbfd-buildid), 1)
     CFLAGS += -DHAVE_LIBBFD_BUILDID_SUPPORT
   else

tools/perf/Makefile.config ifdef BUILD_NONDISTRO · line 920

Quoted 10 lines
tools/perf/Makefile.config +4 -3
@@ -913,26 +914,24 @@ ifdef BUILD_NONDISTRO
   endif
 endif
 
-ifdef NO_DEMANGLE
-  CFLAGS += -DNO_DEMANGLE
-else
+ifndef NO_DEMANGLE
+  $(call feature_check,cxa-demangle)
+  ifeq ($(feature-cxa-demangle), 1)
+    EXTLIBS += -lstdc++

Hi Ian,

I think cross compilation for arm on x86 isn't working after this change (at least on Ubuntu).

Even with all of the arm64 libstdc++ stuff installed, you can only link to it using g++, but the perf build tries to link to it using gcc. Not sure it's some quirk with the search paths on Ubuntu or something else:

  $ aarch64-linux-gnu-gcc -lstdc++
   /usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-

gnu/bin/ld: cannot find -lstdc++: No such file or directory
collect2: error: ld returned 1 exit status

g++ gets further:

  $ aarch64-linux-gnu-g++ -lstdc++

...
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status

At the end of the perf build it looks like something similar is happening (with all the non interesting bits deleted):

   $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -C tools/perf
NO_BPF_SKEL=1 V=1
Quoted 8 lines

aarch64-linux-gnu-gcc ... -o perf

/usr/lib/gcc-cross/aarch64-linux-gnu/12/../../../../aarch64-linux-gnu/bin/ld:
cannot find -lstdc++: No such file or directory

If I build with NO_DEMANGLE=1 then the build works, but I think it would at be best to autodetect rather than have to do this. Or maybe even link at the end with g++ if we're going to use libstdc++?

Hi James,

sorry for the problems you are having, I'll see if I can get a repo. I did add a feature test with this change in the same set:
https://lore.kernel.org/lkml/[email protected]/
So it should be feature testing and only enabling when HAVE_CXA_DEMANGLE_SUPPORT is present. Obviously something is up, so I'll have a think about it.

Quoted 7 lines
Quoted 2 lines

Thanks,
Ian

Sorry to say I couldn't repro on Debian:

$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -C tools/perf
NO_LIBELF=1 NO_LIBTRACEEVENT=1

If you have NO_LIBELF=1 it sets NO_DEMANGLE=1 automatically so it skips the c++ linking step. If you run with V=1 you can see that it doesn't have -lstdc++ on the last link line.

But, having said that, I went to make a full reproducer in docker but it actually worked. Turns out that the issue was on my end. I'd used update-alternatives for a different compiler version and looks like I had half of one gcc and half of another g++. Completely my fault, sorry for the noise!

James

author reviewer
#22 lore raw

PATCH 10/13 perf build: Switch libpfm4 to opt-out rather than opt-in

In reply to Ian Rogers

If libpfm4 passes the feature test, it would be nice to have it enabled rather than also requiring the LIBPFM4=1 build flag.

---
 tools/perf/Makefile.config | 3 +--
 tools/perf/Makefile.perf   | 2 +-
 tools/perf/tests/make      | 4 ++--
 3 files changed, 4 insertions(+), 5 deletions(-)
tools/perf/Makefile.config +1 -2
index fdeca45cf15f..9754218bd418 100644
@@ -1130,7 +1130,7 @@ ifdef LIBCLANGLLVM
   endif
 endif
 
-ifdef LIBPFM4
+ifndef NO_LIBPFM4
   $(call feature_check,libpfm4)
   ifeq ($(feature-libpfm4), 1)
     CFLAGS += -DHAVE_LIBPFM
@@ -1139,7 +1139,6 @@ ifdef LIBPFM4
     $(call detected,CONFIG_LIBPFM4)
   else
     msg := $(warning libpfm4 not found, disables libpfm4 support. Please install libpfm4-dev);
-    NO_LIBPFM4 := 1
   endif
 endif
 
tools/perf/Makefile.perf +1 -1
index a35bc995d5d8..3e06915f6bd0 100644
@@ -122,7 +122,7 @@ include ../scripts/utilities.mak
 # generated from the kernel .tbl or unistd.h files and use, if available, libaudit
 # for doing the conversions to/from strings/id.
 #
-# Define LIBPFM4 to enable libpfm4 events extension.
+# Define NO_LIBPFM4 to disable libpfm4 events extension.
 #
 # Define NO_LIBDEBUGINFOD if you do not want support debuginfod
 #
tools/perf/tests/make +2 -2
index c2f74ed43418..47c665659022 100644
@@ -94,7 +94,7 @@ make_with_coresight := CORESIGHT=1
 make_no_sdt	    := NO_SDT=1
 make_no_syscall_tbl := NO_SYSCALL_TABLE=1
 make_with_clangllvm := LIBCLANGLLVM=1
-make_with_libpfm4   := LIBPFM4=1
+make_no_libpfm4     := NO_LIBPFM4=1
 make_with_gtk2      := GTK2=1
 make_tags           := tags
 make_cscope         := cscope
@@ -161,7 +161,7 @@ run += make_no_syscall_tbl
 run += make_with_babeltrace
 run += make_with_coresight
 run += make_with_clangllvm
-run += make_with_libpfm4
+run += make_no_libpfm4
 run += make_help
 run += make_doc
 run += make_perf_o
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
author reviewer
#23 lore raw

PATCH 11/13 perf build: If libtraceevent isn't present error the build

In reply to Ian Rogers

If libtraceevent isn't present, the build will warn and continue. This disables a number of features and so isn't desirable. This change makes the build error for this case. The build can still be made to happen by adding NO_LIBTRACEEVENT=1.

---
 tools/perf/Makefile.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.config +1 -1
index 9754218bd418..1b598c5e68eb 100644
@@ -1156,7 +1156,7 @@ ifneq ($(NO_LIBTRACEEVENT),1)
     CFLAGS += -DLIBTRACEEVENT_VERSION=$(LIBTRACEEVENT_VERSION_CPP)
     $(call detected,CONFIG_LIBTRACEEVENT)
   else
-    dummy := $(warning Warning: libtraceevent is missing limiting functionality, please install libtraceevent-dev/libtraceevent-devel)
+    dummy := $(error ERROR: libtraceevent is missing. Please install libtraceevent-dev/libtraceevent-devel or build with NO_LIBTRACEEVENT=1)
   endif
 
   $(call feature_check,libtracefs)
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
author reviewer
#24 lore raw

PATCH 12/13 tools headers: Make the difference output easier to read

In reply to Ian Rogers

Add failures to an array and display it before exiting. Before:

```
Warning: Kernel ABI header at 'tools/include/uapi/linux/fcntl.h' differs from latest version at 'include/uapi/linux/fcntl.h'
diff -u tools/include/uapi/linux/fcntl.h include/uapi/linux/fcntl.h
Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
...
```

After:

```
Warning: Kernel ABI header differences:
  tools/include/uapi/linux/fcntl.h include/uapi/linux/fcntl.h
  tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
...
```
---
 tools/perf/check-headers.sh | 229 ++++++++++++++++++++----------------
 1 file changed, 125 insertions(+), 104 deletions(-)
tools/perf/check-headers.sh +125 -104
index eacca9a874e2..f848b425d936 100755
@@ -1,113 +1,121 @@
-#!/bin/sh
+#!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 
-FILES='
-include/uapi/linux/const.h
-include/uapi/drm/drm.h
-include/uapi/drm/i915_drm.h
-include/uapi/linux/fadvise.h
-include/uapi/linux/fcntl.h
-include/uapi/linux/fs.h
-include/uapi/linux/fscrypt.h
-include/uapi/linux/kcmp.h
-include/uapi/linux/kvm.h
-include/uapi/linux/in.h
-include/uapi/linux/mount.h
-include/uapi/linux/openat2.h
-include/uapi/linux/perf_event.h
-include/uapi/linux/prctl.h
-include/uapi/linux/sched.h
-include/uapi/linux/stat.h
-include/uapi/linux/usbdevice_fs.h
-include/uapi/linux/vhost.h
-include/uapi/sound/asound.h
-include/linux/bits.h
-include/vdso/bits.h
-include/linux/const.h
-include/vdso/const.h
-include/linux/hash.h
-include/linux/list-sort.h
-include/uapi/linux/hw_breakpoint.h
-arch/x86/include/asm/disabled-features.h
-arch/x86/include/asm/required-features.h
-arch/x86/include/asm/cpufeatures.h
-arch/x86/include/asm/inat_types.h
-arch/x86/include/asm/emulate_prefix.h
-arch/x86/include/asm/irq_vectors.h
-arch/x86/include/asm/msr-index.h
-arch/x86/include/uapi/asm/prctl.h
-arch/x86/lib/x86-opcode-map.txt
-arch/x86/tools/gen-insn-attr-x86.awk
-arch/arm/include/uapi/asm/perf_regs.h
-arch/arm64/include/uapi/asm/perf_regs.h
-arch/mips/include/uapi/asm/perf_regs.h
-arch/powerpc/include/uapi/asm/perf_regs.h
-arch/s390/include/uapi/asm/perf_regs.h
-arch/x86/include/uapi/asm/perf_regs.h
-arch/x86/include/uapi/asm/kvm.h
-arch/x86/include/uapi/asm/kvm_perf.h
-arch/x86/include/uapi/asm/svm.h
-arch/x86/include/uapi/asm/unistd.h
-arch/x86/include/uapi/asm/vmx.h
-arch/powerpc/include/uapi/asm/kvm.h
-arch/s390/include/uapi/asm/kvm.h
-arch/s390/include/uapi/asm/kvm_perf.h
-arch/s390/include/uapi/asm/ptrace.h
-arch/s390/include/uapi/asm/sie.h
-arch/arm/include/uapi/asm/kvm.h
-arch/arm64/include/uapi/asm/kvm.h
-arch/arm64/include/uapi/asm/unistd.h
-arch/alpha/include/uapi/asm/errno.h
-arch/mips/include/asm/errno.h
-arch/mips/include/uapi/asm/errno.h
-arch/parisc/include/uapi/asm/errno.h
-arch/powerpc/include/uapi/asm/errno.h
-arch/sparc/include/uapi/asm/errno.h
-arch/x86/include/uapi/asm/errno.h
-include/asm-generic/bitops/arch_hweight.h
-include/asm-generic/bitops/const_hweight.h
-include/asm-generic/bitops/__fls.h
-include/asm-generic/bitops/fls.h
-include/asm-generic/bitops/fls64.h
-include/linux/coresight-pmu.h
-include/uapi/asm-generic/errno.h
-include/uapi/asm-generic/errno-base.h
-include/uapi/asm-generic/ioctls.h
-include/uapi/asm-generic/mman-common.h
-include/uapi/asm-generic/unistd.h
-'
-
-SYNC_CHECK_FILES='
-arch/x86/include/asm/inat.h
-arch/x86/include/asm/insn.h
-arch/x86/lib/inat.c
-arch/x86/lib/insn.c
-'
+YELLOW='\033[0;33m'
+NC='\033[0m' # No Color
+
+declare -a FILES
+FILES=(
+  "include/uapi/linux/const.h"
+  "include/uapi/drm/drm.h"
+  "include/uapi/drm/i915_drm.h"
+  "include/uapi/linux/fadvise.h"
+  "include/uapi/linux/fcntl.h"
+  "include/uapi/linux/fs.h"
+  "include/uapi/linux/fscrypt.h"
+  "include/uapi/linux/kcmp.h"
+  "include/uapi/linux/kvm.h"
+  "include/uapi/linux/in.h"
+  "include/uapi/linux/mount.h"
+  "include/uapi/linux/openat2.h"
+  "include/uapi/linux/perf_event.h"
+  "include/uapi/linux/prctl.h"
+  "include/uapi/linux/sched.h"
+  "include/uapi/linux/stat.h"
+  "include/uapi/linux/usbdevice_fs.h"
+  "include/uapi/linux/vhost.h"
+  "include/uapi/sound/asound.h"
+  "include/linux/bits.h"
+  "include/vdso/bits.h"
+  "include/linux/const.h"
+  "include/vdso/const.h"
+  "include/linux/hash.h"
+  "include/linux/list-sort.h"
+  "include/uapi/linux/hw_breakpoint.h"
+  "arch/x86/include/asm/disabled-features.h"
+  "arch/x86/include/asm/required-features.h"
+  "arch/x86/include/asm/cpufeatures.h"
+  "arch/x86/include/asm/inat_types.h"
+  "arch/x86/include/asm/emulate_prefix.h"
+  "arch/x86/include/asm/irq_vectors.h"
+  "arch/x86/include/asm/msr-index.h"
+  "arch/x86/include/uapi/asm/prctl.h"
+  "arch/x86/lib/x86-opcode-map.txt"
+  "arch/x86/tools/gen-insn-attr-x86.awk"
+  "arch/arm/include/uapi/asm/perf_regs.h"
+  "arch/arm64/include/uapi/asm/perf_regs.h"
+  "arch/mips/include/uapi/asm/perf_regs.h"
+  "arch/powerpc/include/uapi/asm/perf_regs.h"
+  "arch/s390/include/uapi/asm/perf_regs.h"
+  "arch/x86/include/uapi/asm/perf_regs.h"
+  "arch/x86/include/uapi/asm/kvm.h"
+  "arch/x86/include/uapi/asm/kvm_perf.h"
+  "arch/x86/include/uapi/asm/svm.h"
+  "arch/x86/include/uapi/asm/unistd.h"
+  "arch/x86/include/uapi/asm/vmx.h"
+  "arch/powerpc/include/uapi/asm/kvm.h"
+  "arch/s390/include/uapi/asm/kvm.h"
+  "arch/s390/include/uapi/asm/kvm_perf.h"
+  "arch/s390/include/uapi/asm/ptrace.h"
+  "arch/s390/include/uapi/asm/sie.h"
+  "arch/arm/include/uapi/asm/kvm.h"
+  "arch/arm64/include/uapi/asm/kvm.h"
+  "arch/arm64/include/uapi/asm/unistd.h"
+  "arch/alpha/include/uapi/asm/errno.h"
+  "arch/mips/include/asm/errno.h"
+  "arch/mips/include/uapi/asm/errno.h"
+  "arch/parisc/include/uapi/asm/errno.h"
+  "arch/powerpc/include/uapi/asm/errno.h"
+  "arch/sparc/include/uapi/asm/errno.h"
+  "arch/x86/include/uapi/asm/errno.h"
+  "include/asm-generic/bitops/arch_hweight.h"
+  "include/asm-generic/bitops/const_hweight.h"
+  "include/asm-generic/bitops/__fls.h"
+  "include/asm-generic/bitops/fls.h"
+  "include/asm-generic/bitops/fls64.h"
+  "include/linux/coresight-pmu.h"
+  "include/uapi/asm-generic/errno.h"
+  "include/uapi/asm-generic/errno-base.h"
+  "include/uapi/asm-generic/ioctls.h"
+  "include/uapi/asm-generic/mman-common.h"
+  "include/uapi/asm-generic/unistd.h"
+)
+
+declare -a SYNC_CHECK_FILES
+SYNC_CHECK_FILES=(
+  "arch/x86/include/asm/inat.h"
+  "arch/x86/include/asm/insn.h"
+  "arch/x86/lib/inat.c"
+  "arch/x86/lib/insn.c"
+)
 
 # These copies are under tools/perf/trace/beauty/ as they are not used to in
 # building object files only by scripts in tools/perf/trace/beauty/ to generate
 # tables that then gets included in .c files for things like id->string syscall
 # tables (and the reverse lookup as well: string -> id)
 
-BEAUTY_FILES='
-include/linux/socket.h
-'
+declare -a BEAUTY_FILES
+BEAUTY_FILES=(
+  "include/linux/socket.h"
+)
+
+declare -a FAILURES
 
 check_2 () {
-  file1=$1
-  file2=$2
+  tools_file=$1
+  orig_file=$2
 
   shift
   shift
 
-  cmd="diff $* $file1 $file2 > /dev/null"
+  cmd="diff $* $tools_file $orig_file > /dev/null"
 
-  test -f $file2 && {
-    eval $cmd || {
-      echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2
-      echo diff -u $file1 $file2
-    }
-  }
+  if [ -f "$orig_file" ] && ! eval "$cmd"
+  then
+    FAILURES+=(
+      "$tools_file $orig_file"
+    )
+  fi
 }
 
 check () {
@@ -115,7 +123,7 @@ check () {
 
   shift
 
-  check_2 tools/$file $file $*
+  check_2 "tools/$file" "$file" $*
 }
 
 beauty_check () {
@@ -123,23 +131,29 @@ beauty_check () {
 
   shift
 
-  check_2 tools/perf/trace/beauty/$file $file $*
+  check_2 "tools/perf/trace/beauty/$file" "$file" $*
 }
 
 # Check if we have the kernel headers (tools/perf/../../include), else
 # we're probably on a detached tarball, so no point in trying to check
 # differences.
-test -d ../../include || exit 0
+if ! [ -d ../../include ]
+then
+  echo -e "${YELLOW}Warning${NC}: Skipped check-headers due to missing ../../include"
+  exit 0
+fi
 
 cd ../..
 
 # simple diff check
-for i in $FILES; do
-  check $i -B
+for i in "${FILES[@]}"
+do
+  check "$i" -B
 done
 
-for i in $SYNC_CHECK_FILES; do
-  check $i '-I "^.*\/\*.*__ignore_sync_check__.*\*\/.*$"'
+for i in "${SYNC_CHECK_FILES[@]}"
+do
+  check "$i" '-I "^.*\/\*.*__ignore_sync_check__.*\*\/.*$"'
 done
 
 # diff with extra ignore lines
@@ -160,8 +174,9 @@ check_2 tools/perf/arch/powerpc/entry/syscalls/syscall.tbl arch/powerpc/kernel/s
 check_2 tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/s390/kernel/syscalls/syscall.tbl
 check_2 tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl arch/mips/kernel/syscalls/syscall_n64.tbl
 
-for i in $BEAUTY_FILES; do
-  beauty_check $i -B
+for i in "${BEAUTY_FILES[@]}"
+do
+  beauty_check "$i" -B
 done
 
 # check duplicated library files
@@ -169,3 +184,9 @@ check_2 tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h
 check_2 tools/perf/util/hashmap.c tools/lib/bpf/hashmap.c
 
 cd tools/perf
+
+echo -e "${YELLOW}Warning${NC}: Kernel ABI header differences:"
+for i in "${FAILURES[@]}"
+do
+  echo "  $i"
+done
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
#25 lore raw

Re: [PATCH v1 12/13] tools headers: Make the difference output easier to read

Em Fri, Mar 10, 2023 at 10:57:52PM -0800, Ian Rogers escreveu:

Quoted 10 lines

Add failures to an array and display it before exiting. Before:

```
Warning: Kernel ABI header at 'tools/include/uapi/linux/fcntl.h' differs from latest version at 'include/uapi/linux/fcntl.h'
diff -u tools/include/uapi/linux/fcntl.h include/uapi/linux/fcntl.h
Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
...
```
Quoted 5 lines

After:
```
Warning: Kernel ABI header differences:
tools/include/uapi/linux/fcntl.h include/uapi/linux/fcntl.h tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h

I use that diff line to cut and paste, check the errors, etc.

- Arnaldo

Quoted 299 lines

...
```

---
 tools/perf/check-headers.sh | 229 ++++++++++++++++++++----------------
 1 file changed, 125 insertions(+), 104 deletions(-)
tools/perf/check-headers.sh +125 -104
index eacca9a874e2..f848b425d936 100755
@@ -1,113 +1,121 @@
-#!/bin/sh
+#!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 
-FILES='
-include/uapi/linux/const.h
-include/uapi/drm/drm.h
-include/uapi/drm/i915_drm.h
-include/uapi/linux/fadvise.h
-include/uapi/linux/fcntl.h
-include/uapi/linux/fs.h
-include/uapi/linux/fscrypt.h
-include/uapi/linux/kcmp.h
-include/uapi/linux/kvm.h
-include/uapi/linux/in.h
-include/uapi/linux/mount.h
-include/uapi/linux/openat2.h
-include/uapi/linux/perf_event.h
-include/uapi/linux/prctl.h
-include/uapi/linux/sched.h
-include/uapi/linux/stat.h
-include/uapi/linux/usbdevice_fs.h
-include/uapi/linux/vhost.h
-include/uapi/sound/asound.h
-include/linux/bits.h
-include/vdso/bits.h
-include/linux/const.h
-include/vdso/const.h
-include/linux/hash.h
-include/linux/list-sort.h
-include/uapi/linux/hw_breakpoint.h
-arch/x86/include/asm/disabled-features.h
-arch/x86/include/asm/required-features.h
-arch/x86/include/asm/cpufeatures.h
-arch/x86/include/asm/inat_types.h
-arch/x86/include/asm/emulate_prefix.h
-arch/x86/include/asm/irq_vectors.h
-arch/x86/include/asm/msr-index.h
-arch/x86/include/uapi/asm/prctl.h
-arch/x86/lib/x86-opcode-map.txt
-arch/x86/tools/gen-insn-attr-x86.awk
-arch/arm/include/uapi/asm/perf_regs.h
-arch/arm64/include/uapi/asm/perf_regs.h
-arch/mips/include/uapi/asm/perf_regs.h
-arch/powerpc/include/uapi/asm/perf_regs.h
-arch/s390/include/uapi/asm/perf_regs.h
-arch/x86/include/uapi/asm/perf_regs.h
-arch/x86/include/uapi/asm/kvm.h
-arch/x86/include/uapi/asm/kvm_perf.h
-arch/x86/include/uapi/asm/svm.h
-arch/x86/include/uapi/asm/unistd.h
-arch/x86/include/uapi/asm/vmx.h
-arch/powerpc/include/uapi/asm/kvm.h
-arch/s390/include/uapi/asm/kvm.h
-arch/s390/include/uapi/asm/kvm_perf.h
-arch/s390/include/uapi/asm/ptrace.h
-arch/s390/include/uapi/asm/sie.h
-arch/arm/include/uapi/asm/kvm.h
-arch/arm64/include/uapi/asm/kvm.h
-arch/arm64/include/uapi/asm/unistd.h
-arch/alpha/include/uapi/asm/errno.h
-arch/mips/include/asm/errno.h
-arch/mips/include/uapi/asm/errno.h
-arch/parisc/include/uapi/asm/errno.h
-arch/powerpc/include/uapi/asm/errno.h
-arch/sparc/include/uapi/asm/errno.h
-arch/x86/include/uapi/asm/errno.h
-include/asm-generic/bitops/arch_hweight.h
-include/asm-generic/bitops/const_hweight.h
-include/asm-generic/bitops/__fls.h
-include/asm-generic/bitops/fls.h
-include/asm-generic/bitops/fls64.h
-include/linux/coresight-pmu.h
-include/uapi/asm-generic/errno.h
-include/uapi/asm-generic/errno-base.h
-include/uapi/asm-generic/ioctls.h
-include/uapi/asm-generic/mman-common.h
-include/uapi/asm-generic/unistd.h
-'
-
-SYNC_CHECK_FILES='
-arch/x86/include/asm/inat.h
-arch/x86/include/asm/insn.h
-arch/x86/lib/inat.c
-arch/x86/lib/insn.c
-'
+YELLOW='\033[0;33m'
+NC='\033[0m' # No Color
+
+declare -a FILES
+FILES=(
+  "include/uapi/linux/const.h"
+  "include/uapi/drm/drm.h"
+  "include/uapi/drm/i915_drm.h"
+  "include/uapi/linux/fadvise.h"
+  "include/uapi/linux/fcntl.h"
+  "include/uapi/linux/fs.h"
+  "include/uapi/linux/fscrypt.h"
+  "include/uapi/linux/kcmp.h"
+  "include/uapi/linux/kvm.h"
+  "include/uapi/linux/in.h"
+  "include/uapi/linux/mount.h"
+  "include/uapi/linux/openat2.h"
+  "include/uapi/linux/perf_event.h"
+  "include/uapi/linux/prctl.h"
+  "include/uapi/linux/sched.h"
+  "include/uapi/linux/stat.h"
+  "include/uapi/linux/usbdevice_fs.h"
+  "include/uapi/linux/vhost.h"
+  "include/uapi/sound/asound.h"
+  "include/linux/bits.h"
+  "include/vdso/bits.h"
+  "include/linux/const.h"
+  "include/vdso/const.h"
+  "include/linux/hash.h"
+  "include/linux/list-sort.h"
+  "include/uapi/linux/hw_breakpoint.h"
+  "arch/x86/include/asm/disabled-features.h"
+  "arch/x86/include/asm/required-features.h"
+  "arch/x86/include/asm/cpufeatures.h"
+  "arch/x86/include/asm/inat_types.h"
+  "arch/x86/include/asm/emulate_prefix.h"
+  "arch/x86/include/asm/irq_vectors.h"
+  "arch/x86/include/asm/msr-index.h"
+  "arch/x86/include/uapi/asm/prctl.h"
+  "arch/x86/lib/x86-opcode-map.txt"
+  "arch/x86/tools/gen-insn-attr-x86.awk"
+  "arch/arm/include/uapi/asm/perf_regs.h"
+  "arch/arm64/include/uapi/asm/perf_regs.h"
+  "arch/mips/include/uapi/asm/perf_regs.h"
+  "arch/powerpc/include/uapi/asm/perf_regs.h"
+  "arch/s390/include/uapi/asm/perf_regs.h"
+  "arch/x86/include/uapi/asm/perf_regs.h"
+  "arch/x86/include/uapi/asm/kvm.h"
+  "arch/x86/include/uapi/asm/kvm_perf.h"
+  "arch/x86/include/uapi/asm/svm.h"
+  "arch/x86/include/uapi/asm/unistd.h"
+  "arch/x86/include/uapi/asm/vmx.h"
+  "arch/powerpc/include/uapi/asm/kvm.h"
+  "arch/s390/include/uapi/asm/kvm.h"
+  "arch/s390/include/uapi/asm/kvm_perf.h"
+  "arch/s390/include/uapi/asm/ptrace.h"
+  "arch/s390/include/uapi/asm/sie.h"
+  "arch/arm/include/uapi/asm/kvm.h"
+  "arch/arm64/include/uapi/asm/kvm.h"
+  "arch/arm64/include/uapi/asm/unistd.h"
+  "arch/alpha/include/uapi/asm/errno.h"
+  "arch/mips/include/asm/errno.h"
+  "arch/mips/include/uapi/asm/errno.h"
+  "arch/parisc/include/uapi/asm/errno.h"
+  "arch/powerpc/include/uapi/asm/errno.h"
+  "arch/sparc/include/uapi/asm/errno.h"
+  "arch/x86/include/uapi/asm/errno.h"
+  "include/asm-generic/bitops/arch_hweight.h"
+  "include/asm-generic/bitops/const_hweight.h"
+  "include/asm-generic/bitops/__fls.h"
+  "include/asm-generic/bitops/fls.h"
+  "include/asm-generic/bitops/fls64.h"
+  "include/linux/coresight-pmu.h"
+  "include/uapi/asm-generic/errno.h"
+  "include/uapi/asm-generic/errno-base.h"
+  "include/uapi/asm-generic/ioctls.h"
+  "include/uapi/asm-generic/mman-common.h"
+  "include/uapi/asm-generic/unistd.h"
+)
+
+declare -a SYNC_CHECK_FILES
+SYNC_CHECK_FILES=(
+  "arch/x86/include/asm/inat.h"
+  "arch/x86/include/asm/insn.h"
+  "arch/x86/lib/inat.c"
+  "arch/x86/lib/insn.c"
+)
 
 # These copies are under tools/perf/trace/beauty/ as they are not used to in
 # building object files only by scripts in tools/perf/trace/beauty/ to generate
 # tables that then gets included in .c files for things like id->string syscall
 # tables (and the reverse lookup as well: string -> id)
 
-BEAUTY_FILES='
-include/linux/socket.h
-'
+declare -a BEAUTY_FILES
+BEAUTY_FILES=(
+  "include/linux/socket.h"
+)
+
+declare -a FAILURES
 
 check_2 () {
-  file1=$1
-  file2=$2
+  tools_file=$1
+  orig_file=$2
 
   shift
   shift
 
-  cmd="diff $* $file1 $file2 > /dev/null"
+  cmd="diff $* $tools_file $orig_file > /dev/null"
 
-  test -f $file2 && {
-    eval $cmd || {
-      echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2
-      echo diff -u $file1 $file2
-    }
-  }
+  if [ -f "$orig_file" ] && ! eval "$cmd"
+  then
+    FAILURES+=(
+      "$tools_file $orig_file"
+    )
+  fi
 }
 
 check () {
@@ -115,7 +123,7 @@ check () {
 
   shift
 
-  check_2 tools/$file $file $*
+  check_2 "tools/$file" "$file" $*
 }
 
 beauty_check () {
@@ -123,23 +131,29 @@ beauty_check () {
 
   shift
 
-  check_2 tools/perf/trace/beauty/$file $file $*
+  check_2 "tools/perf/trace/beauty/$file" "$file" $*
 }
 
 # Check if we have the kernel headers (tools/perf/../../include), else
 # we're probably on a detached tarball, so no point in trying to check
 # differences.
-test -d ../../include || exit 0
+if ! [ -d ../../include ]
+then
+  echo -e "${YELLOW}Warning${NC}: Skipped check-headers due to missing ../../include"
+  exit 0
+fi
 
 cd ../..
 
 # simple diff check
-for i in $FILES; do
-  check $i -B
+for i in "${FILES[@]}"
+do
+  check "$i" -B
 done
 
-for i in $SYNC_CHECK_FILES; do
-  check $i '-I "^.*\/\*.*__ignore_sync_check__.*\*\/.*$"'
+for i in "${SYNC_CHECK_FILES[@]}"
+do
+  check "$i" '-I "^.*\/\*.*__ignore_sync_check__.*\*\/.*$"'
 done
 
 # diff with extra ignore lines
@@ -160,8 +174,9 @@ check_2 tools/perf/arch/powerpc/entry/syscalls/syscall.tbl arch/powerpc/kernel/s
 check_2 tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/s390/kernel/syscalls/syscall.tbl
 check_2 tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl arch/mips/kernel/syscalls/syscall_n64.tbl
 
-for i in $BEAUTY_FILES; do
-  beauty_check $i -B
+for i in "${BEAUTY_FILES[@]}"
+do
+  beauty_check "$i" -B
 done
 
 # check duplicated library files
@@ -169,3 +184,9 @@ check_2 tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h
 check_2 tools/perf/util/hashmap.c tools/lib/bpf/hashmap.c
 
 cd tools/perf
+
+echo -e "${YELLOW}Warning${NC}: Kernel ABI header differences:"
+for i in "${FAILURES[@]}"
+do
+  echo "  $i"
+done
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
Signature · 1 line
- Arnaldo
author reviewer
#26 lore raw

Re: [PATCH v1 12/13] tools headers: Make the difference output easier to read

Quoted 18 lines · Arnaldo Carvalho de Melo

Em Fri, Mar 10, 2023 at 10:57:52PM -0800, Ian Rogers escreveu:

Quoted 10 lines

Add failures to an array and display it before exiting. Before:

```
Warning: Kernel ABI header at 'tools/include/uapi/linux/fcntl.h' differs from latest version at 'include/uapi/linux/fcntl.h'
diff -u tools/include/uapi/linux/fcntl.h include/uapi/linux/fcntl.h
Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
...
```
Quoted 5 lines

After:
```
Warning: Kernel ABI header differences:
tools/include/uapi/linux/fcntl.h include/uapi/linux/fcntl.h tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h

Quoted 3 lines

I use that diff line to cut and paste, check the errors, etc.

- Arnaldo

Sure, you can do something similar here but you need to add "diff -u" at the beginning of the line. We could add a flag to the tool to do the diff for you. The current 1st warning line is ~120characters long and wraps onto 2 lines for me, the diff makes this 3 lines. Overall I struggle to see the Makefile.config warnings because of all the check-headers.sh warnings and the indent makes the grouping, check-headers.sh vs other warnings/error, easier to see.

Compare the new output:

```
Warning: Kernel ABI header differences:
 tools/include/uapi/linux/fcntl.h include/uapi/linux/fcntl.h
 tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
 tools/include/uapi/linux/in.h include/uapi/linux/in.h
 tools/include/uapi/linux/perf_event.h include/uapi/linux/perf_event.h
 tools/include/uapi/linux/prctl.h include/uapi/linux/prctl.h
 tools/include/uapi/linux/vhost.h include/uapi/linux/vhost.h
 tools/include/linux/bits.h include/linux/bits.h
 tools/include/vdso/bits.h include/vdso/bits.h
 tools/arch/x86/include/asm/disabled-features.h
arch/x86/include/asm/disabled-features.h
 tools/arch/x86/include/asm/required-features.h
arch/x86/include/asm/required-features.h
 tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
 tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
 tools/arch/arm64/include/uapi/asm/perf_regs.h
arch/arm64/include/uapi/asm/perf_regs.h
 tools/arch/x86/include/uapi/asm/kvm.h arch/x86/include/uapi/asm/kvm.h
 tools/arch/x86/include/uapi/asm/svm.h arch/x86/include/uapi/asm/svm.h
 tools/arch/arm64/include/uapi/asm/kvm.h arch/arm64/include/uapi/asm/kvm.h
 tools/include/linux/coresight-pmu.h include/linux/coresight-pmu.h
 tools/arch/x86/lib/memcpy_64.S arch/x86/lib/memcpy_64.S
 tools/arch/x86/lib/memset_64.S arch/x86/lib/memset_64.S
Makefile.config:587: No sys/sdt.h found, no SDT events are defined,
please install systemtap-sdt-dev
el or systemtap-sdt-dev
Makefile.config:635: No libunwind found. Please install
libunwind-dev[el] >= 1.1 and/or set LIBUNWIN
D_DIR
Makefile.config:805: Missing perl devel files. Disabling perl
scripting support, please install perl
-ExtUtils-Embed/libperl-dev
Makefile.config:963: No libzstd found, disables trace compression,
please install libzstd-dev[el] an
d/or set LIBZSTD_DIR
Makefile.config:974: No libcap found, disables capability support,
please install libcap-devel/libca
p-dev
Makefile.config:987: No numa.h found, disables 'perf bench numa mem'
benchmark, please install numac
tl-devel/libnuma-devel/libnuma-dev
Makefile.config:1046: No libbabeltrace found, disables 'perf data' CTF
format support, please instal
l libbabeltrace-dev[el]/libbabeltrace-ctf-dev

Auto-detecting system features:
...                                   dwarf: [ on  ]
...                      dwarf_getlocations: [ on  ]
...
```

with

```
Warning: Kernel ABI header at 'tools/include/uapi/linux/in.h' differs
from latest version at 'includ
e/uapi/linux/in.h'
diff -u tools/include/uapi/linux/in.h include/uapi/linux/in.h
Warning: Kernel ABI header at
'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version
at 'arch/x86/include/asm/cpufeatures.h'
diff -u tools/arch/x86/include/asm/cpufeatures.h
arch/x86/include/asm/cpufeatures.h
Warning: Kernel ABI header at
'tools/arch/arm64/include/uapi/asm/perf_regs.h' differs from latest ve
rsion at 'arch/arm64/include/uapi/asm/perf_regs.h'
diff -u tools/arch/arm64/include/uapi/asm/perf_regs.h
arch/arm64/include/uapi/asm/perf_regs.h
Warning: Kernel ABI header at 'tools/include/linux/coresight-pmu.h'
differs from latest version at '
include/linux/coresight-pmu.h'
diff -u tools/include/linux/coresight-pmu.h include/linux/coresight-pmu.h
Makefile.config:587: No sys/sdt.h found, no SDT events are defined,
please install systemtap-sdt-dev
el or systemtap-sdt-dev
Makefile.config:635: No libunwind found. Please install
libunwind-dev[el] >= 1.1 and/or set LIBUNWIN
D_DIR
Makefile.config:809: Missing perl devel files. Disabling perl
scripting support, please install perl
-ExtUtils-Embed/libperl-dev
Makefile.config:967: No libzstd found, disables trace compression,
please install libzstd-dev[el] an
d/or set LIBZSTD_DIR
Makefile.config:978: No libcap found, disables capability support,
please install libcap-devel/libca
p-dev
Makefile.config:991: No numa.h found, disables 'perf bench numa mem'
benchmark, please install numac
tl-devel/libnuma-devel/libnuma-dev
Makefile.config:1050: No libbabeltrace found, disables 'perf data' CTF
format support, please instal
l libbabeltrace-dev[el]/libbabeltrace-ctf-dev

Auto-detecting system features:
...                                   dwarf: [ on  ]
...                      dwarf_getlocations: [ on  ]
...
```

That said there are more warnings with the new code, which looks like some of the filters have kept working as they should :-)

Thanks,
Ian

Quoted 303 lines
Quoted 297 lines

...
```

---
 tools/perf/check-headers.sh | 229 ++++++++++++++++++++----------------
 1 file changed, 125 insertions(+), 104 deletions(-)
tools/perf/check-headers.sh +125 -105
index eacca9a874e2..f848b425d936 100755
@@ -1,113 +1,121 @@
-#!/bin/sh
+#!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 
-FILES='
-include/uapi/linux/const.h
-include/uapi/drm/drm.h
-include/uapi/drm/i915_drm.h
-include/uapi/linux/fadvise.h
-include/uapi/linux/fcntl.h
-include/uapi/linux/fs.h
-include/uapi/linux/fscrypt.h
-include/uapi/linux/kcmp.h
-include/uapi/linux/kvm.h
-include/uapi/linux/in.h
-include/uapi/linux/mount.h
-include/uapi/linux/openat2.h
-include/uapi/linux/perf_event.h
-include/uapi/linux/prctl.h
-include/uapi/linux/sched.h
-include/uapi/linux/stat.h
-include/uapi/linux/usbdevice_fs.h
-include/uapi/linux/vhost.h
-include/uapi/sound/asound.h
-include/linux/bits.h
-include/vdso/bits.h
-include/linux/const.h
-include/vdso/const.h
-include/linux/hash.h
-include/linux/list-sort.h
-include/uapi/linux/hw_breakpoint.h
-arch/x86/include/asm/disabled-features.h
-arch/x86/include/asm/required-features.h
-arch/x86/include/asm/cpufeatures.h
-arch/x86/include/asm/inat_types.h
-arch/x86/include/asm/emulate_prefix.h
-arch/x86/include/asm/irq_vectors.h
-arch/x86/include/asm/msr-index.h
-arch/x86/include/uapi/asm/prctl.h
-arch/x86/lib/x86-opcode-map.txt
-arch/x86/tools/gen-insn-attr-x86.awk
-arch/arm/include/uapi/asm/perf_regs.h
-arch/arm64/include/uapi/asm/perf_regs.h
-arch/mips/include/uapi/asm/perf_regs.h
-arch/powerpc/include/uapi/asm/perf_regs.h
-arch/s390/include/uapi/asm/perf_regs.h
-arch/x86/include/uapi/asm/perf_regs.h
-arch/x86/include/uapi/asm/kvm.h
-arch/x86/include/uapi/asm/kvm_perf.h
-arch/x86/include/uapi/asm/svm.h
-arch/x86/include/uapi/asm/unistd.h
-arch/x86/include/uapi/asm/vmx.h
-arch/powerpc/include/uapi/asm/kvm.h
-arch/s390/include/uapi/asm/kvm.h
-arch/s390/include/uapi/asm/kvm_perf.h
-arch/s390/include/uapi/asm/ptrace.h
-arch/s390/include/uapi/asm/sie.h
-arch/arm/include/uapi/asm/kvm.h
-arch/arm64/include/uapi/asm/kvm.h
-arch/arm64/include/uapi/asm/unistd.h
-arch/alpha/include/uapi/asm/errno.h
-arch/mips/include/asm/errno.h
-arch/mips/include/uapi/asm/errno.h
-arch/parisc/include/uapi/asm/errno.h
-arch/powerpc/include/uapi/asm/errno.h
-arch/sparc/include/uapi/asm/errno.h
-arch/x86/include/uapi/asm/errno.h
-include/asm-generic/bitops/arch_hweight.h
-include/asm-generic/bitops/const_hweight.h
-include/asm-generic/bitops/__fls.h
-include/asm-generic/bitops/fls.h
-include/asm-generic/bitops/fls64.h
-include/linux/coresight-pmu.h
-include/uapi/asm-generic/errno.h
-include/uapi/asm-generic/errno-base.h
-include/uapi/asm-generic/ioctls.h
-include/uapi/asm-generic/mman-common.h
-include/uapi/asm-generic/unistd.h
-'
-
-SYNC_CHECK_FILES='
-arch/x86/include/asm/inat.h
-arch/x86/include/asm/insn.h
-arch/x86/lib/inat.c
-arch/x86/lib/insn.c
-'
+YELLOW='\033[0;33m'
+NC='\033[0m' # No Color
+
+declare -a FILES
+FILES=(
+  "include/uapi/linux/const.h"
+  "include/uapi/drm/drm.h"
+  "include/uapi/drm/i915_drm.h"
+  "include/uapi/linux/fadvise.h"
+  "include/uapi/linux/fcntl.h"
+  "include/uapi/linux/fs.h"
+  "include/uapi/linux/fscrypt.h"
+  "include/uapi/linux/kcmp.h"
+  "include/uapi/linux/kvm.h"
+  "include/uapi/linux/in.h"
+  "include/uapi/linux/mount.h"
+  "include/uapi/linux/openat2.h"
+  "include/uapi/linux/perf_event.h"
+  "include/uapi/linux/prctl.h"
+  "include/uapi/linux/sched.h"
+  "include/uapi/linux/stat.h"
+  "include/uapi/linux/usbdevice_fs.h"
+  "include/uapi/linux/vhost.h"
+  "include/uapi/sound/asound.h"
+  "include/linux/bits.h"
+  "include/vdso/bits.h"
+  "include/linux/const.h"
+  "include/vdso/const.h"
+  "include/linux/hash.h"
+  "include/linux/list-sort.h"
+  "include/uapi/linux/hw_breakpoint.h"
+  "arch/x86/include/asm/disabled-features.h"
+  "arch/x86/include/asm/required-features.h"
+  "arch/x86/include/asm/cpufeatures.h"
+  "arch/x86/include/asm/inat_types.h"
+  "arch/x86/include/asm/emulate_prefix.h"
+  "arch/x86/include/asm/irq_vectors.h"
+  "arch/x86/include/asm/msr-index.h"
+  "arch/x86/include/uapi/asm/prctl.h"
+  "arch/x86/lib/x86-opcode-map.txt"
+  "arch/x86/tools/gen-insn-attr-x86.awk"
+  "arch/arm/include/uapi/asm/perf_regs.h"
+  "arch/arm64/include/uapi/asm/perf_regs.h"
+  "arch/mips/include/uapi/asm/perf_regs.h"
+  "arch/powerpc/include/uapi/asm/perf_regs.h"
+  "arch/s390/include/uapi/asm/perf_regs.h"
+  "arch/x86/include/uapi/asm/perf_regs.h"
+  "arch/x86/include/uapi/asm/kvm.h"
+  "arch/x86/include/uapi/asm/kvm_perf.h"
+  "arch/x86/include/uapi/asm/svm.h"
+  "arch/x86/include/uapi/asm/unistd.h"
+  "arch/x86/include/uapi/asm/vmx.h"
+  "arch/powerpc/include/uapi/asm/kvm.h"
+  "arch/s390/include/uapi/asm/kvm.h"
+  "arch/s390/include/uapi/asm/kvm_perf.h"
+  "arch/s390/include/uapi/asm/ptrace.h"
+  "arch/s390/include/uapi/asm/sie.h"
+  "arch/arm/include/uapi/asm/kvm.h"
+  "arch/arm64/include/uapi/asm/kvm.h"
+  "arch/arm64/include/uapi/asm/unistd.h"
+  "arch/alpha/include/uapi/asm/errno.h"
+  "arch/mips/include/asm/errno.h"
+  "arch/mips/include/uapi/asm/errno.h"
+  "arch/parisc/include/uapi/asm/errno.h"
+  "arch/powerpc/include/uapi/asm/errno.h"
+  "arch/sparc/include/uapi/asm/errno.h"
+  "arch/x86/include/uapi/asm/errno.h"
+  "include/asm-generic/bitops/arch_hweight.h"
+  "include/asm-generic/bitops/const_hweight.h"
+  "include/asm-generic/bitops/__fls.h"
+  "include/asm-generic/bitops/fls.h"
+  "include/asm-generic/bitops/fls64.h"
+  "include/linux/coresight-pmu.h"
+  "include/uapi/asm-generic/errno.h"
+  "include/uapi/asm-generic/errno-base.h"
+  "include/uapi/asm-generic/ioctls.h"
+  "include/uapi/asm-generic/mman-common.h"
+  "include/uapi/asm-generic/unistd.h"
+)
+
+declare -a SYNC_CHECK_FILES
+SYNC_CHECK_FILES=(
+  "arch/x86/include/asm/inat.h"
+  "arch/x86/include/asm/insn.h"
+  "arch/x86/lib/inat.c"
+  "arch/x86/lib/insn.c"
+)
 
 # These copies are under tools/perf/trace/beauty/ as they are not used to in
 # building object files only by scripts in tools/perf/trace/beauty/ to generate
 # tables that then gets included in .c files for things like id->string syscall
 # tables (and the reverse lookup as well: string -> id)
 
-BEAUTY_FILES='
-include/linux/socket.h
-'
+declare -a BEAUTY_FILES
+BEAUTY_FILES=(
+  "include/linux/socket.h"
+)
+
+declare -a FAILURES
 
 check_2 () {
-  file1=$1
-  file2=$2
+  tools_file=$1
+  orig_file=$2
 
   shift
   shift
 
-  cmd="diff $* $file1 $file2 > /dev/null"
+  cmd="diff $* $tools_file $orig_file > /dev/null"
 
-  test -f $file2 && {
-    eval $cmd || {
-      echo "Warning: Kernel ABI header at '$file1' differs from latest version at '$file2'" >&2
-      echo diff -u $file1 $file2
-    }
-  }
+  if [ -f "$orig_file" ] && ! eval "$cmd"
+  then
+    FAILURES+=(
+      "$tools_file $orig_file"
+    )
+  fi
 }
 
 check () {
@@ -115,7 +123,7 @@ check () {
 
   shift
 
-  check_2 tools/$file $file $*
+  check_2 "tools/$file" "$file" $*
 }
 
 beauty_check () {
@@ -123,23 +131,29 @@ beauty_check () {
 
   shift
 
-  check_2 tools/perf/trace/beauty/$file $file $*
+  check_2 "tools/perf/trace/beauty/$file" "$file" $*
 }
 
 # Check if we have the kernel headers (tools/perf/../../include), else
 # we're probably on a detached tarball, so no point in trying to check
 # differences.
-test -d ../../include || exit 0
+if ! [ -d ../../include ]
+then
+  echo -e "${YELLOW}Warning${NC}: Skipped check-headers due to missing ../../include"
+  exit 0
+fi
 
 cd ../..
 
 # simple diff check
-for i in $FILES; do
-  check $i -B
+for i in "${FILES[@]}"
+do
+  check "$i" -B
 done
 
-for i in $SYNC_CHECK_FILES; do
-  check $i '-I "^.*\/\*.*__ignore_sync_check__.*\*\/.*$"'
+for i in "${SYNC_CHECK_FILES[@]}"
+do
+  check "$i" '-I "^.*\/\*.*__ignore_sync_check__.*\*\/.*$"'
 done
 
 # diff with extra ignore lines
@@ -160,8 +174,9 @@ check_2 tools/perf/arch/powerpc/entry/syscalls/syscall.tbl arch/powerpc/kernel/s
 check_2 tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/s390/kernel/syscalls/syscall.tbl
 check_2 tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl arch/mips/kernel/syscalls/syscall_n64.tbl
 
-for i in $BEAUTY_FILES; do
-  beauty_check $i -B
+for i in "${BEAUTY_FILES[@]}"
+do
+  beauty_check "$i" -B
 done
 
 # check duplicated library files
@@ -169,3 +184,9 @@ check_2 tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h
 check_2 tools/perf/util/hashmap.c tools/lib/bpf/hashmap.c
 
 cd tools/perf
+
+echo -e "${YELLOW}Warning${NC}: Kernel ABI header differences:"
+for i in "${FAILURES[@]}"
+do
+  echo "  $i"
+done
--
Quoted 2 lines

2.40.0.rc1.284.g88254d51c5-goog

--

- Arnaldo

author reviewer
#27 lore raw

PATCH 13/13 perf build: Remove redundant NO_NEWT build option

In reply to Ian Rogers

The option controlled nothing and no code depends, conditional or otherwise, on libnewt.

---
 tools/perf/Makefile.config | 4 ----
 tools/perf/Makefile.perf   | 2 --
 tools/perf/tests/make      | 6 ++----
 3 files changed, 2 insertions(+), 10 deletions(-)
tools/perf/Makefile.config +0 -4
index 1b598c5e68eb..b7a9cb4a3526 100644
@@ -752,10 +752,6 @@ ifndef NO_LIBCRYPTO
   endif
 endif
 
-ifdef NO_NEWT
-  NO_SLANG=1
-endif
-
 ifndef NO_SLANG
   ifneq ($(feature-libslang), 1)
     ifneq ($(feature-libslang-include-subdir), 1)
tools/perf/Makefile.perf +0 -2
index 3e06915f6bd0..dc9dda09b076 100644
@@ -44,8 +44,6 @@ include ../scripts/utilities.mak
 #
 # Define WERROR=0 to disable treating any warnings as errors.
 #
-# Define NO_NEWT if you do not want TUI support. (deprecated)
-#
 # Define NO_SLANG if you do not want TUI support.
 #
 # Define GTK2 if you want GTK+ GUI support.
tools/perf/tests/make +2 -4
index 47c665659022..a74b4be446c6 100644
@@ -72,10 +72,9 @@ make_nondistro      := BUILD_NONDISTRO=1
 make_no_libperl     := NO_LIBPERL=1
 make_no_libpython   := NO_LIBPYTHON=1
 make_no_scripts     := NO_LIBPYTHON=1 NO_LIBPERL=1
-make_no_newt        := NO_NEWT=1
 make_no_slang       := NO_SLANG=1
 make_no_gtk2        := NO_GTK2=1
-make_no_ui          := NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
+make_no_ui          := NO_SLANG=1 NO_GTK2=1
 make_no_demangle    := NO_DEMANGLE=1
 make_no_libelf      := NO_LIBELF=1
 make_no_libunwind   := NO_LIBUNWIND=1
@@ -115,7 +114,7 @@ make_install_prefix_slash := install prefix=/tmp/krava/
 make_static         := LDFLAGS=-static NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 NO_JVMTI=1
 
 # all the NO_* variable combined
-make_minimal        := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
+make_minimal        := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_GTK2=1
 make_minimal        += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1
 make_minimal        += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
 make_minimal        += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1
@@ -139,7 +138,6 @@ run += make_nondistro
 run += make_no_libperl
 run += make_no_libpython
 run += make_no_scripts
-run += make_no_newt
 run += make_no_slang
 run += make_no_gtk2
 run += make_no_ui
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog
#28 lore raw
In reply to Ian Rogers

Em Fri, Mar 10, 2023 at 10:57:40PM -0800, Ian Rogers escreveu:

Quoted 7 lines

Make the default build options a more preferred set, such as making BPF skeletons default and failing the build if jevents or libtracevent dependencies fail. The binutil dependencies are opt-in given license restrictions. abi::__cxa_demangle demangling support is added so that libiberty, from binutils, isn't necessary for C++ demangling.

Some build/test dependencies are fixed and the code cleaned up.

I'll continue fixing more stuff, like adding NO_LIBTRACEEVENT=1 to things like amazonlinux devel, that still doesn't package libtraceevent, but so far...

[perfbuilder@five ~]$ export BUILD_TARBALL=http://192.168.86.10/perf/perf-6.3.0-rc1.tar.xz [perfbuilder@five ~]$ time dm

   1     5.58 almalinux:8                   : FAIL gcc version 8.5.0 20210514 (Red Hat 8.5.0-4) (GCC)
   2     5.38 almalinux:9                   : FAIL gcc version 11.2.1 20220127 (Red Hat 11.2.1-9) (GCC)
   3     4.57 alpine:3.15                   : FAIL gcc version 10.3.1 20211027 (Alpine 10.3.1_git20211027)
   4     4.27 alpine:3.16                   : FAIL gcc version 11.2.1 20220219 (Alpine 11.2.1_git20220219)
   5     4.27 alpine:3.17                   : FAIL gcc version 12.2.1 20220924 (Alpine 12.2.1_git20220924-r4)
   6     4.67 alpine:edge                   : FAIL gcc version 12.2.1 20220924 (Alpine 12.2.1_git20220924-r9)
   7     4.47 alt:p9                        : FAIL gcc version 8.4.1 20200305 (ALT p9 8.4.1-alt0.p9.1) (GCC)
   8     4.58 alt:p10                       : FAIL gcc version 10.3.1 20210703 (ALT Sisyphus 10.3.1-alt2) (GCC)
   9     4.57 alt:sisyphus                  : FAIL gcc version 12.1.1 20220518 (ALT Sisyphus 12.1.1-alt2) (GCC)
  10     3.97 amazonlinux:2                 : FAIL gcc version 7.3.1 20180712 (Red Hat 7.3.1-15) (GCC)
  11     5.77 amazonlinux:devel             : FAIL gcc version 11.3.1 20220421 (Red Hat 11.3.1-2) (GCC)
  12   160.30 archlinux:base                : Ok   gcc (GCC) 12.2.0 , clang version 14.0.6
  13     4.68 centos:8                      : FAIL gcc version 8.4.1 20200928 (Red Hat 8.4.1-1) (GCC)
  14     5.07 centos:stream                 : FAIL gcc version 8.5.0 20210514 (Red Hat 8.5.0-18) (GCC)
  15     5.27 clearlinux:latest             : FAIL gcc version 12.2.1 20230202 releases/gcc-12.2.0-400-gd31bd71386 (Clear Linux OS for Intel Architecture)
  16     3.37 debian:10                     : FAIL gcc version 8.3.0 (Debian 8.3.0-6)
  17     3.57 debian:11                     : FAIL gcc version 10.2.1 20210110 (Debian 10.2.1-6)
  18     4.08 debian:experimental           : FAIL gcc version 12.2.0 (Debian 12.2.0-10)
  19     3.78 debian:experimental-x-arm64   : FAIL gcc version 12.2.0 (Debian 12.2.0-14)
  20     2.77 debian:experimental-x-mips    : FAIL gcc version 12.2.0 (Debian 12.2.0-14)
  21     3.47 debian:experimental-x-mips64  : FAIL gcc version 10.2.1 20210110 (Debian 10.2.1-6)
  22     3.47 debian:experimental-x-mipsel  : FAIL gcc version 12.2.0 (Debian 12.2.0-14)
  23     4.37 fedora:26                     : FAIL gcc version 7.3.1 20180130 (Red Hat 7.3.1-2) (GCC)
  24     4.27 fedora:27                     : FAIL gcc version 7.3.1 20180712 (Red Hat 7.3.1-6) (GCC)
  25     4.27 fedora:28                     : FAIL gcc version 8.3.1 20190223 (Red Hat 8.3.1-2) (GCC)
  26     4.87 fedora:29                     : FAIL gcc version 8.3.1 20190223 (Red Hat 8.3.1-2) (GCC)
  27     4.97 fedora:30                     : FAIL gcc version 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)
  28     5.38 fedora:31                     : FAIL gcc version 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)
  29     5.48 fedora:32                     : FAIL gcc version 10.3.1 20210422 (Red Hat 10.3.1-1) (GCC)

Yeah, I'll take the opportunity and prune the older ones.

- Arnaldo

#29 lore raw

Em Tue, Mar 14, 2023 at 09:11:04AM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 46 lines

Em Fri, Mar 10, 2023 at 10:57:40PM -0800, Ian Rogers escreveu:

Quoted 7 lines

Make the default build options a more preferred set, such as making BPF skeletons default and failing the build if jevents or libtracevent dependencies fail. The binutil dependencies are opt-in given license restrictions. abi::__cxa_demangle demangling support is added so that libiberty, from binutils, isn't necessary for C++ demangling.

Some build/test dependencies are fixed and the code cleaned up.

I'll continue fixing more stuff, like adding NO_LIBTRACEEVENT=1 to things like amazonlinux devel, that still doesn't package libtraceevent, but so far...

[perfbuilder@five ~]$ export BUILD_TARBALL=http://192.168.86.10/perf/perf-6.3.0-rc1.tar.xz [perfbuilder@five ~]$ time dm

   1     5.58 almalinux:8                   : FAIL gcc version 8.5.0 20210514 (Red Hat 8.5.0-4) (GCC)
   2     5.38 almalinux:9                   : FAIL gcc version 11.2.1 20220127 (Red Hat 11.2.1-9) (GCC)
   3     4.57 alpine:3.15                   : FAIL gcc version 10.3.1 20211027 (Alpine 10.3.1_git20211027)
   4     4.27 alpine:3.16                   : FAIL gcc version 11.2.1 20220219 (Alpine 11.2.1_git20220219)
   5     4.27 alpine:3.17                   : FAIL gcc version 12.2.1 20220924 (Alpine 12.2.1_git20220924-r4)
   6     4.67 alpine:edge                   : FAIL gcc version 12.2.1 20220924 (Alpine 12.2.1_git20220924-r9)
   7     4.47 alt:p9                        : FAIL gcc version 8.4.1 20200305 (ALT p9 8.4.1-alt0.p9.1) (GCC)
   8     4.58 alt:p10                       : FAIL gcc version 10.3.1 20210703 (ALT Sisyphus 10.3.1-alt2) (GCC)
   9     4.57 alt:sisyphus                  : FAIL gcc version 12.1.1 20220518 (ALT Sisyphus 12.1.1-alt2) (GCC)
  10     3.97 amazonlinux:2                 : FAIL gcc version 7.3.1 20180712 (Red Hat 7.3.1-15) (GCC)
  11     5.77 amazonlinux:devel             : FAIL gcc version 11.3.1 20220421 (Red Hat 11.3.1-2) (GCC)
  12   160.30 archlinux:base                : Ok   gcc (GCC) 12.2.0 , clang version 14.0.6
  13     4.68 centos:8                      : FAIL gcc version 8.4.1 20200928 (Red Hat 8.4.1-1) (GCC)
  14     5.07 centos:stream                 : FAIL gcc version 8.5.0 20210514 (Red Hat 8.5.0-18) (GCC)
  15     5.27 clearlinux:latest             : FAIL gcc version 12.2.1 20230202 releases/gcc-12.2.0-400-gd31bd71386 (Clear Linux OS for Intel Architecture)
  16     3.37 debian:10                     : FAIL gcc version 8.3.0 (Debian 8.3.0-6)
  17     3.57 debian:11                     : FAIL gcc version 10.2.1 20210110 (Debian 10.2.1-6)
  18     4.08 debian:experimental           : FAIL gcc version 12.2.0 (Debian 12.2.0-10)
  19     3.78 debian:experimental-x-arm64   : FAIL gcc version 12.2.0 (Debian 12.2.0-14)
  20     2.77 debian:experimental-x-mips    : FAIL gcc version 12.2.0 (Debian 12.2.0-14)
  21     3.47 debian:experimental-x-mips64  : FAIL gcc version 10.2.1 20210110 (Debian 10.2.1-6)
  22     3.47 debian:experimental-x-mipsel  : FAIL gcc version 12.2.0 (Debian 12.2.0-14)
  23     4.37 fedora:26                     : FAIL gcc version 7.3.1 20180130 (Red Hat 7.3.1-2) (GCC)
  24     4.27 fedora:27                     : FAIL gcc version 7.3.1 20180712 (Red Hat 7.3.1-6) (GCC)
  25     4.27 fedora:28                     : FAIL gcc version 8.3.1 20190223 (Red Hat 8.3.1-2) (GCC)
  26     4.87 fedora:29                     : FAIL gcc version 8.3.1 20190223 (Red Hat 8.3.1-2) (GCC)
  27     4.97 fedora:30                     : FAIL gcc version 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)
  28     5.38 fedora:31                     : FAIL gcc version 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)
  29     5.48 fedora:32                     : FAIL gcc version 10.3.1 20210422 (Red Hat 10.3.1-1) (GCC)
Quoted 1 line

Yeah, I'll take the opportunity and prune the older ones.

One more!

30 181.19 fedora:33 : Ok gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 11.0.0 (Fedora 11.0.0-3.fc33)

#30 lore raw

Em Tue, Mar 14, 2023 at 09:12:03AM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 18 lines

Em Tue, Mar 14, 2023 at 09:11:04AM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 17 lines

Em Fri, Mar 10, 2023 at 10:57:40PM -0800, Ian Rogers escreveu:

Quoted 7 lines

Make the default build options a more preferred set, such as making BPF skeletons default and failing the build if jevents or libtracevent dependencies fail. The binutil dependencies are opt-in given license restrictions. abi::__cxa_demangle demangling support is added so that libiberty, from binutils, isn't necessary for C++ demangling.

Some build/test dependencies are fixed and the code cleaned up.

I'll continue fixing more stuff, like adding NO_LIBTRACEEVENT=1 to things like amazonlinux devel, that still doesn't package libtraceevent, but so far...

[perfbuilder@five ~]$ export BUILD_TARBALL=http://192.168.86.10/perf/perf-6.3.0-rc1.tar.xz [perfbuilder@five ~]$ time dm

   1     5.58 almalinux:8                   : FAIL gcc version 8.5.0 20210514 (Red Hat 8.5.0-4) (GCC)
   2     5.38 almalinux:9                   : FAIL gcc version 11.2.1 20220127 (Red Hat 11.2.1-9) (GCC)

This one seems to have an old libtraceevent, so this message:

Makefile.config:635: No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR
Makefile.config:1046: No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev Makefile.config:1137: libpfm4 not found, disables libpfm4 support. Please install libpfm4-dev
Makefile.config:1155: *** ERROR: libtraceevent is missing. Please install libtraceevent-dev/libtraceevent-devel or build with NO_LIBTRACEEVENT=1. Stop.

Has to change a bit, like for libbpf, I'll check

Quoted 35 lines
Quoted 29 lines
   3     4.57 alpine:3.15                   : FAIL gcc version 10.3.1 20211027 (Alpine 10.3.1_git20211027)
   4     4.27 alpine:3.16                   : FAIL gcc version 11.2.1 20220219 (Alpine 11.2.1_git20220219)
   5     4.27 alpine:3.17                   : FAIL gcc version 12.2.1 20220924 (Alpine 12.2.1_git20220924-r4)
   6     4.67 alpine:edge                   : FAIL gcc version 12.2.1 20220924 (Alpine 12.2.1_git20220924-r9)
   7     4.47 alt:p9                        : FAIL gcc version 8.4.1 20200305 (ALT p9 8.4.1-alt0.p9.1) (GCC)
   8     4.58 alt:p10                       : FAIL gcc version 10.3.1 20210703 (ALT Sisyphus 10.3.1-alt2) (GCC)
   9     4.57 alt:sisyphus                  : FAIL gcc version 12.1.1 20220518 (ALT Sisyphus 12.1.1-alt2) (GCC)
  10     3.97 amazonlinux:2                 : FAIL gcc version 7.3.1 20180712 (Red Hat 7.3.1-15) (GCC)
  11     5.77 amazonlinux:devel             : FAIL gcc version 11.3.1 20220421 (Red Hat 11.3.1-2) (GCC)
  12   160.30 archlinux:base                : Ok   gcc (GCC) 12.2.0 , clang version 14.0.6
  13     4.68 centos:8                      : FAIL gcc version 8.4.1 20200928 (Red Hat 8.4.1-1) (GCC)
  14     5.07 centos:stream                 : FAIL gcc version 8.5.0 20210514 (Red Hat 8.5.0-18) (GCC)
  15     5.27 clearlinux:latest             : FAIL gcc version 12.2.1 20230202 releases/gcc-12.2.0-400-gd31bd71386 (Clear Linux OS for Intel Architecture)
  16     3.37 debian:10                     : FAIL gcc version 8.3.0 (Debian 8.3.0-6)
  17     3.57 debian:11                     : FAIL gcc version 10.2.1 20210110 (Debian 10.2.1-6)
  18     4.08 debian:experimental           : FAIL gcc version 12.2.0 (Debian 12.2.0-10)
  19     3.78 debian:experimental-x-arm64   : FAIL gcc version 12.2.0 (Debian 12.2.0-14)
  20     2.77 debian:experimental-x-mips    : FAIL gcc version 12.2.0 (Debian 12.2.0-14)
  21     3.47 debian:experimental-x-mips64  : FAIL gcc version 10.2.1 20210110 (Debian 10.2.1-6)
  22     3.47 debian:experimental-x-mipsel  : FAIL gcc version 12.2.0 (Debian 12.2.0-14)
  23     4.37 fedora:26                     : FAIL gcc version 7.3.1 20180130 (Red Hat 7.3.1-2) (GCC)
  24     4.27 fedora:27                     : FAIL gcc version 7.3.1 20180712 (Red Hat 7.3.1-6) (GCC)
  25     4.27 fedora:28                     : FAIL gcc version 8.3.1 20190223 (Red Hat 8.3.1-2) (GCC)
  26     4.87 fedora:29                     : FAIL gcc version 8.3.1 20190223 (Red Hat 8.3.1-2) (GCC)
  27     4.97 fedora:30                     : FAIL gcc version 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)
  28     5.38 fedora:31                     : FAIL gcc version 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)
  29     5.48 fedora:32                     : FAIL gcc version 10.3.1 20210422 (Red Hat 10.3.1-1) (GCC)
Quoted 1 line

Yeah, I'll take the opportunity and prune the older ones.

One more!

30 181.19 fedora:33 : Ok gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 11.0.0 (Fedora 11.0.0-3.fc33)

Signature · 1 line
- Arnaldo
#31 lore raw

Em Tue, Mar 14, 2023 at 09:27:46AM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
   3     4.57 alpine:3.15                   : FAIL gcc version 10.3.1 20211027 (Alpine 10.3.1_git20211027)
   4     4.27 alpine:3.16                   : FAIL gcc version 11.2.1 20220219 (Alpine 11.2.1_git20220219)
   5     4.27 alpine:3.17                   : FAIL gcc version 12.2.1 20220924 (Alpine 12.2.1_git20220924-r4)
   6     4.67 alpine:edge                   : FAIL gcc version 12.2.1 20220924 (Alpine 12.2.1_git20220924-r9)
   7     4.47 alt:p9                        : FAIL gcc version 8.4.1 20200305 (ALT p9 8.4.1-alt0.p9.1) (GCC)
   8     4.58 alt:p10                       : FAIL gcc version 10.3.1 20210703 (ALT Sisyphus 10.3.1-alt2) (GCC)
   9     4.57 alt:sisyphus                  : FAIL gcc version 12.1.1 20220518 (ALT Sisyphus 12.1.1-alt2) (GCC)
  10     3.97 amazonlinux:2                 : FAIL gcc version 7.3.1 20180712 (Red Hat 7.3.1-15) (GCC)
  11     5.77 amazonlinux:devel             : FAIL gcc version 11.3.1 20220421 (Red Hat 11.3.1-2) (GCC)
  12   160.30 archlinux:base                : Ok   gcc (GCC) 12.2.0 , clang version 14.0.6
  13     4.68 centos:8                      : FAIL gcc version 8.4.1 20200928 (Red Hat 8.4.1-1) (GCC)
  14     5.07 centos:stream                 : FAIL gcc version 8.5.0 20210514 (Red Hat 8.5.0-18) (GCC)
  15     5.27 clearlinux:latest             : FAIL gcc version 12.2.1 20230202 releases/gcc-12.2.0-400-gd31bd71386 (Clear Linux OS for Intel Architecture)
  16     3.37 debian:10                     : FAIL gcc version 8.3.0 (Debian 8.3.0-6)
  17     3.57 debian:11                     : FAIL gcc version 10.2.1 20210110 (Debian 10.2.1-6)
  18     4.08 debian:experimental           : FAIL gcc version 12.2.0 (Debian 12.2.0-10)
  19     3.78 debian:experimental-x-arm64   : FAIL gcc version 12.2.0 (Debian 12.2.0-14)
  20     2.77 debian:experimental-x-mips    : FAIL gcc version 12.2.0 (Debian 12.2.0-14)
  21     3.47 debian:experimental-x-mips64  : FAIL gcc version 10.2.1 20210110 (Debian 10.2.1-6)
  22     3.47 debian:experimental-x-mipsel  : FAIL gcc version 12.2.0 (Debian 12.2.0-14)
  23     4.37 fedora:26                     : FAIL gcc version 7.3.1 20180130 (Red Hat 7.3.1-2) (GCC)
  24     4.27 fedora:27                     : FAIL gcc version 7.3.1 20180712 (Red Hat 7.3.1-6) (GCC)
  25     4.27 fedora:28                     : FAIL gcc version 8.3.1 20190223 (Red Hat 8.3.1-2) (GCC)
  26     4.87 fedora:29                     : FAIL gcc version 8.3.1 20190223 (Red Hat 8.3.1-2) (GCC)
  27     4.97 fedora:30                     : FAIL gcc version 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)
  28     5.38 fedora:31                     : FAIL gcc version 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)
  29     5.48 fedora:32                     : FAIL gcc version 10.3.1 20210422 (Red Hat 10.3.1-1) (GCC)
Quoted 5 lines
Quoted 5 lines
Quoted 1 line

Yeah, I'll take the opportunity and prune the older ones.

One more!

30 181.19 fedora:33 : Ok gcc (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1) , clang version 11.0.0 (Fedora 11.0.0-3.fc33)

31 222.81 fedora:34 : Ok gcc (GCC) 11.3.1 20220421 (Red Hat 11.3.1-2) , clang version 12.0.1 (Fedora 12.0.1-1.fc34)

  32     3.07 fedora:34-x-ARC-glibc         : FAIL gcc version 8.3.1 20190225 (ARC HS GNU/Linux glibc toolchain 2019.03-rc1)
  33     2.67 fedora:34-x-ARC-uClibc        : FAIL gcc version 8.3.1 20190225 (ARCv2 ISA Linux uClibc toolchain 2019.03-rc1)
  34   182.17 fedora:35                     : Ok   gcc (GCC) 11.3.1 20220421 (Red Hat 11.3.1-3) , clang version 13.0.1 (Fedora 13.0.1-1.fc35)
  35   180.73 fedora:36                     : Ok   gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4) , clang version 14.0.5 (Fedora 14.0.5-2.fc36)
  36   179.27 fedora:37                     : Ok   gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4) , clang version 15.0.7 (Fedora 15.0.7-1.fc37)
  37   169.45 fedora:38                     : Ok   gcc (GCC) 13.0.1 20230208 (Red Hat 13.0.1-0) , clang version 15.0.7 (Fedora 15.0.7-2.fc38)
reviewer
#32 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 11 lines · Arnaldo Carvalho de Melo

Em Fri, Mar 10, 2023 at 10:57:40PM -0800, Ian Rogers escreveu:

Quoted 7 lines

Make the default build options a more preferred set, such as making BPF skeletons default and failing the build if jevents or libtracevent dependencies fail. The binutil dependencies are opt-in given license restrictions. abi::__cxa_demangle demangling support is added so that libiberty, from binutils, isn't necessary for C++ demangling.

Some build/test dependencies are fixed and the code cleaned up.

I'll continue fixing more stuff, like adding NO_LIBTRACEEVENT=1 to things like amazonlinux devel, that still doesn't package libtraceevent,

FYI I'm currently testing a patch to allow python scripting without also requiring libtraceevent

#33 lore raw

Em Tue, Mar 14, 2023 at 02:21:23PM +0200, Adrian Hunter escreveu:

Quoted 8 lines · Arnaldo Carvalho de Melo
Quoted 7 lines

Em Fri, Mar 10, 2023 at 10:57:40PM -0800, Ian Rogers escreveu:

Quoted 6 lines

Make the default build options a more preferred set, such as making BPF skeletons default and failing the build if jevents or libtracevent dependencies fail. The binutil dependencies are opt-in given license restrictions. abi::__cxa_demangle demangling support is added so that libiberty, from binutils, isn't necessary for C++ demangling.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Some build/test dependencies are fixed and the code cleaned up.

I'll continue fixing more stuff, like adding NO_LIBTRACEEVENT=1 to things like amazonlinux devel, that still doesn't package libtraceevent,

FYI I'm currently testing a patch to allow python scripting without also requiring libtraceevent

Cool!

- Arnaldo