Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'perf-tools-fixes-for-v6.11-2024-07-23' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools

Pull perf tools fixes from Namhyung Kim:
"Two fixes for building perf and other tools:

- Fix breakage in tracing tools due to pkg-config for
libtrace{event,fs}

- Fix build of perf when libunwind is used"

* tag 'perf-tools-fixes-for-v6.11-2024-07-23' of git://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools:
perf dso: Fix build when libunwind is enabled
tools/latency: Use pkg-config in lib_setup of Makefile.config
tools/rtla: Use pkg-config in lib_setup of Makefile.config
tools/verification: Use pkg-config in lib_setup of Makefile.config
tools: Make pkg-config dependency checks usable by other tools
perf build: Warn if libtracefs is not found

+36 -13
+18
tools/build/Makefile.feature
··· 149 149 # 150 150 FEATURE_GROUP_MEMBERS-libbfd = libbfd-liberty libbfd-liberty-z 151 151 152 + # 153 + # Declare list of feature dependency packages that provide pkg-config files. 154 + # 155 + FEATURE_PKG_CONFIG ?= \ 156 + libtraceevent \ 157 + libtracefs 158 + 159 + feature_pkg_config = $(eval $(feature_pkg_config_code)) 160 + define feature_pkg_config_code 161 + FEATURE_CHECK_CFLAGS-$(1) := $(shell $(PKG_CONFIG) --cflags $(1) 2>/dev/null) 162 + FEATURE_CHECK_LDFLAGS-$(1) := $(shell $(PKG_CONFIG) --libs $(1) 2>/dev/null) 163 + endef 164 + 165 + # Set FEATURE_CHECK_(C|LD)FLAGS-$(package) for packages using pkg-config. 166 + ifneq ($(PKG_CONFIG),) 167 + $(foreach package,$(FEATURE_PKG_CONFIG),$(call feature_pkg_config,$(package))) 168 + endif 169 + 152 170 # Set FEATURE_CHECK_(C|LD)FLAGS-all for all FEATURE_TESTS features. 153 171 # If in the future we need per-feature checks/flags for features not 154 172 # mentioned in this list we need to refactor this ;-).
+5 -8
tools/perf/Makefile.config
··· 182 182 FEATURE_CHECK_CFLAGS-libzstd := $(LIBZSTD_CFLAGS) 183 183 FEATURE_CHECK_LDFLAGS-libzstd := $(LIBZSTD_LDFLAGS) 184 184 185 + # for linking with debug library, run like: 186 + # make DEBUG=1 PKG_CONFIG_PATH=/opt/libtraceevent/(lib|lib64)/pkgconfig 187 + 185 188 ifneq ($(NO_LIBTRACEEVENT),1) 186 189 ifeq ($(call get-executable,$(PKG_CONFIG)),) 187 190 $(error Error: $(PKG_CONFIG) needed by libtraceevent is missing on this system, please install it) 188 191 endif 189 192 endif 190 - 191 - # for linking with debug library, run like: 192 - # make DEBUG=1 PKG_CONFIG_PATH=/opt/libtraceevent/(lib|lib64)/pkgconfig 193 - FEATURE_CHECK_CFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --cflags libtraceevent 2>/dev/null) 194 - FEATURE_CHECK_LDFLAGS-libtraceevent := $(shell $(PKG_CONFIG) --libs libtraceevent 2>/dev/null) 195 - 196 - FEATURE_CHECK_CFLAGS-libtracefs := $(shell $(PKG_CONFIG) --cflags libtracefs 2>/dev/null) 197 - FEATURE_CHECK_LDFLAGS-libtracefs := $(shell $(PKG_CONFIG) --libs libtracefs 2>/dev/null) 198 193 199 194 FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi -I$(srctree)/tools/include/uapi 200 195 # include ARCH specific config ··· 1201 1206 LIBTRACEFS_VERSION_3 := $(word 3, $(subst ., ,$(LIBTRACEFS_VERSION))) 1202 1207 LIBTRACEFS_VERSION_CPP := $(shell expr $(LIBTRACEFS_VERSION_1) \* 255 \* 255 + $(LIBTRACEFS_VERSION_2) \* 255 + $(LIBTRACEFS_VERSION_3)) 1203 1208 CFLAGS += -DLIBTRACEFS_VERSION=$(LIBTRACEFS_VERSION_CPP) 1209 + else 1210 + $(warning libtracefs is missing. Please install libtracefs-dev/libtracefs-devel) 1204 1211 endif 1205 1212 endif 1206 1213
+1 -1
tools/perf/util/dso.c
··· 1501 1501 auxtrace_cache__free(RC_CHK_ACCESS(dso)->auxtrace_cache); 1502 1502 dso_cache__free(dso); 1503 1503 dso__free_a2l(dso); 1504 - zfree(&RC_CHK_ACCESS(dso)->symsrc_filename); 1504 + dso__free_symsrc_filename(dso); 1505 1505 nsinfo__zput(RC_CHK_ACCESS(dso)->nsinfo); 1506 1506 mutex_destroy(dso__lock(dso)); 1507 1507 RC_CHK_FREE(dso);
+5
tools/perf/util/dso.h
··· 602 602 RC_CHK_ACCESS(dso)->symsrc_filename = val; 603 603 } 604 604 605 + static inline void dso__free_symsrc_filename(struct dso *dso) 606 + { 607 + zfree(&RC_CHK_ACCESS(dso)->symsrc_filename); 608 + } 609 + 605 610 static inline enum dso_binary_type dso__symtab_type(const struct dso *dso) 606 611 { 607 612 return RC_CHK_ACCESS(dso)->symtab_type;
+1 -1
tools/perf/util/unwind-libunwind-local.c
··· 413 413 __func__, 414 414 dso__symsrc_filename(dso), 415 415 debuglink); 416 - zfree(&dso__symsrc_filename(dso)); 416 + dso__free_symsrc_filename(dso); 417 417 } 418 418 dso__set_symsrc_filename(dso, debuglink); 419 419 } else {
+2 -1
tools/tracing/latency/Makefile.config
··· 3 3 STOP_ERROR := 4 4 5 5 define lib_setup 6 - $(eval EXTLIBS += -l$(1)) 7 6 $(eval LIB_INCLUDES += $(shell sh -c "$(PKG_CONFIG) --cflags lib$(1)")) 7 + $(eval LDFLAGS += $(shell sh -c "$(PKG_CONFIG) --libs-only-L lib$(1)")) 8 + $(eval EXTLIBS += $(shell sh -c "$(PKG_CONFIG) --libs-only-l lib$(1)")) 8 9 endef 9 10 10 11 $(call feature_check,libtraceevent)
+2 -1
tools/tracing/rtla/Makefile.config
··· 7 7 8 8 define lib_setup 9 9 $(eval LIB_INCLUDES += $(shell sh -c "$(PKG_CONFIG) --cflags lib$(1)")) 10 - $(eval EXTLIBS += -l$(1)) 10 + $(eval LDFLAGS += $(shell sh -c "$(PKG_CONFIG) --libs-only-L lib$(1)")) 11 + $(eval EXTLIBS += $(shell sh -c "$(PKG_CONFIG) --libs-only-l lib$(1)")) 11 12 endef 12 13 13 14 $(call feature_check,libtraceevent)
+2 -1
tools/verification/rv/Makefile.config
··· 7 7 8 8 define lib_setup 9 9 $(eval LIB_INCLUDES += $(shell sh -c "$(PKG_CONFIG) --cflags lib$(1)")) 10 - $(eval EXTLIBS += -l$(1)) 10 + $(eval LDFLAGS += $(shell sh -c "$(PKG_CONFIG) --libs-only-L lib$(1)")) 11 + $(eval EXTLIBS += $(shell sh -c "$(PKG_CONFIG) --libs-only-l lib$(1)")) 11 12 endef 12 13 13 14 $(call feature_check,libtraceevent)