summaryrefslogtreecommitdiff
path: root/tools/perf/Makefile.config
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/Makefile.config')
-rw-r--r--tools/perf/Makefile.config266
1 files changed, 120 insertions, 146 deletions
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 333ddd0e4bd8..0ba307e78fe1 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -65,95 +65,85 @@ $(call detected_var,SRCARCH)
CFLAGS += -I$(OUTPUT)arch/$(SRCARCH)/include/generated
-# Additional ARCH settings for ppc
-ifeq ($(SRCARCH),powerpc)
- ifndef NO_LIBUNWIND
- LIBUNWIND_LIBS := -lunwind -lunwind-ppc64
- endif
-endif
-
# Additional ARCH settings for x86
ifeq ($(SRCARCH),x86)
$(call detected,CONFIG_X86)
ifeq (${IS_64_BIT}, 1)
CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT
ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
- ifndef NO_LIBUNWIND
- LIBUNWIND_LIBS = -lunwind-x86_64 -lunwind -llzma
- endif
$(call detected,CONFIG_X86_64)
- else
- ifndef NO_LIBUNWIND
- LIBUNWIND_LIBS = -lunwind-x86 -llzma -lunwind
- endif
endif
endif
-ifeq ($(SRCARCH),arm)
- ifndef NO_LIBUNWIND
- LIBUNWIND_LIBS = -lunwind -lunwind-arm
- endif
+ifeq ($(ARCH),s390)
+ CFLAGS += -fPIC
+ CXXFLAGS += -fPIC
endif
+# Unconditionally set up the libunwind feature build flags as a
+# feature-dump build doesn't specify LIBUNWIND=1. This means that
+# dumping the libunwind features will be broken that can impact later
+# builds that use the feature dump.
+ifeq ($(SRCARCH),arm)
+ LIBUNWIND_LIBS = -lunwind -lunwind-arm
+endif
ifeq ($(SRCARCH),arm64)
- ifndef NO_LIBUNWIND
- LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
- endif
+ LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
endif
-
ifeq ($(SRCARCH),loongarch)
- ifndef NO_LIBUNWIND
- LIBUNWIND_LIBS = -lunwind -lunwind-loongarch64
- endif
+ LIBUNWIND_LIBS = -lunwind -lunwind-loongarch64
endif
-
-ifeq ($(ARCH),s390)
- CFLAGS += -fPIC
-endif
-
ifeq ($(ARCH),mips)
- ifndef NO_LIBUNWIND
- LIBUNWIND_LIBS = -lunwind -lunwind-mips
+ LIBUNWIND_LIBS = -lunwind -lunwind-mips
+endif
+ifeq ($(SRCARCH),powerpc)
+ LIBUNWIND_LIBS := -lunwind -lunwind-ppc64
+endif
+ifeq ($(SRCARCH),riscv)
+ LIBUNWIND_LIBS := -lunwind -lunwind-riscv
+endif
+ifeq ($(SRCARCH),s390)
+ LIBUNWIND_LIBS := -lunwind -lunwind-s390x
+endif
+ifeq ($(SRCARCH),x86)
+ ifeq (${IS_64_BIT}, 1)
+ LIBUNWIND_LIBS = -lunwind-x86_64 -lunwind -llzma
+ else
+ LIBUNWIND_LIBS = -lunwind-x86 -lunwind -llzma
endif
endif
-
ifneq ($(LIBUNWIND),1)
NO_LIBUNWIND := 1
endif
-
ifeq ($(LIBUNWIND_LIBS),)
NO_LIBUNWIND := 1
endif
+
#
# For linking with debug library, run like:
#
# make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
#
+LIBUNWIND_ARCHS:=aarch64 arm loongarch64 mips ppc32 ppc64 riscv s390x x86 x86_64
-libunwind_arch_set_flags = $(eval $(libunwind_arch_set_flags_code))
-define libunwind_arch_set_flags_code
- FEATURE_CHECK_CFLAGS-libunwind-$(1) = -I$(LIBUNWIND_DIR)/include
- FEATURE_CHECK_LDFLAGS-libunwind-$(1) = -L$(LIBUNWIND_DIR)/lib
-endef
+# "Local" (no arch specified) feature test flags.
+FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS)
+FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
+FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS)
+FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
+# Add directory into the "remote" (build for a a specific arch) feature tests.
ifdef LIBUNWIND_DIR
LIBUNWIND_CFLAGS = -I$(LIBUNWIND_DIR)/include
LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib
- LIBUNWIND_ARCHS = x86 x86_64 arm aarch64 debug-frame-arm debug-frame-aarch64 loongarch
- $(foreach libunwind_arch,$(LIBUNWIND_ARCHS),$(call libunwind_arch_set_flags,$(libunwind_arch)))
-endif
-ifndef NO_LIBUNWIND
- # Set per-feature check compilation flags
- FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS)
- FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
- FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS)
- FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS)
-
- FEATURE_CHECK_LDFLAGS-libunwind-arm += -lunwind -lunwind-arm
- FEATURE_CHECK_LDFLAGS-libunwind-aarch64 += -lunwind -lunwind-aarch64
- FEATURE_CHECK_LDFLAGS-libunwind-x86 += -lunwind -llzma -lunwind-x86
- FEATURE_CHECK_LDFLAGS-libunwind-x86_64 += -lunwind -llzma -lunwind-x86_64
+ define libunwind_arch_set_flags
+ FEATURE_CHECK_CFLAGS-libunwind-$(1) = -I$(LIBUNWIND_DIR)/include
+ FEATURE_CHECK_LDFLAGS-libunwind-$(1) = -L$(LIBUNWIND_DIR)/lib -lunwind -lunwind-$(1)
+ endef
+ $(foreach arch,$(LIBUNWIND_ARCHS), \
+ $(eval $(call libunwind_arch_set_flags,$(arch))) \
+ )
endif
ifdef CSINCLUDES
@@ -195,14 +185,11 @@ endif
FEATURE_CHECK_CFLAGS-libdw := $(LIBDW_CFLAGS)
FEATURE_CHECK_LDFLAGS-libdw := $(LIBDW_LDFLAGS) $(DWARFLIBS)
-# for linking with debug library, run like:
-# make DEBUG=1 LIBBABELTRACE_DIR=/opt/libbabeltrace/
-ifdef LIBBABELTRACE_DIR
- LIBBABELTRACE_CFLAGS := -I$(LIBBABELTRACE_DIR)/include
- LIBBABELTRACE_LDFLAGS := -L$(LIBBABELTRACE_DIR)/lib
+ifneq ($(NO_BABELTRACE2),1)
+ ifeq ($(call get-executable,$(PKG_CONFIG)),)
+ $(error Error: $(PKG_CONFIG) needed by babeltrace2 is missing on this system, please install it)
+ endif
endif
-FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS)
-FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf
# for linking with debug library, run like:
# make DEBUG=1 LIBCAPSTONE_DIR=/opt/capstone/
@@ -587,10 +574,8 @@ ifndef NO_LIBELF
ifndef NO_LIBBPF
ifeq ($(feature-bpf), 1)
- # detecting libbpf without LIBBPF_DYNAMIC, so make VF=1 shows libbpf detection status
- $(call feature_check,libbpf)
-
ifdef LIBBPF_DYNAMIC
+ $(call feature_check,libbpf)
ifeq ($(feature-libbpf), 1)
EXTLIBS += -lbpf
CFLAGS += -DHAVE_LIBBPF_SUPPORT
@@ -638,49 +623,6 @@ ifeq ($(SRCARCH),powerpc)
endif
endif
-ifndef NO_LIBUNWIND
- have_libunwind :=
-
- $(call feature_check,libunwind)
-
- $(call feature_check,libunwind-x86)
- ifeq ($(feature-libunwind-x86), 1)
- $(call detected,CONFIG_LIBUNWIND_X86)
- CFLAGS += -DHAVE_LIBUNWIND_X86_SUPPORT
- LDFLAGS += -lunwind-x86
- EXTLIBS_LIBUNWIND += -lunwind-x86
- have_libunwind = 1
- endif
-
- $(call feature_check,libunwind-aarch64)
- ifeq ($(feature-libunwind-aarch64), 1)
- $(call detected,CONFIG_LIBUNWIND_AARCH64)
- CFLAGS += -DHAVE_LIBUNWIND_AARCH64_SUPPORT
- LDFLAGS += -lunwind-aarch64
- EXTLIBS_LIBUNWIND += -lunwind-aarch64
- have_libunwind = 1
- $(call feature_check,libunwind-debug-frame-aarch64)
- ifneq ($(feature-libunwind-debug-frame-aarch64), 1)
- $(warning No debug_frame support found in libunwind-aarch64)
- CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME_AARCH64
- endif
- endif
-
- ifneq ($(feature-libunwind), 1)
- $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR and set LIBUNWIND=1 in the make command line as it is opt-in now)
- NO_LOCAL_LIBUNWIND := 1
- else
- have_libunwind := 1
- $(call detected,CONFIG_LOCAL_LIBUNWIND)
- endif
-
- ifneq ($(have_libunwind), 1)
- NO_LIBUNWIND := 1
- endif
-else
- NO_LOCAL_LIBUNWIND := 1
-endif
-
ifndef NO_LIBBPF
ifneq ($(feature-bpf), 1)
$(warning BPF API too old. Please install recent kernel headers. BPF support in 'perf record' is disabled.)
@@ -736,7 +678,61 @@ ifeq ($(BUILD_BPF_SKEL),1)
endif
ifndef GEN_VMLINUX_H
- VMLINUX_H=$(src-perf)/util/bpf_skel/vmlinux/vmlinux.h
+ VMLINUX_H_FILE=$(src-perf)/util/bpf_skel/vmlinux/vmlinux.h
+endif
+
+ifndef NO_LIBUNWIND
+ have_libunwind :=
+
+ $(call feature_check,libunwind)
+ ifneq ($(feature-libunwind), 1)
+ $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR and set LIBUNWIND=1 in the make command line as it is opt-in now)
+ NO_LOCAL_LIBUNWIND := 1
+ else
+ have_libunwind := 1
+ $(call detected,CONFIG_LOCAL_LIBUNWIND)
+ CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
+ CFLAGS += $(LIBUNWIND_CFLAGS)
+ LDFLAGS += $(LIBUNWIND_LDFLAGS)
+ EXTLIBS_LIBUNWIND := $(LIBUNWIND_LIBS)
+ $(call feature_check,libunwind-debug-frame)
+ ifneq ($(feature-libunwind-debug-frame), 1)
+ CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
+ endif
+ endif
+
+ define PROCESS_REMOTE_LIBUNWIND_ARCH
+ $(call feature_check,libunwind-$(1))
+
+ ifeq ($$(feature-libunwind-$(1)), 1)
+ upper_arch := $$(shell echo $(1) | tr '[:lower:]' '[:upper:]')
+ $$(call detected,CONFIG_LIBUNWIND_$$(upper_arch))
+
+ CFLAGS += -DHAVE_LIBUNWIND_$$(upper_arch)_SUPPORT
+ LDFLAGS += -lunwind-$(1)
+ EXTLIBS_LIBUNWIND += -lunwind-$(1)
+ have_libunwind := 1
+
+ $$(call feature_check,libunwind-debug-frame-$(1))
+ ifneq ($$(feature-libunwind-debug-frame-$(1)), 1)
+ CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME_$$(upper_arch)
+ endif
+ endif
+ endef
+ $(foreach arch,$(LIBUNWIND_ARCHS), \
+ $(eval $(call PROCESS_REMOTE_LIBUNWIND_ARCH,$(arch))) \
+ )
+
+ EXTLIBS += $(EXTLIBS_LIBUNWIND)
+
+ ifeq ($(findstring -static,${LDFLAGS}),-static)
+ # gcc -static links libgcc_eh which contains piece of libunwind
+ LIBUNWIND_LDFLAGS += -Wl,--allow-multiple-definition
+ endif
+
+ ifneq ($(have_libunwind), 1)
+ NO_LIBUNWIND := 1
+ endif
endif
dwarf-post-unwind := 1
@@ -761,31 +757,6 @@ ifeq ($(dwarf-post-unwind),1)
$(call detected,CONFIG_DWARF_UNWIND)
endif
-ifndef NO_LIBUNWIND
- ifndef NO_LOCAL_LIBUNWIND
- ifeq ($(SRCARCH),$(filter $(SRCARCH),arm arm64))
- $(call feature_check,libunwind-debug-frame)
- ifneq ($(feature-libunwind-debug-frame), 1)
- $(warning No debug_frame support found in libunwind)
- CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
- endif
- else
- # non-ARM has no dwarf_find_debug_frame() function:
- CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
- endif
- EXTLIBS += $(LIBUNWIND_LIBS)
- LDFLAGS += $(LIBUNWIND_LIBS)
- endif
- ifeq ($(findstring -static,${LDFLAGS}),-static)
- # gcc -static links libgcc_eh which contans piece of libunwind
- LIBUNWIND_LDFLAGS += -Wl,--allow-multiple-definition
- endif
- CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
- CFLAGS += $(LIBUNWIND_CFLAGS)
- LDFLAGS += $(LIBUNWIND_LDFLAGS)
- EXTLIBS += $(EXTLIBS_LIBUNWIND)
-endif
-
ifneq ($(NO_LIBTRACEEVENT),1)
$(call detected,CONFIG_TRACE)
endif
@@ -923,7 +894,7 @@ ifdef BUILD_NONDISTRO
$(call feature_check,libbfd-liberty-z)
ifneq ($(feature-libbfd-threadsafe), 1)
- $(error binutils 2.42 or later is required for non-distro builds)
+ $(error binutils-dev(el) 2.42 or later is required for non-distro builds)
endif
# we may be on a system that requires -liberty and (maybe) -lz
@@ -953,11 +924,14 @@ ifndef NO_LIBLLVM
$(call feature_check,llvm-perf)
ifeq ($(feature-llvm-perf), 1)
CFLAGS += -DHAVE_LIBLLVM_SUPPORT
- CFLAGS += $(shell $(LLVM_CONFIG) --cflags)
- CXXFLAGS += -DHAVE_LIBLLVM_SUPPORT
- CXXFLAGS += $(shell $(LLVM_CONFIG) --cxxflags)
- LIBLLVM = $(shell $(LLVM_CONFIG) --libs all) $(shell $(LLVM_CONFIG) --system-libs)
- EXTLIBS += -L$(shell $(LLVM_CONFIG) --libdir) $(LIBLLVM)
+ LLVM_CFLAGS := $(shell $(LLVM_CONFIG) --cflags 2>/dev/null)
+ LLVM_CXXFLAGS := $(shell $(LLVM_CONFIG) --cxxflags 2>/dev/null)
+ LLVM_LIBLLVM := $(shell $(LLVM_CONFIG) --libs all 2>/dev/null) $(shell $(LLVM_CONFIG) --system-libs 2>/dev/null)
+ LLVM_LIBDIR := $(shell $(LLVM_CONFIG) --libdir 2>/dev/null)
+ CFLAGS += $(LLVM_CFLAGS)
+ CXXFLAGS += -DHAVE_LIBLLVM_SUPPORT $(LLVM_CXXFLAGS)
+ LIBLLVM := $(LLVM_LIBLLVM)
+ EXTLIBS += -L$(LLVM_LIBDIR) $(LIBLLVM)
EXTLIBS += -lstdc++
$(call detected,CONFIG_LIBLLVM)
else
@@ -1059,15 +1033,15 @@ else
NO_PERF_READ_VDSOX32 := 1
endif
-ifndef NO_LIBBABELTRACE
- $(call feature_check,libbabeltrace)
- ifeq ($(feature-libbabeltrace), 1)
- CFLAGS += -DHAVE_LIBBABELTRACE_SUPPORT $(LIBBABELTRACE_CFLAGS)
- LDFLAGS += $(LIBBABELTRACE_LDFLAGS)
- EXTLIBS += -lbabeltrace-ctf
- $(call detected,CONFIG_LIBBABELTRACE)
+ifndef NO_BABELTRACE2
+ $(call feature_check,babeltrace2-ctf-writer)
+ ifeq ($(feature-babeltrace2-ctf-writer), 1)
+ CFLAGS += -DHAVE_BABELTRACE2_CTF_WRITER_SUPPORT $(shell $(PKG_CONFIG) --cflags babeltrace2-ctf-writer)
+ LDFLAGS += $(shell $(PKG_CONFIG) --libs-only-L babeltrace2-ctf-writer)
+ EXTLIBS += $(shell $(PKG_CONFIG) --libs-only-l babeltrace2-ctf-writer)
+ $(call detected,CONFIG_BABELTRACE2_CTF_WRITER)
else
- $(warning No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev)
+ $(warning No babeltrace2 found, disables 'perf data' CTF format support, please install libbabeltrace2-dev[el])
endif
endif