summaryrefslogtreecommitdiff
path: root/tools/perf/config
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/config')
-rw-r--r--tools/perf/config/Makefile127
-rw-r--r--tools/perf/config/utilities.mak179
2 files changed, 72 insertions, 234 deletions
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 511141b10..6f8f6430f 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -61,50 +61,45 @@ endif
ifeq ($(LIBUNWIND_LIBS),)
NO_LIBUNWIND := 1
-else
- #
- # For linking with debug library, run like:
- #
- # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
- #
- ifdef LIBUNWIND_DIR
- LIBUNWIND_CFLAGS = -I$(LIBUNWIND_DIR)/include
- LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib
- endif
- LIBUNWIND_LDFLAGS += $(LIBUNWIND_LIBS)
-
- # Set per-feature check compilation flags
- FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS)
- FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS)
- FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS)
- FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS)
endif
+#
+# For linking with debug library, run like:
+#
+# make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
+#
+ifdef LIBUNWIND_DIR
+ LIBUNWIND_CFLAGS = -I$(LIBUNWIND_DIR)/include
+ LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib
+endif
+LIBUNWIND_LDFLAGS += $(LIBUNWIND_LIBS)
+
+# Set per-feature check compilation flags
+FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS)
+FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS)
+FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS)
+FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS)
ifeq ($(NO_PERF_REGS),0)
CFLAGS += -DHAVE_PERF_REGS_SUPPORT
endif
-ifndef NO_LIBELF
- # for linking with debug library, run like:
- # make DEBUG=1 LIBDW_DIR=/opt/libdw/
- ifdef LIBDW_DIR
- LIBDW_CFLAGS := -I$(LIBDW_DIR)/include
- LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
- endif
- FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
- FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
+# for linking with debug library, run like:
+# make DEBUG=1 LIBDW_DIR=/opt/libdw/
+ifdef LIBDW_DIR
+ LIBDW_CFLAGS := -I$(LIBDW_DIR)/include
+ LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
endif
+FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
+FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
-ifdef LIBBABELTRACE
- # 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
- 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 LIBBABELTRACE_DIR=/opt/libbabeltrace/
+ifdef LIBBABELTRACE_DIR
+ LIBBABELTRACE_CFLAGS := -I$(LIBBABELTRACE_DIR)/include
+ LIBBABELTRACE_LDFLAGS := -L$(LIBBABELTRACE_DIR)/lib
endif
+FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS)
+FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf
FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/arch/$(ARCH)/include/uapi -I$(srctree)/include/uapi
# include ARCH specific config
@@ -114,7 +109,7 @@ ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET
endif
-include $(src-perf)/config/utilities.mak
+include $(srctree)/tools/scripts/utilities.mak
ifeq ($(call get-executable,$(FLEX)),)
dummy := $(error Error: $(FLEX) is missing on this system, please install it)
@@ -145,28 +140,26 @@ ifdef PARSER_DEBUG
$(call detected_var,PARSER_DEBUG_FLEX)
endif
-ifndef NO_LIBPYTHON
- # Try different combinations to accommodate systems that only have
- # python[2][-config] in weird combinations but always preferring
- # python2 and python2-config as per pep-0394. If we catch a
- # python[-config] in version 3, the version check will kill it.
- PYTHON2 := $(if $(call get-executable,python2),python2,python)
- override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON2))
- PYTHON2_CONFIG := \
- $(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config)
- override PYTHON_CONFIG := \
- $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG))
+# Try different combinations to accommodate systems that only have
+# python[2][-config] in weird combinations but always preferring
+# python2 and python2-config as per pep-0394. If we catch a
+# python[-config] in version 3, the version check will kill it.
+PYTHON2 := $(if $(call get-executable,python2),python2,python)
+override PYTHON := $(call get-executable-or-default,PYTHON,$(PYTHON2))
+PYTHON2_CONFIG := \
+ $(if $(call get-executable,$(PYTHON)-config),$(PYTHON)-config,python-config)
+override PYTHON_CONFIG := \
+ $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG))
- PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
+PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
- PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
- PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
+PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
+PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
- FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
- FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
- FEATURE_CHECK_CFLAGS-libpython-version := $(PYTHON_EMBED_CCOPTS)
- FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS)
-endif
+FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
+FEATURE_CHECK_LDFLAGS-libpython := $(PYTHON_EMBED_LDOPTS)
+FEATURE_CHECK_CFLAGS-libpython-version := $(PYTHON_EMBED_CCOPTS)
+FEATURE_CHECK_LDFLAGS-libpython-version := $(PYTHON_EMBED_LDOPTS)
CFLAGS += -fno-omit-frame-pointer
CFLAGS += -ggdb3
@@ -275,6 +268,12 @@ else
ifneq ($(feature-dwarf), 1)
msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev);
NO_DWARF := 1
+ else
+ ifneq ($(feature-dwarf_getlocations), 1)
+ msg := $(warning Old libdw.h, finding variables at given 'perf probe' point will not work, install elfutils-devel/libdw-dev >= 0.157);
+ else
+ CFLAGS += -DHAVE_DWARF_GETLOCATIONS
+ endif # dwarf_getlocations
endif # Dwarf support
endif # libelf support
endif # NO_LIBELF
@@ -335,6 +334,13 @@ ifndef NO_LIBELF
endif # NO_LIBBPF
endif # NO_LIBELF
+ifdef PERF_HAVE_JITDUMP
+ ifndef NO_DWARF
+ $(call detected,CONFIG_JITDUMP)
+ CFLAGS += -DHAVE_JITDUMP
+ endif
+endif
+
ifeq ($(ARCH),powerpc)
ifndef NO_DWARF
CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
@@ -411,6 +417,17 @@ ifndef NO_LIBAUDIT
endif
endif
+ifndef NO_LIBCRYPTO
+ ifneq ($(feature-libcrypto), 1)
+ msg := $(warning No libcrypto.h found, disables jitted code injection, please install libssl-devel or libssl-dev);
+ NO_LIBCRYPTO := 1
+ else
+ CFLAGS += -DHAVE_LIBCRYPTO_SUPPORT
+ EXTLIBS += -lcrypto
+ $(call detected,CONFIG_CRYPTO)
+ endif
+endif
+
ifdef NO_NEWT
NO_SLANG=1
endif
diff --git a/tools/perf/config/utilities.mak b/tools/perf/config/utilities.mak
deleted file mode 100644
index c16ce8330..000000000
--- a/tools/perf/config/utilities.mak
+++ /dev/null
@@ -1,179 +0,0 @@
-# This allows us to work with the newline character:
-define newline
-
-
-endef
-newline := $(newline)
-
-# nl-escape
-#
-# Usage: escape = $(call nl-escape[,escape])
-#
-# This is used as the common way to specify
-# what should replace a newline when escaping
-# newlines; the default is a bizarre string.
-#
-nl-escape = $(if $(1),$(1),m822df3020w6a44id34bt574ctac44eb9f4n)
-
-# escape-nl
-#
-# Usage: escaped-text = $(call escape-nl,text[,escape])
-#
-# GNU make's $(shell ...) function converts to a
-# single space each newline character in the output
-# produced during the expansion; this may not be
-# desirable.
-#
-# The only solution is to change each newline into
-# something that won't be converted, so that the
-# information can be recovered later with
-# $(call unescape-nl...)
-#
-escape-nl = $(subst $(newline),$(call nl-escape,$(2)),$(1))
-
-# unescape-nl
-#
-# Usage: text = $(call unescape-nl,escaped-text[,escape])
-#
-# See escape-nl.
-#
-unescape-nl = $(subst $(call nl-escape,$(2)),$(newline),$(1))
-
-# shell-escape-nl
-#
-# Usage: $(shell some-command | $(call shell-escape-nl[,escape]))
-#
-# Use this to escape newlines from within a shell call;
-# the default escape is a bizarre string.
-#
-# NOTE: The escape is used directly as a string constant
-# in an `awk' program that is delimited by shell
-# single-quotes, so be wary of the characters
-# that are chosen.
-#
-define shell-escape-nl
-awk 'NR==1 {t=$$0} NR>1 {t=t "$(nl-escape)" $$0} END {printf t}'
-endef
-
-# shell-unescape-nl
-#
-# Usage: $(shell some-command | $(call shell-unescape-nl[,escape]))
-#
-# Use this to unescape newlines from within a shell call;
-# the default escape is a bizarre string.
-#
-# NOTE: The escape is used directly as an extended regular
-# expression constant in an `awk' program that is
-# delimited by shell single-quotes, so be wary
-# of the characters that are chosen.
-#
-# (The bash shell has a bug where `{gsub(...),...}' is
-# misinterpreted as a brace expansion; this can be
-# overcome by putting a space between `{' and `gsub').
-#
-define shell-unescape-nl
-awk 'NR==1 {t=$$0} NR>1 {t=t "\n" $$0} END { gsub(/$(nl-escape)/,"\n",t); printf t }'
-endef
-
-# escape-for-shell-sq
-#
-# Usage: embeddable-text = $(call escape-for-shell-sq,text)
-#
-# This function produces text that is suitable for
-# embedding in a shell string that is delimited by
-# single-quotes.
-#
-escape-for-shell-sq = $(subst ','\'',$(1))
-
-# shell-sq
-#
-# Usage: single-quoted-and-escaped-text = $(call shell-sq,text)
-#
-shell-sq = '$(escape-for-shell-sq)'
-
-# shell-wordify
-#
-# Usage: wordified-text = $(call shell-wordify,text)
-#
-# For instance:
-#
-# |define text
-# |hello
-# |world
-# |endef
-# |
-# |target:
-# | echo $(call shell-wordify,$(text))
-#
-# At least GNU make gets confused by expanding a newline
-# within the context of a command line of a makefile rule
-# (this is in constrast to a `$(shell ...)' function call,
-# which can handle it just fine).
-#
-# This function avoids the problem by producing a string
-# that works as a shell word, regardless of whether or
-# not it contains a newline.
-#
-# If the text to be wordified contains a newline, then
-# an intrictate shell command substitution is constructed
-# to render the text as a single line; when the shell
-# processes the resulting escaped text, it transforms
-# it into the original unescaped text.
-#
-# If the text does not contain a newline, then this function
-# produces the same results as the `$(shell-sq)' function.
-#
-shell-wordify = $(if $(findstring $(newline),$(1)),$(_sw-esc-nl),$(shell-sq))
-define _sw-esc-nl
-"$$(echo $(call escape-nl,$(shell-sq),$(2)) | $(call shell-unescape-nl,$(2)))"
-endef
-
-# is-absolute
-#
-# Usage: bool-value = $(call is-absolute,path)
-#
-is-absolute = $(shell echo $(shell-sq) | grep -q ^/ && echo y)
-
-# lookup
-#
-# Usage: absolute-executable-path-or-empty = $(call lookup,path)
-#
-# (It's necessary to use `sh -c' because GNU make messes up by
-# trying too hard and getting things wrong).
-#
-lookup = $(call unescape-nl,$(shell sh -c $(_l-sh)))
-_l-sh = $(call shell-sq,command -v $(shell-sq) | $(call shell-escape-nl,))
-
-# is-executable
-#
-# Usage: bool-value = $(call is-executable,path)
-#
-# (It's necessary to use `sh -c' because GNU make messes up by
-# trying too hard and getting things wrong).
-#
-is-executable = $(call _is-executable-helper,$(shell-sq))
-_is-executable-helper = $(shell sh -c $(_is-executable-sh))
-_is-executable-sh = $(call shell-sq,test -f $(1) -a -x $(1) && echo y)
-
-# get-executable
-#
-# Usage: absolute-executable-path-or-empty = $(call get-executable,path)
-#
-# The goal is to get an absolute path for an executable;
-# the `command -v' is defined by POSIX, but it's not
-# necessarily very portable, so it's only used if
-# relative path resolution is requested, as determined
-# by the presence of a leading `/'.
-#
-get-executable = $(if $(1),$(if $(is-absolute),$(_ge-abspath),$(lookup)))
-_ge-abspath = $(if $(is-executable),$(1))
-
-# get-supplied-or-default-executable
-#
-# Usage: absolute-executable-path-or-empty = $(call get-executable-or-default,variable,default)
-#
-define get-executable-or-default
-$(if $($(1)),$(call _ge_attempt,$($(1)),$(1)),$(call _ge_attempt,$(2)))
-endef
-_ge_attempt = $(if $(get-executable),$(get-executable),$(call _gea_err,$(2)))
-_gea_err = $(if $(1),$(error Please set '$(1)' appropriately))