Skip to contentSkip to conversation

perf: integrate with kconfig and CONFIG driven features

PATCH In review David Ahern 2 participants 32 messages Apr 2, 2013 – Apr 4, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover perf: integrate with kconfig and CONFIG driven features

Patches can also be retrieved from:
https://github.com/dsahern/linux.git perf-config

I still need to add the conf build targets from the top level Makefile.

For this RFC series, you can run the commands manually to generate the .config file for perf and the corresponding include/config/auto.conf and include/generated/autoconf.h files.

To build conf (if it already exists in kernel tree jump to the conf commands below):

BLDDIR=/tmp/perf-build
SRCDIR=/path/to/kernel.git

BLDDIR=/tmp/perf
SRCDIR=/opt/sw/perf/ahern.git

mkdir $BLDDIR
cd $BLDDIR
mkdir -p include/config include/generated
rsync -av $SRCDIR/scripts/ scripts/
ln -s $SRCDIR source
cd $SRCDIR
make O=$BLDDIR V=1 scripts/kconfig conf

Ignore the .config errors - those relate to the kernel build. What matters here is that conf is built.

cd $BLDDIR
touch .config
PATH=$BLDDIR/scripts/kconfig:$PATH ARCH=x86 conf --silentoldconfig $SRCDIR/tools/perf/Pconfig

At this point you are asked what options to enable:

Enable newt-based TUI (NEWT) [N/y] (NEW) y
Enable GTK-based UI (GTK2) [N/y] (NEW) n
Enable support for Bionic (e.g., Android platform) (BIONIC) [N/y] (NEW) Development support for libc is available - glibc or bionic (LIBC) [N/y] (NEW) y
Enable support for libelf (LIBELF) [N/y] (NEW) y
Enable support for libunwind (LIBUNWIND) [N/y] (NEW) y
Enable support for dwarf (DWARF) [N/y] (NEW) y
Enable support for demangle (DEMANGLE) [N/y] (NEW) y
Enable support for perl scripting engine (LIBPERL) [N/y] (NEW) y Enable support for python scripting engine (LIBPYTHON) [N/y] (NEW) y Enable support for libaudit (LIBAUDIT) [N/y/?] (NEW) y
Enable support for libnuma (LIBNUMA) [N/y/?] (NEW) y
Enable support for stack backtrace debugging (BACKTRACE) [N/y] (NEW) y \#
\# configuration written to .config
\#

Now build it:
cd $SRCDIR

make -C tools/perf O=$BLDDIR DESTDIR=/tmp/perf-install -j 4

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>

---
David Ahern (23):
perf: initial infrasructure for kconfig
perf: make perl support based on CONFIG_LIBPERL
perf: make python support based on CONFIG_LIBPYTHON
perf: make gtk2 support based on CONFIG_GTK2
perf: make newt support based on CONFIG_NEWT
perf: remove NEWT_SUPPORT in favor of CONFIG_NEWT
perf: remove GTK2_SUPPORT in favor of CONFIG_GTK2
perf: make elf support based on CONFIG_LIBELF
perf: make cfi unwind support based on CONFIG_LIBUNWIND
perf: make demangle support based on CONFIG_DEMANGLE
perf: make dwarf support based on CONFIG_DWARF
perf: config: add BIONIC config option
perf config: make numa support based on CONFIG_LIBNUMA perf config: make backtrace support based on CONFIG_BACKTRACE
perf: make libaudit support based on CONFIG_LIBAUDIT
perf: consolidate CONFIG_LIBUNWIND checks in Makefile
perf: remove LIBUNWIND_SUPPORT in favor of CONFIG_LIBUNWIND
perf: deprecate LIBELF_SUPPORT in favor of CONFIG_LIBELF
perf: deprecate DWARF_SUPPORT in favor of CONFIG_DWARF
perf: consolidate CONFIG_LIBELF checks in Makefile
perf: consolidate CONFIG_DWARF checks in Makefile
perf: Makefile: only add elf to EXTLIBS if CONFIG_LIBELF is set
perf: only add elf-based object files if CONFIG_LIBELF is set

 tools/perf/Makefile                     |  512 ++++++++++++++-----------------
 tools/perf/Pconfig                      |   59 ++++
 tools/perf/arch/arm/Makefile            |    2 +-
 tools/perf/arch/powerpc/Makefile        |    2 +-
 tools/perf/arch/s390/Makefile           |    2 +-
 tools/perf/arch/sh/Makefile             |    2 +-
 tools/perf/arch/sparc/Makefile          |    2 +-
 tools/perf/arch/x86/Makefile            |    4 +-
 tools/perf/builtin-bench.c              |    5 +-
 tools/perf/builtin-inject.c             |    3 +-
 tools/perf/builtin-probe.c              |   15 +-
 tools/perf/builtin-record.c             |   11 +-
 tools/perf/builtin-script.c             |    5 +-
 tools/perf/config/feature-tests.mak     |   18 +-
 tools/perf/perf.c                       |    5 +-
 tools/perf/ui/ui.h                      |    5 +-
 tools/perf/util/annotate.h              |    5 +-
 tools/perf/util/generate-cmdlist.sh     |    4 +-
 tools/perf/util/hist.h                  |    5 +-
 tools/perf/util/include/dwarf-regs.h    |    4 +-
 tools/perf/util/map.c                   |    3 +-
 tools/perf/util/probe-event.c           |    5 +-
 tools/perf/util/probe-finder.h          |    5 +-
 tools/perf/util/symbol.h                |    7 +-
 tools/perf/util/trace-event-scripting.c |   30 +-
 tools/perf/util/unwind.h                |    5 +-
 tools/perf/util/util.c                  |    5 +-
 27 files changed, 379 insertions(+), 351 deletions(-)
 create mode 100644 tools/perf/Pconfig
Signature · 1 line
1.7.10.1
#1 lore raw

PATCH 1/23 perf: initial infrasructure for kconfig

Add Pconfig file which will hold the build options. Update Makefile with new config files.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile |    5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 tools/perf/Pconfig
tools/perf/Makefile +5 -0
index bb74c79..4e54d05 100644
@@ -5,6 +5,9 @@ all:
 
 include config/utilities.mak
 
+# Read in config if it exists
+-include $(OUTPUT)include/config/auto.conf
+
 # Define V to have a more verbose compile.
 #
 # Define O to save output files in a separate directory.
@@ -203,6 +206,7 @@ ifneq ($(OUTPUT),)
 endif
 
 BASIC_CFLAGS = \
+	-I$(OUTPUT)include \
 	-Iutil/include \
 	-Iarch/$(ARCH)/include \
 	$(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \
@@ -409,6 +413,7 @@ LIB_H += ui/helpline.h
 LIB_H += ui/progress.h
 LIB_H += ui/util.h
 LIB_H += ui/ui.h
+LIB_H += $(OUTPUT)include/generated/autoconf.h
 
 LIB_OBJS += $(OUTPUT)util/abspath.o
 LIB_OBJS += $(OUTPUT)util/alias.o
tools/perf/Pconfig new file +0 -0
new file mode 100644
index 0000000..e69de29
Signature · 1 line
1.7.10.1
#2 lore raw

Re: [PATCH 01/23] perf: initial infrasructure for kconfig

Quoted 13 lines · David Ahern

Add Pconfig file which will hold the build options. Update Makefile with new config files.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
Quoted 4 lines
---
 tools/perf/Makefile |    5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 tools/perf/Pconfig

All current Kconfig files can be found with git ls-files "*Kconfig*". This file won't. Why does it need to be named differently?

Paul Bolle

#3 lore raw

Re: [PATCH 01/23] perf: initial infrasructure for kconfig

Quoted 6 lines · Paul Bolle
Quoted 3 lines
  tools/perf/Makefile |    5 +++++
  1 file changed, 5 insertions(+)

create mode 100644 tools/perf/Pconfig

All current Kconfig files can be found with git ls-files "*Kconfig*". This file won't. Why does it need to be named differently?

It does not. I will rename to Kconfig.

David

#4 lore raw

PATCH 2/23 perf: make perl support based on CONFIG_LIBPERL

In reply to David Ahern
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile                     |   34 ++++++++++++++-----------------
 tools/perf/Pconfig                      |    2 ++
 tools/perf/builtin-script.c             |    3 ++-
 tools/perf/config/feature-tests.mak     |    4 ++--
 tools/perf/util/trace-event-scripting.c |   13 ++++++------
 5 files changed, 28 insertions(+), 28 deletions(-)
tools/perf/Makefile +15 -19
index 4e54d05..af7b746 100644
@@ -16,8 +16,6 @@ include config/utilities.mak
 #
 # Define CROSS_COMPILE as prefix name of compiler if you want cross-builds.
 #
-# Define NO_LIBPERL to disable perl script extension.
-#
 # Define NO_LIBPYTHON to disable python script extension.
 #
 # Define PYTHON to point to the python binary if the default
@@ -718,23 +716,21 @@ ifndef NO_GTK2
 	endif
 endif
 
-ifdef NO_LIBPERL
-	BASIC_CFLAGS += -DNO_LIBPERL
-else
-       PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
-       PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
-       PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
-	PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
-	FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
-
-	ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED),perl),y)
-		BASIC_CFLAGS += -DNO_LIBPERL
-	else
-               ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS)
-               EXTLIBS += $(PERL_EMBED_LIBADD)
-		LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o
-		LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o
-	endif
+ifdef CONFIG_LIBPERL
+    PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
+    PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
+    PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
+    PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
+    FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
+
+    ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED)),y)
+        $(error perl module ExtUtils::Embed not installed. Install it or unset CONFIG_LIBPERL to continue)
+    endif
+
+    ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS)
+    EXTLIBS += $(PERL_EMBED_LIBADD)
+    LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o
+    LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o
 endif
 
 disable-python = $(eval $(disable-python_code))
tools/perf/Pconfig +2 -0
index e69de29..a636af3 100644
@@ -0,0 +1,2 @@
+config LIBPERL
+    bool "Enable support for perl scripting engine"
tools/perf/builtin-script.c +2 -1
index 92d4658..7841533 100644
@@ -16,6 +16,7 @@
 #include "util/evsel.h"
 #include "util/sort.h"
 #include <linux/bitmap.h>
+#include <linux/kconfig.h>
 
 static char const		*script_name;
 static char const		*generate_script_lang;
@@ -1110,7 +1111,7 @@ int find_scripts(char **scripts_array, char **scripts_path_array)
 	for_each_lang(scripts_path, scripts_dir, lang_dirent, lang_next) {
 		snprintf(lang_path, MAXPATHLEN, "%s/%s", scripts_path,
 			 lang_dirent.d_name);
-#ifdef NO_LIBPERL
+#ifndef CONFIG_LIBPERL
 		if (strstr(lang_path, "perl"))
 			continue;
 #endif
tools/perf/config/feature-tests.mak +2 -2
index b4eabb4..1222b33 100644
@@ -102,7 +102,7 @@ int main(void)
 endef
 endif
 
-ifndef NO_LIBPERL
+ifdef CONFIG_LIBPERL
 define SOURCE_PERL_EMBED
 #include <EXTERN.h>
 #include <perl.h>
@@ -235,4 +235,4 @@ int main(void)
 	numa_available();
 	return 0;
 }
-endef
\ No newline at end of file
+endef
tools/perf/util/trace-event-scripting.c +7 -6
index 8715a10..3343d97 100644
@@ -27,6 +27,7 @@
 #include "../perf.h"
 #include "util.h"
 #include "trace-event.h"
+#include <linux/kconfig.h>
 
 struct scripting_context *scripting_context;
 
@@ -110,7 +111,7 @@ void setup_python_scripting(void)
 static void print_perl_unsupported_msg(void)
 {
 	fprintf(stderr, "Perl scripting not supported."
-		"  Install libperl and rebuild perf to enable it.\n"
+		"  Enable CONFIG_LIBPERL and rebuild perf.\n"
 		"For example:\n  # apt-get install libperl-dev (ubuntu)"
 		"\n  # yum install 'perl(ExtUtils::Embed)' (Fedora)"
 		"\n  etc.\n");
@@ -156,16 +157,16 @@ static void register_perl_scripting(struct scripting_ops *scripting_ops)
 	scripting_context = malloc(sizeof(struct scripting_context));
 }
 
-#ifdef NO_LIBPERL
+#ifdef CONFIG_LIBPERL
+extern struct scripting_ops perl_scripting_ops;
+
 void setup_perl_scripting(void)
 {
-	register_perl_scripting(&perl_scripting_unsupported_ops);
+	register_perl_scripting(&perl_scripting_ops);
 }
 #else
-extern struct scripting_ops perl_scripting_ops;
-
 void setup_perl_scripting(void)
 {
-	register_perl_scripting(&perl_scripting_ops);
+	register_perl_scripting(&perl_scripting_unsupported_ops);
 }
 #endif
Signature · 1 line
1.7.10.1
#5 lore raw

PATCH 3/23 perf: make python support based on CONFIG_LIBPYTHON

In reply to David Ahern
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile                     |  105 +++++++++++++++----------------
 tools/perf/Pconfig                      |    3 +
 tools/perf/builtin-script.c             |    2 +-
 tools/perf/config/feature-tests.mak     |    2 +-
 tools/perf/util/trace-event-scripting.c |   17 +++--
 5 files changed, 61 insertions(+), 68 deletions(-)
tools/perf/Makefile +49 -56
index af7b746..2225c3d 100644
@@ -16,8 +16,6 @@ include config/utilities.mak
 #
 # Define CROSS_COMPILE as prefix name of compiler if you want cross-builds.
 #
-# Define NO_LIBPYTHON to disable python script extension.
-#
 # Define PYTHON to point to the python binary if the default
 # `python' is not correct; for example: PYTHON=python2
 #
@@ -733,69 +731,64 @@ ifdef CONFIG_LIBPERL
     LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o
 endif
 
-disable-python = $(eval $(disable-python_code))
-define disable-python_code
-  BASIC_CFLAGS += -DNO_LIBPYTHON
-  $(if $(1),$(warning No $(1) was found))
-  $(warning Python support will not be built)
-endef
+ifdef CONFIG_LIBPYTHON
+    override PYTHON := \
+        $(call get-executable-or-default,PYTHON,python)
 
-override PYTHON := \
-  $(call get-executable-or-default,PYTHON,python)
+    ifndef PYTHON
+        $(error python interpreter not found. Install it or unset CONFIG_LIBPYTHON to continue.)
+    endif
 
-ifndef PYTHON
-  $(call disable-python,python interpreter)
-else
+    PYTHON_WORD := $(call shell-wordify,$(PYTHON))
 
-  PYTHON_WORD := $(call shell-wordify,$(PYTHON))
+    # python extension build directories
+    PYTHON_EXTBUILD     := $(OUTPUT)python_ext_build/
+    PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
+    PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
+    export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
 
-  ifdef NO_LIBPYTHON
-    $(call disable-python)
-  else
+    python-clean := rm -rf $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so
 
     override PYTHON_CONFIG := \
-      $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config)
+        $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config)
 
     ifndef PYTHON_CONFIG
-      $(call disable-python,python-config tool)
-    else
-
-      PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
-
-      PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
-      PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
-      PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
-      PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
-      FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
-
-      ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED),python),y)
-        $(call disable-python,Python.h (for Python 2.x))
-      else
-
-        ifneq ($(call try-cc,$(SOURCE_PYTHON_VERSION),$(FLAGS_PYTHON_EMBED),python version),y)
-          $(warning Python 3 is not yet supported; please set)
-          $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
-          $(warning If you also have Python 2 installed, then)
-          $(warning try something like:)
-          $(warning $(and ,))
-          $(warning $(and ,)  make PYTHON=python2)
-          $(warning $(and ,))
-          $(warning Otherwise, disable Python support entirely:)
-          $(warning $(and ,))
-          $(warning $(and ,)  make NO_LIBPYTHON=1)
-          $(warning $(and ,))
-          $(error   $(and ,))
-        else
-          ALL_LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
-          EXTLIBS += $(PYTHON_EMBED_LIBADD)
-          LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o
-          LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o
-          LANG_BINDINGS += $(OUTPUT)python/perf.so
-        endif
-
-      endif
+        $(error python-config not found. Install it or unset CONFIG_LIBPYTHON to continue.)
     endif
-  endif
+
+    PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
+
+    PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
+    PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
+    PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
+    PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
+    FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
+
+    ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED)),y)
+        $(warning Failed to detect python development kit.)
+        $(warning Install it or unset CONFIG_LIBPYTHON to continue.)
+        $(warning e.g., apt-get install python-dev (ubuntu).)
+        $(warning       yum install python-devel (Fedora).)
+        $(error )
+    endif
+
+    ifneq ($(call try-cc,$(SOURCE_PYTHON_VERSION),$(FLAGS_PYTHON_EMBED),python version),y)
+        $(warning Python 3 is not yet supported; please set)
+        $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
+        $(warning If you also have Python 2 installed, then)
+        $(warning try something like:)
+        $(warning $(and ,))
+        $(warning $(and ,)  make PYTHON=python2)
+        $(warning $(and ,))
+        $(warning Otherwise, disable Python support entirely by unsetting CONFIG_LIBPYTHON.)
+        $(error   $(and ,))
+    endif
+
+    ALL_LDFLAGS   += $(PYTHON_EMBED_LDFLAGS)
+    EXTLIBS       += $(PYTHON_EMBED_LIBADD)
+    LIB_OBJS      += $(OUTPUT)util/scripting-engines/trace-event-python.o
+    LIB_OBJS      += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o
+    LANG_BINDINGS += $(OUTPUT)python/perf.so
 endif
 
 ifdef NO_DEMANGLE
tools/perf/Pconfig +3 -0
index a636af3..67ae110 100644
@@ -1,2 +1,5 @@
 config LIBPERL
     bool "Enable support for perl scripting engine"
+
+config LIBPYTHON
+    bool "Enable support for python scripting engine"
tools/perf/builtin-script.c +1 -1
index 7841533..e57b87d 100644
@@ -1115,7 +1115,7 @@ int find_scripts(char **scripts_array, char **scripts_path_array)
 		if (strstr(lang_path, "perl"))
 			continue;
 #endif
-#ifdef NO_LIBPYTHON
+#ifndef CONFIG_LIBPYTHON
 		if (strstr(lang_path, "python"))
 			continue;
 #endif
tools/perf/config/feature-tests.mak +1 -1
index 1222b33..2a2fa3b 100644
@@ -115,7 +115,7 @@ return 0;
 endef
 endif
 
-ifndef NO_LIBPYTHON
+ifdef CONFIG_LIBPYTHON
 define SOURCE_PYTHON_VERSION
 #include <Python.h>
 #if PY_VERSION_HEX >= 0x03000000
tools/perf/util/trace-event-scripting.c +7 -10
index 3343d97..932d480 100644
@@ -46,11 +46,8 @@ static void process_event_unsupported(union perf_event *event __maybe_unused,
 
 static void print_python_unsupported_msg(void)
 {
-	fprintf(stderr, "Python scripting not supported."
-		"  Install libpython and rebuild perf to enable it.\n"
-		"For example:\n  # apt-get install python-dev (ubuntu)"
-		"\n  # yum install python-devel (Fedora)"
-		"\n  etc.\n");
+	fprintf(stderr, "Python scripting not supported.\n"
+		"Enable CONFIG_LIBPYTHON and rebuild perf to enable it.\n");
 }
 
 static int python_start_script_unsupported(const char *script __maybe_unused,
@@ -94,17 +91,17 @@ static void register_python_scripting(struct scripting_ops *scripting_ops)
 	scripting_context = malloc(sizeof(struct scripting_context));
 }
 
-#ifdef NO_LIBPYTHON
+#ifdef CONFIG_LIBPYTHON
+extern struct scripting_ops python_scripting_ops;
+
 void setup_python_scripting(void)
 {
-	register_python_scripting(&python_scripting_unsupported_ops);
+	register_python_scripting(&python_scripting_ops);
 }
 #else
-extern struct scripting_ops python_scripting_ops;
-
 void setup_python_scripting(void)
 {
-	register_python_scripting(&python_scripting_ops);
+	register_python_scripting(&python_scripting_unsupported_ops);
 }
 #endif
 
Signature · 1 line
1.7.10.1
#6 lore raw

PATCH 4/23 perf: make gtk2 support based on CONFIG_GTK2

In reply to David Ahern
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile                 |   39 ++++++++++++++++-------------------
 tools/perf/Pconfig                  |    3 +++
 tools/perf/config/feature-tests.mak |    2 +-
 3 files changed, 22 insertions(+), 22 deletions(-)
tools/perf/Makefile +18 -21
index 2225c3d..01e2abf 100644
@@ -36,8 +36,6 @@ include config/utilities.mak
 #
 # Define NO_NEWT if you do not want TUI support.
 #
-# Define NO_GTK2 if you do not want GTK+ GUI support.
-#
 # Define NO_DEMANGLE if you do not want C++ symbol demangling.
 #
 # Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
@@ -693,25 +691,24 @@ ifndef NO_NEWT
 	endif
 endif
 
-ifndef NO_GTK2
-	FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
-	ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y)
-		msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
-	else
-		ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y)
-			BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR
-		endif
-		BASIC_CFLAGS += -DGTK2_SUPPORT
-		BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
-		EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
-		LIB_OBJS += $(OUTPUT)ui/gtk/browser.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/hists.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/setup.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/util.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/progress.o
-		LIB_OBJS += $(OUTPUT)ui/gtk/annotate.o
-	endif
+ifdef CONFIG_GTK2
+    FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
+    ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y)
+        $(error GTK2 not found. Please install gtk2-devel or libgtk2.0-dev or unset CONFIG_GTK2)
+    endif
+    ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y)
+        BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR
+    endif
+    BASIC_CFLAGS += -DGTK2_SUPPORT
+    BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
+    EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
+    LIB_OBJS += $(OUTPUT)ui/gtk/browser.o
+    LIB_OBJS += $(OUTPUT)ui/gtk/hists.o
+    LIB_OBJS += $(OUTPUT)ui/gtk/setup.o
+    LIB_OBJS += $(OUTPUT)ui/gtk/util.o
+    LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o
+    LIB_OBJS += $(OUTPUT)ui/gtk/progress.o
+    LIB_OBJS += $(OUTPUT)ui/gtk/annotate.o
 endif
 
 ifdef CONFIG_LIBPERL
tools/perf/Pconfig +3 -0
index 67ae110..79e1fc3 100644
@@ -1,3 +1,6 @@
+config GTK2
+    bool "Enable GTK-based UI"
+
 config LIBPERL
     bool "Enable support for perl scripting engine"
 
tools/perf/config/feature-tests.mak +1 -1
index 2a2fa3b..bf906e8 100644
@@ -74,7 +74,7 @@ int main(void)
 endef
 endif
 
-ifndef NO_GTK2
+ifdef CONFIG_GTK2
 define SOURCE_GTK2
 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
 #include <gtk/gtk.h>
Signature · 1 line
1.7.10.1
#7 lore raw

PATCH 5/23 perf: make newt support based on CONFIG_NEWT

In reply to David Ahern
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile                 |   46 +++++++++++++++++------------------
 tools/perf/Pconfig                  |    3 +++
 tools/perf/config/feature-tests.mak |    2 +-
 3 files changed, 26 insertions(+), 25 deletions(-)
tools/perf/Makefile +22 -24
index 01e2abf..f4c3b02 100644
@@ -34,8 +34,6 @@ include config/utilities.mak
 #
 # Define WERROR=0 to disable treating any warnings as errors.
 #
-# Define NO_NEWT if you do not want TUI support.
-#
 # Define NO_DEMANGLE if you do not want C++ symbol demangling.
 #
 # Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
@@ -666,29 +664,29 @@ ifndef NO_LIBAUDIT
 	endif
 endif
 
-ifndef NO_NEWT
+ifdef CONFIG_NEWT
 	FLAGS_NEWT=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -lnewt
-	ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT),libnewt),y)
-		msg := $(warning newt not found, disables TUI support. Please install newt-devel or libnewt-dev);
-	else
-		# Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
-		BASIC_CFLAGS += -I/usr/include/slang
-		BASIC_CFLAGS += -DNEWT_SUPPORT
-		EXTLIBS += -lnewt -lslang
-		LIB_OBJS += $(OUTPUT)ui/browser.o
-		LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o
-		LIB_OBJS += $(OUTPUT)ui/browsers/hists.o
-		LIB_OBJS += $(OUTPUT)ui/browsers/map.o
-		LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o
-		LIB_OBJS += $(OUTPUT)ui/tui/setup.o
-		LIB_OBJS += $(OUTPUT)ui/tui/util.o
-		LIB_OBJS += $(OUTPUT)ui/tui/helpline.o
-		LIB_OBJS += $(OUTPUT)ui/tui/progress.o
-		LIB_H += ui/browser.h
-		LIB_H += ui/browsers/map.h
-		LIB_H += ui/keysyms.h
-		LIB_H += ui/libslang.h
-	endif
+    ifneq ($(call try-cc,$(SOURCE_NEWT),$(FLAGS_NEWT),libnewt),y)
+        $(error newt not found. Please install newt-devel or libnewt-dev or disable CONFIG_NEWT)
+    endif
+
+    # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
+    BASIC_CFLAGS += -I/usr/include/slang
+    BASIC_CFLAGS += -DNEWT_SUPPORT
+    EXTLIBS += -lnewt -lslang
+    LIB_OBJS += $(OUTPUT)ui/browser.o
+    LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o
+    LIB_OBJS += $(OUTPUT)ui/browsers/hists.o
+    LIB_OBJS += $(OUTPUT)ui/browsers/map.o
+    LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o
+    LIB_OBJS += $(OUTPUT)ui/tui/setup.o
+    LIB_OBJS += $(OUTPUT)ui/tui/util.o
+    LIB_OBJS += $(OUTPUT)ui/tui/helpline.o
+    LIB_OBJS += $(OUTPUT)ui/tui/progress.o
+    LIB_H += ui/browser.h
+    LIB_H += ui/browsers/map.h
+    LIB_H += ui/keysyms.h
+    LIB_H += ui/libslang.h
 endif
 
 ifdef CONFIG_GTK2
tools/perf/Pconfig +3 -0
index 79e1fc3..367cc65 100644
@@ -1,3 +1,6 @@
+config NEWT
+    bool "Enable newt-based TUI"
+
 config GTK2
     bool "Enable GTK-based UI"
 
tools/perf/config/feature-tests.mak +1 -1
index bf906e8..7ec044f 100644
@@ -61,7 +61,7 @@ int main(void)
 }
 endef
 
-ifndef NO_NEWT
+ifdef CONFIG_NEWT
 define SOURCE_NEWT
 #include <newt.h>
 
Signature · 1 line
1.7.10.1
#8 lore raw

PATCH 6/23 perf: remove NEWT_SUPPORT in favor of CONFIG_NEWT

In reply to David Ahern
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile        |    1 -
 tools/perf/ui/ui.h         |    3 ++-
 tools/perf/util/annotate.h |    3 ++-
 tools/perf/util/hist.h     |    3 ++-
 4 files changed, 6 insertions(+), 4 deletions(-)
tools/perf/Makefile +0 -1
index f4c3b02..0cee87c 100644
@@ -672,7 +672,6 @@ ifdef CONFIG_NEWT
 
     # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
     BASIC_CFLAGS += -I/usr/include/slang
-    BASIC_CFLAGS += -DNEWT_SUPPORT
     EXTLIBS += -lnewt -lslang
     LIB_OBJS += $(OUTPUT)ui/browser.o
     LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o
tools/perf/ui/ui.h +2 -1
index d86359c..b030017 100644
@@ -4,6 +4,7 @@
 #include <pthread.h>
 #include <stdbool.h>
 #include <linux/compiler.h>
+#include <linux/kconfig.h>
 
 extern pthread_mutex_t ui__lock;
 
@@ -12,7 +13,7 @@ extern int use_browser;
 void setup_browser(bool fallback_to_pager);
 void exit_browser(bool wait_for_ok);
 
-#ifdef NEWT_SUPPORT
+#ifdef CONFIG_NEWT
 int ui__init(void);
 void ui__exit(bool wait_for_ok);
 #else
tools/perf/util/annotate.h +2 -1
index c422440..0435758 100644
@@ -10,6 +10,7 @@
 #include <linux/list.h>
 #include <linux/rbtree.h>
 #include <pthread.h>
+#include <linux/kconfig.h>
 
 struct ins;
 
@@ -141,7 +142,7 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map, int evidx,
 			 bool print_lines, bool full_paths, int min_pcnt,
 			 int max_lines);
 
-#ifdef NEWT_SUPPORT
+#ifdef CONFIG_NEWT
 int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
 			 struct hist_browser_timer *hbt);
 #else
tools/perf/util/hist.h +2 -1
index 226a4ae..83c1627 100644
@@ -5,6 +5,7 @@
 #include <pthread.h>
 #include "callchain.h"
 #include "header.h"
+#include <linux/kconfig.h>
 
 extern struct callchain_param callchain_param;
 
@@ -175,7 +176,7 @@ struct hist_browser_timer {
 	int refresh;
 };
 
-#ifdef NEWT_SUPPORT
+#ifdef CONFIG_NEWT
 #include "../ui/keysyms.h"
 int hist_entry__tui_annotate(struct hist_entry *he, int evidx,
 			     struct hist_browser_timer *hbt);
Signature · 1 line
1.7.10.1
#9 lore raw

PATCH 7/23 perf: remove GTK2_SUPPORT in favor of CONFIG_GTK2

In reply to David Ahern
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile        |    1 -
 tools/perf/ui/ui.h         |    2 +-
 tools/perf/util/annotate.h |    2 +-
 tools/perf/util/hist.h     |    2 +-
 4 files changed, 3 insertions(+), 4 deletions(-)
tools/perf/Makefile +0 -1
index 0cee87c..0060275 100644
@@ -696,7 +696,6 @@ ifdef CONFIG_GTK2
     ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y)
         BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR
     endif
-    BASIC_CFLAGS += -DGTK2_SUPPORT
     BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
     EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
     LIB_OBJS += $(OUTPUT)ui/gtk/browser.o
tools/perf/ui/ui.h +1 -1
index b030017..5f3465c 100644
@@ -24,7 +24,7 @@ static inline int ui__init(void)
 static inline void ui__exit(bool wait_for_ok __maybe_unused) {}
 #endif
 
-#ifdef GTK2_SUPPORT
+#ifdef CONFIG_GTK2
 int perf_gtk__init(void);
 void perf_gtk__exit(bool wait_for_ok);
 #else
tools/perf/util/annotate.h +1 -1
index 0435758..2a2e413 100644
@@ -156,7 +156,7 @@ static inline int symbol__tui_annotate(struct symbol *sym __maybe_unused,
 }
 #endif
 
-#ifdef GTK2_SUPPORT
+#ifdef CONFIG_GTK2
 int symbol__gtk_annotate(struct symbol *sym, struct map *map, int evidx,
 			 struct hist_browser_timer *hbt);
 
tools/perf/util/hist.h +1 -1
index 83c1627..e1c2182 100644
@@ -214,7 +214,7 @@ static inline int script_browse(const char *script_opt __maybe_unused)
 #define K_SWITCH_INPUT_DATA -3000
 #endif
 
-#ifdef GTK2_SUPPORT
+#ifdef CONFIG_GTK2
 int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist, const char *help,
 				  struct hist_browser_timer *hbt __maybe_unused);
 #else
Signature · 1 line
1.7.10.1
#10 lore raw

PATCH 8/23 perf: make elf support based on CONFIG_LIBELF

In reply to David Ahern

Add CONFIG_LIBC as well. It is only used to determine if lack of elf support is due to support missing for libc or libelf.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile |  103 +++++++++++++++++++++++----------------------------
 tools/perf/Pconfig  |    7 ++++
 2 files changed, 54 insertions(+), 56 deletions(-)
tools/perf/Makefile +47 -56
index 0060275..9bb12b5 100644
@@ -36,8 +36,6 @@ include config/utilities.mak
 #
 # Define NO_DEMANGLE if you do not want C++ symbol demangling.
 #
-# Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
-#
 # Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf
 # backtrace post unwind.
 #
@@ -545,30 +543,22 @@ ifneq ($(MAKECMDGOALS),tags)
 # because maintaining the nesting to match is a pain.  If
 # we had "elif" things would have been much nicer...
 
-ifdef NO_LIBELF
-	NO_DWARF := 1
-	NO_DEMANGLE := 1
-	NO_LIBUNWIND := 1
-else
-FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
-ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
-	FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)
-	ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y)
-		LIBC_SUPPORT := 1
-	endif
-	ifeq ($(BIONIC),1)
-		LIBC_SUPPORT := 1
-	endif
-	ifeq ($(LIBC_SUPPORT),1)
-		msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev);
+ifdef CONFIG_LIBELF
+    FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+
+    # try to compile with libelf support ...
+    ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
+        FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)
+        # ... it failed. Is the failure due to missing libc or libelf
+        # development support?
+        ifneq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y)
+            $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static or disable CONFIG_LIBC)
+        endif
+
+        # libelf not installed
+        $(error No libelf found, please install elfutils-libelf-devel/libelf-dev or disable CONFIG_LIBELF);
+    endif
 
-		NO_LIBELF := 1
-		NO_DWARF := 1
-		NO_DEMANGLE := 1
-	else
-		msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
-	endif
-else
 	# for linking with debug library, run like:
 	# make DEBUG=1 LIBDW_DIR=/opt/libdw/
 	ifdef LIBDW_DIR
@@ -576,13 +566,17 @@ else
 		LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
 	endif
 
+    # libelf supported - what about dwarf?
 	FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
 	ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y)
 		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
-	endif # Dwarf support
-endif # SOURCE_LIBELF
-endif # NO_LIBELF
+	endif
+else
+    NO_DWARF := 1
+    NO_DEMANGLE := 1
+    NO_LIBUNWIND := 1
+endif
 
 # There's only x86 (both 32 and 64) support for CFI unwind so far
 ifneq ($(ARCH),x86)
@@ -610,41 +604,38 @@ ifneq ($(OUTPUT),)
 	BASIC_CFLAGS += -I$(OUTPUT)
 endif
 
-ifdef NO_LIBELF
-EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
+ifdef CONFIG_LIBELF
+    BASIC_CFLAGS += -DLIBELF_SUPPORT
 
-# Remove ELF/DWARF dependent codes
-LIB_OBJS := $(filter-out $(OUTPUT)util/symbol-elf.o,$(LIB_OBJS))
-LIB_OBJS := $(filter-out $(OUTPUT)util/dwarf-aux.o,$(LIB_OBJS))
-LIB_OBJS := $(filter-out $(OUTPUT)util/probe-event.o,$(LIB_OBJS))
-LIB_OBJS := $(filter-out $(OUTPUT)util/probe-finder.o,$(LIB_OBJS))
+    FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+    ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
+	    BASIC_CFLAGS += -DLIBELF_MMAP
+    endif
 
-BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS))
+    ifndef NO_DWARF
+        ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
+	        msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
+        else
+            BASIC_CFLAGS := -DDWARF_SUPPORT $(LIBDW_CFLAGS) $(BASIC_CFLAGS)
+            BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS)
+            EXTLIBS += -lelf -ldw
+            LIB_OBJS += $(OUTPUT)util/probe-finder.o
+            LIB_OBJS += $(OUTPUT)util/dwarf-aux.o
+        endif # PERF_HAVE_DWARF_REGS
+    endif # NO_DWARF
 
-# Use minimal symbol handling
-LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
+else
+    EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
 
-else # NO_LIBELF
-BASIC_CFLAGS += -DLIBELF_SUPPORT
+    # Remove ELF/DWARF dependent codes
+    LIB_OBJS := $(filter-out $(OUTPUT)util/symbol-elf.o,$(LIB_OBJS))
+    LIB_OBJS := $(filter-out $(OUTPUT)util/probe-event.o,$(LIB_OBJS))
+    BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS))
 
-FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
-ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
-	BASIC_CFLAGS += -DLIBELF_MMAP
+    # Use minimal symbol handling
+    LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
 endif
 
-ifndef NO_DWARF
-ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
-	msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
-else
-	BASIC_CFLAGS := -DDWARF_SUPPORT $(LIBDW_CFLAGS) $(BASIC_CFLAGS)
-	BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS)
-	EXTLIBS += -lelf -ldw
-	LIB_OBJS += $(OUTPUT)util/probe-finder.o
-	LIB_OBJS += $(OUTPUT)util/dwarf-aux.o
-endif # PERF_HAVE_DWARF_REGS
-endif # NO_DWARF
-endif # NO_LIBELF
-
 ifndef NO_LIBUNWIND
 	BASIC_CFLAGS += -DLIBUNWIND_SUPPORT
 	EXTLIBS += $(LIBUNWIND_LIBS)
tools/perf/Pconfig +7 -0
index 367cc65..334674c 100644
@@ -4,6 +4,13 @@ config NEWT
 config GTK2
     bool "Enable GTK-based UI"
 
+config LIBC
+    bool "Development support for libc is available - glibc or bionic"
+
+config LIBELF
+    bool "Enable support for libelf"
+    depends on LIBC
+
 config LIBPERL
     bool "Enable support for perl scripting engine"
 
Signature · 1 line
1.7.10.1
#11 lore raw

PATCH 9/23 perf: make cfi unwind support based on CONFIG_LIBUNWIND

In reply to David Ahern
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile                 |   20 ++++++++++----------
 tools/perf/Pconfig                  |   15 +++++++++++++++
 tools/perf/arch/x86/Makefile        |    2 +-
 tools/perf/config/feature-tests.mak |    2 +-
 4 files changed, 27 insertions(+), 12 deletions(-)
tools/perf/Makefile +10 -10
index 9bb12b5..5c060c8 100644
@@ -36,9 +36,6 @@ include config/utilities.mak
 #
 # Define NO_DEMANGLE if you do not want C++ symbol demangling.
 #
-# Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf
-# backtrace post unwind.
-#
 # Define NO_BACKTRACE if you do not want stack backtrace debug feature
 #
 # Define NO_LIBNUMA if you do not want numa perf benchmark
@@ -575,15 +572,19 @@ ifdef CONFIG_LIBELF
 else
     NO_DWARF := 1
     NO_DEMANGLE := 1
-    NO_LIBUNWIND := 1
+    ifdef CONFIG_LIBUNWIND
+        $(error CONFIG_LIBUNWIND depends on LIBELF)
+    endif
 endif
 
 # There's only x86 (both 32 and 64) support for CFI unwind so far
 ifneq ($(ARCH),x86)
-	NO_LIBUNWIND := 1
+ifdef CONFIG_LIBUNWIND
+	$(error CONFIG_LIBUNWIND only supported for x86 architecture)
+endif
 endif
 
-ifndef NO_LIBUNWIND
+ifdef CONFIG_LIBUNWIND
 # for linking with debug library, run like:
 # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
 ifdef LIBUNWIND_DIR
@@ -593,10 +594,9 @@ endif
 
 FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
 ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y)
-	msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99);
-	NO_LIBUNWIND := 1
+    $(error No libunwind found. Please install libunwind-dev[el] >= 0.99 or disable CONFIG_LIBUNWIND)
 endif # Libunwind support
-endif # NO_LIBUNWIND
+endif
 
 -include arch/$(ARCH)/Makefile
 
@@ -636,7 +636,7 @@ else
     LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
 endif
 
-ifndef NO_LIBUNWIND
+ifdef CONFIG_LIBUNWIND
 	BASIC_CFLAGS += -DLIBUNWIND_SUPPORT
 	EXTLIBS += $(LIBUNWIND_LIBS)
 	BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS)
tools/perf/Pconfig +15 -0
index 334674c..d6e067e 100644
@@ -1,3 +1,14 @@
+config ARCH
+    string
+    option env="ARCH"
+
+config X86
+    def_bool y if ARCH = "x86"
+    select HAVE_CFI_UNWIND_SUPPORT
+
+config HAVE_CFI_UNWIND_SUPPORT
+    bool
+
 config NEWT
     bool "Enable newt-based TUI"
 
@@ -11,6 +22,10 @@ config LIBELF
     bool "Enable support for libelf"
     depends on LIBC
 
+config LIBUNWIND
+    bool "Enable support for libunwind"
+    depends on HAVE_CFI_UNWIND_SUPPORT && LIBELF
+
 config LIBPERL
     bool "Enable support for perl scripting engine"
 
tools/perf/arch/x86/Makefile +1 -1
index 815841c..3a6dc3d 100644
@@ -2,7 +2,7 @@ ifndef NO_DWARF
 PERF_HAVE_DWARF_REGS := 1
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
-ifndef NO_LIBUNWIND
+ifdef CONFIG_LIBUNWIND
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind.o
 endif
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
tools/perf/config/feature-tests.mak +1 -1
index 7ec044f..b0c28b2 100644
@@ -167,7 +167,7 @@ int main(void)
 }
 endef
 
-ifndef NO_LIBUNWIND
+ifdef CONFIG_LIBUNWIND
 define SOURCE_LIBUNWIND
 #include <libunwind.h>
 #include <stdlib.h>
Signature · 1 line
1.7.10.1
#12 lore raw

Re: [PATCH 09/23] perf: make cfi unwind support based on CONFIG_LIBUNWIND

tools/perf/Pconfig line 3

Quoted 6 lines · David Ahern
tools/perf/Pconfig +3 -0
@@ -1,3 +1,14 @@
+config ARCH
+    string
+    option env="ARCH"

Why does this copy init/Kconfig?

tools/perf/Pconfig line 8

Quoted 4 lines
tools/perf/Pconfig +4 -0
+config X86
+    def_bool y if ARCH = "x86"
+    select HAVE_CFI_UNWIND_SUPPORT
+

Doesn't this clash with the same Kconfig symbol in arch/x86/Kconfig?

tools/perf/Pconfig line 14

Quoted 6 lines
tools/perf/Pconfig +3 -0
+config HAVE_CFI_UNWIND_SUPPORT
+    bool
+
 config NEWT
     bool "Enable newt-based TUI"
 

Paul Bolle

#13 lore raw

Re: [PATCH 09/23] perf: make cfi unwind support based on CONFIG_LIBUNWIND

Quoted 10 lines · Paul Bolle

tools/perf/Pconfig line 3

Quoted 6 lines · David Ahern
tools/perf/Pconfig +3 -0
@@ -1,3 +1,14 @@
+config ARCH
+    string
+    option env="ARCH"

Why does this copy init/Kconfig?

Quoted 6 lines

tools/perf/Pconfig line 8

Quoted 4 lines
tools/perf/Pconfig +4 -0
+config X86
+    def_bool y if ARCH = "x86"
+    select HAVE_CFI_UNWIND_SUPPORT
+

Doesn't this clash with the same Kconfig symbol in arch/x86/Kconfig?

traditionally, perf has not required a kernel config to build it. The above grabs some symbols for a standalone perf config. I guess that's a question to be answered - should the kernel's config files should be used for perf (or a tools target in general).

Also, perf can be built outside of the kernel tree. Tying the build to the kernel config files would have an affect on that option.

Something to look at for the next version.

David

#14 lore raw

Re: [PATCH 09/23] perf: make cfi unwind support based on CONFIG_LIBUNWIND

Quoted 4 lines · David Ahern

traditionally, perf has not required a kernel config to build it. The above grabs some symbols for a standalone perf config. I guess that's a question to be answered - should the kernel's config files should be used for perf (or a tools target in general).

If you decide to only use the kernel kconfig tools but not the current tree of Kconfig files I suggest to separate things clearly. So in that case using Pconfig as a filename (as we discussed for PATCH 01/23) actually seems to be a good idea. Likewise, in that case you might want to prefix your macros with, say, PCONFIG_ instead of CONFIG_. (I think the kconfig tools support that, but I haven't checked.)

Quoted 4 lines

Also, perf can be built outside of the kernel tree. Tying the build to the kernel config files would have an affect on that option.

Something to look at for the next version.

Paul Bolle

#15 lore raw

PATCH 10/23 perf: make demangle support based on CONFIG_DEMANGLE

In reply to David Ahern
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile      |   70 ++++++++++++++++++++++------------------------
 tools/perf/Pconfig       |    4 +++
 tools/perf/util/symbol.h |    3 +-
 3 files changed, 39 insertions(+), 38 deletions(-)
tools/perf/Makefile +33 -37
index 5c060c8..65283e6 100644
@@ -34,8 +34,6 @@ include config/utilities.mak
 #
 # Define WERROR=0 to disable treating any warnings as errors.
 #
-# Define NO_DEMANGLE if you do not want C++ symbol demangling.
-#
 # Define NO_BACKTRACE if you do not want stack backtrace debug feature
 #
 # Define NO_LIBNUMA if you do not want numa perf benchmark
@@ -571,7 +569,9 @@ ifdef CONFIG_LIBELF
 	endif
 else
     NO_DWARF := 1
-    NO_DEMANGLE := 1
+    ifdef CONFIG_DEMANGLE
+        $(error CONFIG_DEMANGLE depends on LIBELF)
+    endif
     ifdef CONFIG_LIBUNWIND
         $(error CONFIG_LIBUNWIND depends on LIBELF)
     endif
@@ -775,41 +775,37 @@ ifdef CONFIG_LIBPYTHON
     LANG_BINDINGS += $(OUTPUT)python/perf.so
 endif
 
-ifdef NO_DEMANGLE
-	BASIC_CFLAGS += -DNO_DEMANGLE
-else
-        ifdef HAVE_CPLUS_DEMANGLE
-		EXTLIBS += -liberty
-		BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
+ifdef CONFIG_DEMANGLE
+    ifdef HAVE_CPLUS_DEMANGLE
+        EXTLIBS += -liberty
+        BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
+    else
+        FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd
+        has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd)
+        ifeq ($(has_bfd),y)
+            EXTLIBS += -lbfd
         else
-		FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd
-		has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd)
-		ifeq ($(has_bfd),y)
-			EXTLIBS += -lbfd
-		else
-			FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty
-			has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty)
-			ifeq ($(has_bfd_iberty),y)
-				EXTLIBS += -lbfd -liberty
-			else
-				FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz
-				has_bfd_iberty_z := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY_Z),libz)
-				ifeq ($(has_bfd_iberty_z),y)
-					EXTLIBS += -lbfd -liberty -lz
-				else
-					FLAGS_CPLUS_DEMANGLE=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty
-					has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle)
-					ifeq ($(has_cplus_demangle),y)
-						EXTLIBS += -liberty
-						BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
-					else
-						msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
-						BASIC_CFLAGS += -DNO_DEMANGLE
-					endif
-				endif
-			endif
-		endif
-	endif
+            FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty
+            has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty)
+            ifeq ($(has_bfd_iberty),y)
+                EXTLIBS += -lbfd -liberty
+            else
+                FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz
+                has_bfd_iberty_z := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY_Z),libz)
+                ifeq ($(has_bfd_iberty_z),y)
+                    EXTLIBS += -lbfd -liberty -lz
+                else
+                    FLAGS_CPLUS_DEMANGLE=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty
+                    has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle)
+                    ifeq ($(has_cplus_demangle),y)
+                        EXTLIBS += -liberty
+                        BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
+                    endif
+                    $(error No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling or unset CONFIG_DEMANGLE)
+                endif
+            endif
+        endif
+    endif
 endif
 
 ifeq ($(NO_PERF_REGS),0)
tools/perf/Pconfig +4 -0
index d6e067e..dc0fc36 100644
@@ -26,6 +26,10 @@ config LIBUNWIND
     bool "Enable support for libunwind"
     depends on HAVE_CFI_UNWIND_SUPPORT && LIBELF
 
+ config DEMANGLE
+    bool "Enable support for demangle"
+    depends on LIBELF
+
 config LIBPERL
     bool "Enable support for perl scripting engine"
 
tools/perf/util/symbol.h +2 -1
index b62ca37..cd284dc 100644
@@ -12,6 +12,7 @@
 #include <byteswap.h>
 #include <libgen.h>
 #include "build-id.h"
+#include <linux/kconfig.h>
 
 #ifdef LIBELF_SUPPORT
 #include <libelf.h>
@@ -29,7 +30,7 @@ static inline char *bfd_demangle(void __maybe_unused *v, const char *c, int i)
 	return cplus_demangle(c, i);
 }
 #else
-#ifdef NO_DEMANGLE
+#ifndef CONFIG_DEMANGLE
 static inline char *bfd_demangle(void __maybe_unused *v,
 				 const char __maybe_unused *c,
 				 int __maybe_unused i)
Signature · 1 line
1.7.10.1
#16 lore raw

Re: [PATCH 10/23] perf: make demangle support based on CONFIG_DEMANGLE

tools/perf/Makefile ifdef CONFIG_LIBELF · line 574

Quoted 13 lines · David Ahern
tools/perf/Makefile +3 -1
index 5c060c8..65283e6 100644
[...]
@@ -571,7 +569,9 @@ ifdef CONFIG_LIBELF
 	endif
 else
     NO_DWARF := 1
-    NO_DEMANGLE := 1
+    ifdef CONFIG_DEMANGLE
+        $(error CONFIG_DEMANGLE depends on LIBELF)
+    endif

You check for a dependency here ...

Quoted 9 lines
tools/perf/Makefile +0 -0
     ifdef CONFIG_LIBUNWIND
         $(error CONFIG_LIBUNWIND depends on LIBELF)
     endif
[...]
tools/perf/Pconfig +0 -0
index d6e067e..dc0fc36 100644

tools/perf/Pconfig config LIBUNWIND · line 32

Quoted 7 lines
tools/perf/Pconfig +4 -0
@@ -26,6 +26,10 @@ config LIBUNWIND
     bool "Enable support for libunwind"
     depends on HAVE_CFI_UNWIND_SUPPORT && LIBELF
 
+ config DEMANGLE
+    bool "Enable support for demangle"
+    depends on LIBELF
+

... that already seems to be enforced here.

tools/perf/Pconfig config LIBUNWIND · line 35

Quoted 3 lines
tools/perf/Pconfig +0 -0
 config LIBPERL
     bool "Enable support for perl scripting engine"
 

Paul Bolle

#17 lore raw

PATCH 11/23 perf: make dwarf support based on CONFIG_DWARF

In reply to David Ahern
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile                 |   22 ++++++++++++----------
 tools/perf/Pconfig                  |    4 ++++
 tools/perf/arch/arm/Makefile        |    2 +-
 tools/perf/arch/powerpc/Makefile    |    2 +-
 tools/perf/arch/s390/Makefile       |    2 +-
 tools/perf/arch/sh/Makefile         |    2 +-
 tools/perf/arch/sparc/Makefile      |    2 +-
 tools/perf/arch/x86/Makefile        |    2 +-
 tools/perf/config/feature-tests.mak |    2 +-
 9 files changed, 23 insertions(+), 17 deletions(-)
tools/perf/Makefile +12 -10
index 65283e6..d2707ee 100644
@@ -30,8 +30,6 @@ include config/utilities.mak
 #
 # Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.
 #
-# Define NO_DWARF if you do not want debug-info analysis feature at all.
-#
 # Define WERROR=0 to disable treating any warnings as errors.
 #
 # Define NO_BACKTRACE if you do not want stack backtrace debug feature
@@ -562,13 +560,17 @@ ifdef CONFIG_LIBELF
 	endif
 
     # libelf supported - what about dwarf?
-	FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
-	ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y)
-		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
-	endif
+    ifdef CONFIG_DWARF
+        FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+        ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y)
+            $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138.ables dwarf support.)
+            $(error Please install new elfutils-devel/libdw-dev or disable CONFIG_DWARF);
+        endif
+    endif
 else
-    NO_DWARF := 1
+    ifdef CONFIG_DWARF
+        $(error CONFIG_DWARF depends on LIBELF)
+    endif
     ifdef CONFIG_DEMANGLE
         $(error CONFIG_DEMANGLE depends on LIBELF)
     endif
@@ -612,7 +614,7 @@ ifdef CONFIG_LIBELF
 	    BASIC_CFLAGS += -DLIBELF_MMAP
     endif
 
-    ifndef NO_DWARF
+    ifdef CONFIG_DWARF
         ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
 	        msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
         else
@@ -622,7 +624,7 @@ ifdef CONFIG_LIBELF
             LIB_OBJS += $(OUTPUT)util/probe-finder.o
             LIB_OBJS += $(OUTPUT)util/dwarf-aux.o
         endif # PERF_HAVE_DWARF_REGS
-    endif # NO_DWARF
+    endif
 
 else
     EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
tools/perf/Pconfig +4 -0
index dc0fc36..f744b7b 100644
@@ -26,6 +26,10 @@ config LIBUNWIND
     bool "Enable support for libunwind"
     depends on HAVE_CFI_UNWIND_SUPPORT && LIBELF
 
+config DWARF
+    bool "Enable support for dwarf"
+    depends on LIBELF
+
  config DEMANGLE
     bool "Enable support for demangle"
     depends on LIBELF
tools/perf/arch/arm/Makefile +1 -1
index 15130b5..6d630e3 100644
@@ -1,4 +1,4 @@
-ifndef NO_DWARF
+ifdef CONFIG_DWARF
 PERF_HAVE_DWARF_REGS := 1
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
tools/perf/arch/powerpc/Makefile +1 -1
index 744e629..d01408e 100644
@@ -1,4 +1,4 @@
-ifndef NO_DWARF
+ifdef CONFIG_DWARF
 PERF_HAVE_DWARF_REGS := 1
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
tools/perf/arch/s390/Makefile +1 -1
index 15130b5..6d630e3 100644
@@ -1,4 +1,4 @@
-ifndef NO_DWARF
+ifdef CONFIG_DWARF
 PERF_HAVE_DWARF_REGS := 1
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
tools/perf/arch/sh/Makefile +1 -1
index 15130b5..6d630e3 100644
@@ -1,4 +1,4 @@
-ifndef NO_DWARF
+ifdef CONFIG_DWARF
 PERF_HAVE_DWARF_REGS := 1
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
tools/perf/arch/sparc/Makefile +1 -1
index 15130b5..6d630e3 100644
@@ -1,4 +1,4 @@
-ifndef NO_DWARF
+ifdef CONFIG_DWARF
 PERF_HAVE_DWARF_REGS := 1
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
tools/perf/arch/x86/Makefile +1 -1
index 3a6dc3d..8d18b74 100644
@@ -1,4 +1,4 @@
-ifndef NO_DWARF
+ifdef CONFIG_DWARF
 PERF_HAVE_DWARF_REGS := 1
 LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
tools/perf/config/feature-tests.mak +1 -1
index b0c28b2..7873e6d 100644
@@ -6,7 +6,7 @@ int main(void)
 }
 endef
 
-ifndef NO_DWARF
+ifdef CONFIG_DWARF
 define SOURCE_DWARF
 #include <dwarf.h>
 #include <elfutils/libdw.h>
Signature · 1 line
1.7.10.1
#18 lore raw

PATCH 12/23 perf: add BIONIC config option

In reply to David Ahern

Sets the LIBC option and is independent of LIBELF.

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile |    6 ++++--
 tools/perf/Pconfig  |    7 ++++++-
 2 files changed, 10 insertions(+), 3 deletions(-)
tools/perf/Makefile +4 -2
index d2707ee..969bdd3 100644
@@ -206,8 +206,10 @@ BASIC_CFLAGS = \
 
 BASIC_LDFLAGS =
 
-ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
-	BIONIC := 1
+ifdef CONFIG_BIONIC
+    ifneq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
+        $(error No anddroid api-level.h. Unset CONFIG_BIONIC to continue)
+    endif
 	EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
 	EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
 	BASIC_CFLAGS += -I.
tools/perf/Pconfig +6 -1
index f744b7b..bec1ac6 100644
@@ -15,12 +15,17 @@ config NEWT
 config GTK2
     bool "Enable GTK-based UI"
 
+config BIONIC
+    bool "Enable support for Bionic (e.g., Android platform)"
+    default n
+    select LIBC
+
 config LIBC
     bool "Development support for libc is available - glibc or bionic"
 
 config LIBELF
     bool "Enable support for libelf"
-    depends on LIBC
+    depends on !BIONIC && LIBC
 
 config LIBUNWIND
     bool "Enable support for libunwind"
Signature · 1 line
1.7.10.1
#19 lore raw

PATCH 13/23 perf: make numa support based on CONFIG_LIBNUMA

In reply to David Ahern
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile        |   18 +++++++-----------
 tools/perf/Pconfig         |    5 +++++
 tools/perf/builtin-bench.c |    5 +++--
 3 files changed, 15 insertions(+), 13 deletions(-)
tools/perf/Makefile +7 -11
index 969bdd3..3ada6e7 100644
@@ -33,8 +33,6 @@ include config/utilities.mak
 # Define WERROR=0 to disable treating any warnings as errors.
 #
 # Define NO_BACKTRACE if you do not want stack backtrace debug feature
-#
-# Define NO_LIBNUMA if you do not want numa perf benchmark
 
 $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
 	@$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
@@ -837,15 +835,13 @@ ifndef NO_BACKTRACE
        endif
 endif
 
-ifndef NO_LIBNUMA
-	FLAGS_LIBNUMA = $(ALL_CFLAGS) $(ALL_LDFLAGS) -lnuma
-	ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y)
-		msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev);
-	else
-		BASIC_CFLAGS += -DLIBNUMA_SUPPORT
-		BUILTIN_OBJS += $(OUTPUT)bench/numa.o
-		EXTLIBS += -lnuma
-	endif
+ifdef CONFIG_LIBNUMA
+    FLAGS_LIBNUMA = $(ALL_CFLAGS) $(ALL_LDFLAGS) -lnuma
+    ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y)
+        $(error No numa.h found. Please install numa-libs-devel or libnuma-dev or unset CONFIG_LIBNUMA)
+    endif
+    BUILTIN_OBJS += $(OUTPUT)bench/numa.o
+    EXTLIBS += -lnuma
 endif
 
 ifdef ASCIIDOC8
tools/perf/Pconfig +5 -0
index bec1ac6..c4e20cc 100644
@@ -44,3 +44,8 @@ config LIBPERL
 
 config LIBPYTHON
     bool "Enable support for python scripting engine"
+
+config LIBNUMA
+    bool "Enable support for libnuma"
+    help
+        Used for 'perf bench numa mem' benchmark
tools/perf/builtin-bench.c +3 -2
index 77298bf..176a57d 100644
@@ -21,6 +21,7 @@
 #include "util/parse-options.h"
 #include "builtin.h"
 #include "bench/bench.h"
+#include <linux/kconfig.h>
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -35,7 +36,7 @@ struct bench_suite {
 /* sentinel: easy for help */
 #define suite_all { "all", "Test all benchmark suites", NULL }
 
-#ifdef LIBNUMA_SUPPORT
+#ifdef CONFIG_LIBNUMA
 static struct bench_suite numa_suites[] = {
 	{ "mem",
 	  "Benchmark for NUMA workloads",
@@ -80,7 +81,7 @@ struct bench_subsys {
 };
 
 static struct bench_subsys subsystems[] = {
-#ifdef LIBNUMA_SUPPORT
+#ifdef CONFIG_LIBNUMA
 	{ "numa",
 	  "NUMA scheduling and MM behavior",
 	  numa_suites },
Signature · 1 line
1.7.10.1
#20 lore raw

PATCH 14/23 perf: make backtrace support based on CONFIG_BACKTRACE

In reply to David Ahern
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile                 |   10 ++++------
 tools/perf/Pconfig                  |    3 +++
 tools/perf/config/feature-tests.mak |    2 +-
 tools/perf/util/util.c              |    5 +++--
 4 files changed, 11 insertions(+), 9 deletions(-)
tools/perf/Makefile +4 -6
index 3ada6e7..0baa19b 100644
@@ -31,8 +31,6 @@ include config/utilities.mak
 # Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.
 #
 # Define WERROR=0 to disable treating any warnings as errors.
-#
-# Define NO_BACKTRACE if you do not want stack backtrace debug feature
 
 $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
 	@$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
@@ -829,10 +827,10 @@ ifndef NO_ON_EXIT
 	endif
 endif
 
-ifndef NO_BACKTRACE
-       ifeq ($(call try-cc,$(SOURCE_BACKTRACE),,-DBACKTRACE_SUPPORT),y)
-               BASIC_CFLAGS += -DBACKTRACE_SUPPORT
-       endif
+ifdef CONFIG_BACKTRACE
+    ifneq ($(call try-cc,$(SOURCE_BACKTRACE),,-DBACKTRACE_SUPPORT),y)
+        $(error backtrace not supported. Unset CONFIG_BACKTRACE)
+   endif
 endif
 
 ifdef CONFIG_LIBNUMA
tools/perf/Pconfig +3 -0
index c4e20cc..b03881c 100644
@@ -49,3 +49,6 @@ config LIBNUMA
     bool "Enable support for libnuma"
     help
         Used for 'perf bench numa mem' benchmark
+
+config BACKTRACE
+    bool "Enable support for stack backtrace debugging"
tools/perf/config/feature-tests.mak +1 -1
index 7873e6d..1d16481 100644
@@ -192,7 +192,7 @@ int main(void)
 endef
 endif
 
-ifndef NO_BACKTRACE
+ifdef CONFIG_BACKTRACE
 define SOURCE_BACKTRACE
 #include <execinfo.h>
 #include <stdio.h>
tools/perf/util/util.c +3 -2
index 805d1f5..fa2916d 100644
@@ -1,7 +1,8 @@
 #include "../perf.h"
 #include "util.h"
 #include <sys/mman.h>
-#ifdef BACKTRACE_SUPPORT
+#include <linux/kconfig.h>
+#ifdef CONFIG_BACKTRACE
 #include <execinfo.h>
 #endif
 #include <stdio.h>
@@ -202,7 +203,7 @@ int hex2u64(const char *ptr, u64 *long_val)
 }
 
 /* Obtain a backtrace and print it to stdout. */
-#ifdef BACKTRACE_SUPPORT
+#ifdef CONFIG_BACKTRACE
 void dump_stack(void)
 {
 	void *array[16];
Signature · 1 line
1.7.10.1
#21 lore raw

PATCH 15/23 perf: make libaudit support based on CONFIG_LIBAUDIT

In reply to David Ahern
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile                 |   16 +++++++---------
 tools/perf/Pconfig                  |    5 +++++
 tools/perf/config/feature-tests.mak |    2 +-
 tools/perf/perf.c                   |    3 ++-
 4 files changed, 15 insertions(+), 11 deletions(-)
tools/perf/Makefile +7 -9
index 0baa19b..62c10b8 100644
@@ -644,15 +644,13 @@ ifdef CONFIG_LIBUNWIND
 	LIB_OBJS += $(OUTPUT)util/unwind.o
 endif
 
-ifndef NO_LIBAUDIT
-	FLAGS_LIBAUDIT = $(ALL_CFLAGS) $(ALL_LDFLAGS) -laudit
-	ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT),libaudit),y)
-		msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
-	else
-		BASIC_CFLAGS += -DLIBAUDIT_SUPPORT
-		BUILTIN_OBJS += $(OUTPUT)builtin-trace.o
-		EXTLIBS += -laudit
-	endif
+ifdef CONFIG_LIBAUDIT
+    FLAGS_LIBAUDIT = $(ALL_CFLAGS) $(ALL_LDFLAGS) -laudit
+    ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT),libaudit),y)
+        $(error No libaudit.h found, please install audit-libs-devel or libaudit-dev or disable CONFIG_LIBAUDIT)
+    endif
+    BUILTIN_OBJS += $(OUTPUT)builtin-trace.o
+    EXTLIBS += -laudit
 endif
 
 ifdef CONFIG_NEWT
tools/perf/Pconfig +5 -0
index b03881c..4cfccf3 100644
@@ -45,6 +45,11 @@ config LIBPERL
 config LIBPYTHON
     bool "Enable support for python scripting engine"
 
+config LIBAUDIT
+    bool "Enable support for libaudit"
+    help
+        Used for perf trace tool.
+
 config LIBNUMA
     bool "Enable support for libnuma"
     help
tools/perf/config/feature-tests.mak +1 -1
index 1d16481..6e3ba0f 100644
@@ -206,7 +206,7 @@ int main(void)
 endef
 endif
 
-ifndef NO_LIBAUDIT
+ifdef CONFIG_LIBAUDIT
 define SOURCE_LIBAUDIT
 #include <libaudit.h>
 
tools/perf/perf.c +2 -1
index 095b882..f7fcf78 100644
@@ -14,6 +14,7 @@
 #include "util/run-command.h"
 #include "util/parse-events.h"
 #include "util/debugfs.h"
+#include <linux/kconfig.h>
 #include <pthread.h>
 
 const char perf_usage_string[] =
@@ -56,7 +57,7 @@ static struct cmd_struct commands[] = {
 	{ "lock",	cmd_lock,	0 },
 	{ "kvm",	cmd_kvm,	0 },
 	{ "test",	cmd_test,	0 },
-#ifdef LIBAUDIT_SUPPORT
+#ifdef CONFIG_LIBAUDIT
 	{ "trace",	cmd_trace,	0 },
 #endif
 	{ "inject",	cmd_inject,	0 },
Signature · 1 line
1.7.10.1
#22 lore raw

PATCH 16/23 perf: consolidate CONFIG_LIBUNWIND checks in Makefile

In reply to David Ahern

code move only

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile |   38 +++++++++++++++++---------------------
 1 file changed, 17 insertions(+), 21 deletions(-)
tools/perf/Makefile +17 -21
index 62c10b8..a606eb1 100644
@@ -577,27 +577,6 @@ else
     endif
 endif
 
-# There's only x86 (both 32 and 64) support for CFI unwind so far
-ifneq ($(ARCH),x86)
-ifdef CONFIG_LIBUNWIND
-	$(error CONFIG_LIBUNWIND only supported for x86 architecture)
-endif
-endif
-
-ifdef CONFIG_LIBUNWIND
-# 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
-
-FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
-ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y)
-    $(error No libunwind found. Please install libunwind-dev[el] >= 0.99 or disable CONFIG_LIBUNWIND)
-endif # Libunwind support
-endif
-
 -include arch/$(ARCH)/Makefile
 
 ifneq ($(OUTPUT),)
@@ -637,6 +616,23 @@ else
 endif
 
 ifdef CONFIG_LIBUNWIND
+    # There's only x86 (both 32 and 64) support for CFI unwind so far
+    ifneq ($(ARCH),x86)
+	    $(error CONFIG_LIBUNWIND only supported for x86 architecture)
+    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
+
+    FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
+    ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y)
+        $(error No libunwind found. Please install libunwind-dev[el] >= 0.99 or disable CONFIG_LIBUNWIND)
+    endif
+
 	BASIC_CFLAGS += -DLIBUNWIND_SUPPORT
 	EXTLIBS += $(LIBUNWIND_LIBS)
 	BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS)
Signature · 1 line
1.7.10.1
#23 lore raw

PATCH 17/23 perf: remove LIBUNWIND_SUPPORT in favor of CONFIG_LIBUNWIND

In reply to David Ahern
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile         |    1 -
 tools/perf/builtin-record.c |   11 ++++++-----
 tools/perf/util/unwind.h    |    5 +++--
 3 files changed, 9 insertions(+), 8 deletions(-)
tools/perf/Makefile +0 -1
index a606eb1..cc44818 100644
@@ -633,7 +633,6 @@ ifdef CONFIG_LIBUNWIND
         $(error No libunwind found. Please install libunwind-dev[el] >= 0.99 or disable CONFIG_LIBUNWIND)
     endif
 
-	BASIC_CFLAGS += -DLIBUNWIND_SUPPORT
 	EXTLIBS += $(LIBUNWIND_LIBS)
 	BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS)
 	BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS)
tools/perf/builtin-record.c +6 -5
index f1a939e..276a6e0 100644
@@ -26,6 +26,7 @@
 #include "util/symbol.h"
 #include "util/cpumap.h"
 #include "util/thread_map.h"
+#include <linux/kconfig.h>
 
 #include <unistd.h>
 #include <sched.h>
@@ -742,7 +743,7 @@ error:
 	return ret;
 }
 
-#ifdef LIBUNWIND_SUPPORT
+#ifdef CONFIG_LIBUNWIND
 static int get_stack_size(char *str, unsigned long *_size)
 {
 	char *endptr;
@@ -768,7 +769,7 @@ static int get_stack_size(char *str, unsigned long *_size)
 	       max_size, str);
 	return -1;
 }
-#endif /* LIBUNWIND_SUPPORT */
+#endif /* CONFIG_LIBUNWIND */
 
 int record_parse_callchain_opt(const struct option *opt,
 			       const char *arg, int unset)
@@ -806,7 +807,7 @@ int record_parse_callchain_opt(const struct option *opt,
 				       "needed for -g fp\n");
 			break;
 
-#ifdef LIBUNWIND_SUPPORT
+#ifdef CONFIG_LIBUNWIND
 		/* Dwarf style */
 		} else if (!strncmp(name, "dwarf", sizeof("dwarf"))) {
 			const unsigned long default_stack_dump_size = 8192;
@@ -826,7 +827,7 @@ int record_parse_callchain_opt(const struct option *opt,
 			if (!ret)
 				pr_debug("callchain: stack dump size %d\n",
 					 opts->stack_dump_size);
-#endif /* LIBUNWIND_SUPPORT */
+#endif /* CONFIG_LIBUNWIND */
 		} else {
 			pr_err("callchain: Unknown -g option "
 			       "value: %s\n", arg);
@@ -875,7 +876,7 @@ static struct perf_record record = {
 
 #define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: "
 
-#ifdef LIBUNWIND_SUPPORT
+#ifdef CONFIG_LIBUNWIND
 const char record_callchain_help[] = CALLCHAIN_HELP "[fp] dwarf";
 #else
 const char record_callchain_help[] = CALLCHAIN_HELP "[fp]";
tools/perf/util/unwind.h +3 -2
index cb6bc50..9890981 100644
@@ -4,6 +4,7 @@
 #include "types.h"
 #include "event.h"
 #include "symbol.h"
+#include <linux/kconfig.h>
 
 struct unwind_entry {
 	struct map	*map;
@@ -13,7 +14,7 @@ struct unwind_entry {
 
 typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);
 
-#ifdef LIBUNWIND_SUPPORT
+#ifdef CONFIG_LIBUNWIND
 int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
 			struct machine *machine,
 			struct thread *thread,
@@ -31,5 +32,5 @@ unwind__get_entries(unwind_entry_cb_t cb __maybe_unused,
 {
 	return 0;
 }
-#endif /* LIBUNWIND_SUPPORT */
+#endif /* CONFIG_LIBUNWIND */
 #endif /* __UNWIND_H */
Signature · 1 line
1.7.10.1
#24 lore raw

PATCH 18/23 perf: deprecate LIBELF_SUPPORT in favor of CONFIG_LIBELF

In reply to David Ahern
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile                 |    2 --
 tools/perf/builtin-inject.c         |    3 ++-
 tools/perf/perf.c                   |    2 +-
 tools/perf/util/generate-cmdlist.sh |    4 ++--
 tools/perf/util/map.c               |    3 ++-
 tools/perf/util/symbol.h            |    4 ++--
 6 files changed, 9 insertions(+), 9 deletions(-)
tools/perf/Makefile +0 -2
index cc44818..f9847db 100644
@@ -584,8 +584,6 @@ ifneq ($(OUTPUT),)
 endif
 
 ifdef CONFIG_LIBELF
-    BASIC_CFLAGS += -DLIBELF_SUPPORT
-
     FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
     ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
 	    BASIC_CFLAGS += -DLIBELF_MMAP
tools/perf/builtin-inject.c +2 -1
index 84ad6ab..92e8012 100644
@@ -17,6 +17,7 @@
 #include "util/build-id.h"
 
 #include "util/parse-options.h"
+#include <linux/kconfig.h>
 
 #include <linux/list.h>
 
@@ -229,7 +230,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool,
 				 * account this as unresolved.
 				 */
 			} else {
-#ifdef LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
 				pr_warning("no symbols found in %s, maybe "
 					   "install a debug package?\n",
 					   al.map->dso->long_name);
tools/perf/perf.c +1 -1
index f7fcf78..0919ee1 100644
@@ -50,7 +50,7 @@ static struct cmd_struct commands[] = {
 	{ "version",	cmd_version,	0 },
 	{ "script",	cmd_script,	0 },
 	{ "sched",	cmd_sched,	0 },
-#ifdef LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
 	{ "probe",	cmd_probe,	0 },
 #endif
 	{ "kmem",	cmd_kmem,	0 },
tools/perf/util/generate-cmdlist.sh +2 -2
index 3ac3803..8c039f6 100755
@@ -22,7 +22,7 @@ do
      }' "Documentation/perf-$cmd.txt"
 done
 
-echo "#ifdef LIBELF_SUPPORT"
+echo "#ifdef CONFIG_LIBELF"
 sed -n -e 's/^perf-\([^ 	]*\)[ 	].* full.*/\1/p' command-list.txt |
 sort |
 while read cmd
@@ -35,5 +35,5 @@ do
 	    p
      }' "Documentation/perf-$cmd.txt"
 done
-echo "#endif /* LIBELF_SUPPORT */"
+echo "#endif /* CONFIG_LIBELF */"
 echo "};"
tools/perf/util/map.c +2 -1
index 6fcb9de..80f351f 100644
@@ -11,6 +11,7 @@
 #include "strlist.h"
 #include "vdso.h"
 #include "build-id.h"
+#include <linux/kconfig.h>
 #include <linux/string.h>
 
 const char *map_type__name[MAP__NR_TYPES] = {
@@ -165,7 +166,7 @@ int map__load(struct map *map, symbol_filter_t filter)
 		pr_warning(", continuing without symbols\n");
 		return -1;
 	} else if (nr == 0) {
-#ifdef LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
 		const size_t len = strlen(name);
 		const size_t real_len = len - sizeof(DSO__DELETED);
 
tools/perf/util/symbol.h +2 -2
index cd284dc..3875d40 100644
@@ -14,7 +14,7 @@
 #include "build-id.h"
 #include <linux/kconfig.h>
 
-#ifdef LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
 #include <libelf.h>
 #include <gelf.h>
 #endif
@@ -172,7 +172,7 @@ struct symsrc {
 	int fd;
 	enum dso_binary_type type;
 
-#ifdef LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
 	Elf *elf;
 	GElf_Ehdr ehdr;
 
Signature · 1 line
1.7.10.1
#25 lore raw

PATCH 19/23 perf: deprecate DWARF_SUPPORT in favor of CONFIG_DWARF

In reply to David Ahern
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile                  |    2 +-
 tools/perf/builtin-probe.c           |   15 ++++++++-------
 tools/perf/util/include/dwarf-regs.h |    4 +++-
 tools/perf/util/probe-event.c        |    5 +++--
 tools/perf/util/probe-finder.h       |    5 +++--
 5 files changed, 18 insertions(+), 13 deletions(-)
tools/perf/Makefile +1 -1
index f9847db..e76fa2f 100644
@@ -593,7 +593,7 @@ ifdef CONFIG_LIBELF
         ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
 	        msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
         else
-            BASIC_CFLAGS := -DDWARF_SUPPORT $(LIBDW_CFLAGS) $(BASIC_CFLAGS)
+            BASIC_CFLAGS := $(LIBDW_CFLAGS) $(BASIC_CFLAGS)
             BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS)
             EXTLIBS += -lelf -ldw
             LIB_OBJS += $(OUTPUT)util/probe-finder.o
tools/perf/builtin-probe.c +8 -7
index de38a03..c86faf0 100644
@@ -41,6 +41,7 @@
 #include "util/parse-options.h"
 #include "util/probe-finder.h"
 #include "util/probe-event.h"
+#include <linux/kconfig.h>
 
 #define DEFAULT_VAR_FILTER "!__k???tab_* & !__crc_*"
 #define DEFAULT_FUNC_FILTER "!_*"
@@ -173,7 +174,7 @@ static int opt_set_target(const struct option *opt, const char *str,
 	if  (str && !params.target) {
 		if (!strcmp(opt->long_name, "exec"))
 			params.uprobes = true;
-#ifdef DWARF_SUPPORT
+#ifdef CONFIG_DWARF
 		else if (!strcmp(opt->long_name, "module"))
 			params.uprobes = false;
 #endif
@@ -187,7 +188,7 @@ static int opt_set_target(const struct option *opt, const char *str,
 	return ret;
 }
 
-#ifdef DWARF_SUPPORT
+#ifdef CONFIG_DWARF
 static int opt_show_lines(const struct option *opt __maybe_unused,
 			  const char *str, int unset __maybe_unused)
 {
@@ -257,7 +258,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
 		"perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]",
 		"perf probe [<options>] --del '[GROUP:]EVENT' ...",
 		"perf probe --list",
-#ifdef DWARF_SUPPORT
+#ifdef CONFIG_DWARF
 		"perf probe [<options>] --line 'LINEDESC'",
 		"perf probe [<options>] --vars 'PROBEPOINT'",
 #endif
@@ -271,7 +272,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
 	OPT_CALLBACK('d', "del", NULL, "[GROUP:]EVENT", "delete a probe event.",
 		opt_del_probe_event),
 	OPT_CALLBACK('a', "add", NULL,
-#ifdef DWARF_SUPPORT
+#ifdef CONFIG_DWARF
 		"[EVENT=]FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT"
 		" [[NAME=]ARG ...]",
 #else
@@ -283,7 +284,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
 		"\t\tFUNC:\tFunction name\n"
 		"\t\tOFF:\tOffset from function entry (in byte)\n"
 		"\t\t%return:\tPut the probe at function return\n"
-#ifdef DWARF_SUPPORT
+#ifdef CONFIG_DWARF
 		"\t\tSRC:\tSource code path\n"
 		"\t\tRL:\tRelative line number from function entry.\n"
 		"\t\tAL:\tAbsolute line number in file.\n"
@@ -296,7 +297,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
 		opt_add_probe_event),
 	OPT_BOOLEAN('f', "force", &params.force_add, "forcibly add events"
 		    " with existing name"),
-#ifdef DWARF_SUPPORT
+#ifdef CONFIG_DWARF
 	OPT_CALLBACK('L', "line", NULL,
 		     "FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]",
 		     "Show source code lines.", opt_show_lines),
@@ -408,7 +409,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
 		return ret;
 	}
 
-#ifdef DWARF_SUPPORT
+#ifdef CONFIG_DWARF
 	if (params.show_lines && !params.uprobes) {
 		if (params.mod_events) {
 			pr_err("  Error: Don't use --line with"
tools/perf/util/include/dwarf-regs.h +3 -1
index cf6727e..f77a851 100644
@@ -1,7 +1,9 @@
 #ifndef _PERF_DWARF_REGS_H_
 #define _PERF_DWARF_REGS_H_
 
-#ifdef DWARF_SUPPORT
+#include <linux/kconfig.h>
+
+#ifdef CONFIG_DWARF
 const char *get_arch_regstr(unsigned int n);
 #endif
 
tools/perf/util/probe-event.c +3 -2
index 49a256e..1aed7a6 100644
@@ -45,6 +45,7 @@
 #include "probe-event.h"
 #include "probe-finder.h"
 #include "session.h"
+#include <linux/kconfig.h>
 
 #define MAX_CMDLEN 256
 #define MAX_PROBE_ARGS 128
@@ -201,7 +202,7 @@ static int convert_to_perf_probe_point(struct probe_trace_point *tp,
 	return 0;
 }
 
-#ifdef DWARF_SUPPORT
+#ifdef CONFIG_DWARF
 /* Open new debuginfo of given module */
 static struct debuginfo *open_debuginfo(const char *module)
 {
@@ -630,7 +631,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
 	return ret;
 }
 
-#else	/* !DWARF_SUPPORT */
+#else	/* !CONFIG_DWARF */
 
 static int kprobe_convert_to_perf_probe(struct probe_trace_point *tp,
 					struct perf_probe_point *pp)
tools/perf/util/probe-finder.h +3 -2
index 17e94d0..5e4621e 100644
@@ -4,6 +4,7 @@
 #include <stdbool.h>
 #include "util.h"
 #include "probe-event.h"
+#include <linux/kconfig.h>
 
 #define MAX_PROBE_BUFFER	1024
 #define MAX_PROBES		 128
@@ -14,7 +15,7 @@ static inline int is_c_varname(const char *name)
 	return isalpha(name[0]) || name[0] == '_';
 }
 
-#ifdef DWARF_SUPPORT
+#ifdef CONFIG_DWARF
 
 #include "dwarf-aux.h"
 
@@ -102,6 +103,6 @@ struct line_finder {
 	int			found;
 };
 
-#endif /* DWARF_SUPPORT */
+#endif /* CONFIG_DWARF */
 
 #endif /*_PROBE_FINDER_H */
Signature · 1 line
1.7.10.1
#26 lore raw

PATCH 20/23 perf: consolidate CONFIG_LIBELF checks in Makefile

In reply to David Ahern
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile |   34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)
tools/perf/Makefile +16 -18
index e76fa2f..a3a62611 100644
@@ -530,6 +530,12 @@ PERFLIBS = $(LIB_FILE) $(LIBTRACEEVENT)
 ifneq ($(MAKECMDGOALS),clean)
 ifneq ($(MAKECMDGOALS),tags)
 
+-include arch/$(ARCH)/Makefile
+
+ifneq ($(OUTPUT),)
+	BASIC_CFLAGS += -I$(OUTPUT)
+endif
+
 # We choose to avoid "if .. else if .. else .. endif endif"
 # because maintaining the nesting to match is a pain.  If
 # we had "elif" things would have been much nicer...
@@ -565,25 +571,7 @@ ifdef CONFIG_LIBELF
             $(error Please install new elfutils-devel/libdw-dev or disable CONFIG_DWARF);
         endif
     endif
-else
-    ifdef CONFIG_DWARF
-        $(error CONFIG_DWARF depends on LIBELF)
-    endif
-    ifdef CONFIG_DEMANGLE
-        $(error CONFIG_DEMANGLE depends on LIBELF)
-    endif
-    ifdef CONFIG_LIBUNWIND
-        $(error CONFIG_LIBUNWIND depends on LIBELF)
-    endif
-endif
 
--include arch/$(ARCH)/Makefile
-
-ifneq ($(OUTPUT),)
-	BASIC_CFLAGS += -I$(OUTPUT)
-endif
-
-ifdef CONFIG_LIBELF
     FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
     ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
 	    BASIC_CFLAGS += -DLIBELF_MMAP
@@ -602,6 +590,16 @@ ifdef CONFIG_LIBELF
     endif
 
 else
+    ifdef CONFIG_DWARF
+        $(error CONFIG_DWARF depends on LIBELF)
+    endif
+    ifdef CONFIG_DEMANGLE
+        $(error CONFIG_DEMANGLE depends on LIBELF)
+    endif
+    ifdef CONFIG_LIBUNWIND
+        $(error CONFIG_LIBUNWIND depends on LIBELF)
+    endif
+
     EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
 
     # Remove ELF/DWARF dependent codes
Signature · 1 line
1.7.10.1
#27 lore raw

Re: [PATCH 20/23] perf: consolidate CONFIG_LIBELF checks in Makefile

Quoted 10 lines · David Ahern
tools/perf/Makefile +3 -0
[...]
@@ -602,6 +590,16 @@ ifdef CONFIG_LIBELF
     endif
 
 else
+    ifdef CONFIG_DWARF
+        $(error CONFIG_DWARF depends on LIBELF)
+    endif

tools/perf/Makefile ifdef CONFIG_LIBELF · line 605

Quoted 10 lines
tools/perf/Makefile +7 -0
+    ifdef CONFIG_DEMANGLE
+        $(error CONFIG_DEMANGLE depends on LIBELF)
+    endif
+    ifdef CONFIG_LIBUNWIND
+        $(error CONFIG_LIBUNWIND depends on LIBELF)
+    endif
+
     EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
 
     # Remove ELF/DWARF dependent codes

A quick scan of your series suggests you check here for dependencies that are already enforced by the kconfig tools. Why is this needed?

Paul Bolle

#28 lore raw

Re: [PATCH 20/23] perf: consolidate CONFIG_LIBELF checks in Makefile

Quoted 20 lines · Paul Bolle
Quoted 19 lines · David Ahern
tools/perf/Makefile +10 -0
[...]
@@ -602,6 +590,16 @@ ifdef CONFIG_LIBELF
      endif
 
  else
+    ifdef CONFIG_DWARF
+        $(error CONFIG_DWARF depends on LIBELF)
+    endif
+    ifdef CONFIG_DEMANGLE
+        $(error CONFIG_DEMANGLE depends on LIBELF)
+    endif
+    ifdef CONFIG_LIBUNWIND
+        $(error CONFIG_LIBUNWIND depends on LIBELF)
+    endif
+
      EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
 
Quoted 4 lines

tools/perf/Makefile ifdef CONFIG_LIBELF · line 605

Quoted 1 line
tools/perf/Makefile +0 -0
      # Remove ELF/DWARF dependent codes

A quick scan of your series suggests you check here for dependencies that are already enforced by the kconfig tools. Why is this needed?

Just a side effect of the evolutionary path from where the perf build is today to the kconfig route. Certainly the above (and similar ones) are not needed in the end.

David

#29 lore raw

PATCH 21/23 perf: consolidate CONFIG_DWARF checks in Makefile

In reply to David Ahern
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
tools/perf/Makefile +5 -7
index a3a62611..5037856 100644
@@ -563,6 +563,11 @@ ifdef CONFIG_LIBELF
 		LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
 	endif
 
+    FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+    ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
+	    BASIC_CFLAGS += -DLIBELF_MMAP
+    endif
+
     # libelf supported - what about dwarf?
     ifdef CONFIG_DWARF
         FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
@@ -570,14 +575,7 @@ ifdef CONFIG_LIBELF
             $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138.ables dwarf support.)
             $(error Please install new elfutils-devel/libdw-dev or disable CONFIG_DWARF);
         endif
-    endif
 
-    FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
-    ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
-	    BASIC_CFLAGS += -DLIBELF_MMAP
-    endif
-
-    ifdef CONFIG_DWARF
         ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
 	        msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
         else
Signature · 1 line
1.7.10.1
#30 lore raw

PATCH 22/23 perf: only add elf to EXTLIBS if CONFIG_LIBELF is set

In reply to David Ahern
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
tools/perf/Makefile +4 -5
index 5037856..5990520 100644
@@ -87,7 +87,7 @@ ifdef PARSER_DEBUG
 endif
 
 CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)
-EXTLIBS = -lpthread -lrt -lelf -lm
+EXTLIBS = -lpthread -lrt -lm
 ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 ALL_LDFLAGS = $(LDFLAGS)
 STRIP ?= strip
@@ -541,6 +541,7 @@ endif
 # we had "elif" things would have been much nicer...
 
 ifdef CONFIG_LIBELF
+    EXTLIBS += -lelf
     FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
 
     # try to compile with libelf support ...
@@ -570,7 +571,7 @@ ifdef CONFIG_LIBELF
 
     # libelf supported - what about dwarf?
     ifdef CONFIG_DWARF
-        FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+        FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
         ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y)
             $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138.ables dwarf support.)
             $(error Please install new elfutils-devel/libdw-dev or disable CONFIG_DWARF);
@@ -581,7 +582,7 @@ ifdef CONFIG_LIBELF
         else
             BASIC_CFLAGS := $(LIBDW_CFLAGS) $(BASIC_CFLAGS)
             BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS)
-            EXTLIBS += -lelf -ldw
+            EXTLIBS += -ldw
             LIB_OBJS += $(OUTPUT)util/probe-finder.o
             LIB_OBJS += $(OUTPUT)util/dwarf-aux.o
         endif # PERF_HAVE_DWARF_REGS
@@ -598,8 +599,6 @@ else
         $(error CONFIG_LIBUNWIND depends on LIBELF)
     endif
 
-    EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
-
     # Remove ELF/DWARF dependent codes
     LIB_OBJS := $(filter-out $(OUTPUT)util/symbol-elf.o,$(LIB_OBJS))
     LIB_OBJS := $(filter-out $(OUTPUT)util/probe-event.o,$(LIB_OBJS))
Signature · 1 line
1.7.10.1
#31 lore raw

PATCH 23/23 perf: only add elf-based object files if CONFIG_LIBELF is set

In reply to David Ahern
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
---
 tools/perf/Makefile |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
tools/perf/Makefile +4 -8
index 5990520..b16a944 100644
@@ -430,7 +430,6 @@ LIB_OBJS += $(OUTPUT)util/wrapper.o
 LIB_OBJS += $(OUTPUT)util/sigchain.o
 LIB_OBJS += $(OUTPUT)util/dso.o
 LIB_OBJS += $(OUTPUT)util/symbol.o
-LIB_OBJS += $(OUTPUT)util/symbol-elf.o
 LIB_OBJS += $(OUTPUT)util/color.o
 LIB_OBJS += $(OUTPUT)util/pager.o
 LIB_OBJS += $(OUTPUT)util/header.o
@@ -454,7 +453,6 @@ LIB_OBJS += $(OUTPUT)util/trace-event-scripting.o
 LIB_OBJS += $(OUTPUT)util/svghelper.o
 LIB_OBJS += $(OUTPUT)util/sort.o
 LIB_OBJS += $(OUTPUT)util/hist.o
-LIB_OBJS += $(OUTPUT)util/probe-event.o
 LIB_OBJS += $(OUTPUT)util/util.o
 LIB_OBJS += $(OUTPUT)util/xyarray.o
 LIB_OBJS += $(OUTPUT)util/cpumap.o
@@ -515,7 +513,6 @@ BUILTIN_OBJS += $(OUTPUT)builtin-stat.o
 BUILTIN_OBJS += $(OUTPUT)builtin-timechart.o
 BUILTIN_OBJS += $(OUTPUT)builtin-top.o
 BUILTIN_OBJS += $(OUTPUT)builtin-script.o
-BUILTIN_OBJS += $(OUTPUT)builtin-probe.o
 BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o
 BUILTIN_OBJS += $(OUTPUT)builtin-lock.o
 BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o
@@ -588,6 +585,10 @@ ifdef CONFIG_LIBELF
         endif # PERF_HAVE_DWARF_REGS
     endif
 
+    LIB_OBJS += $(OUTPUT)util/symbol-elf.o
+    LIB_OBJS += $(OUTPUT)util/probe-event.o
+    BUILTIN_OBJS += $(OUTPUT)builtin-probe.o
+
 else
     ifdef CONFIG_DWARF
         $(error CONFIG_DWARF depends on LIBELF)
@@ -599,11 +600,6 @@ else
         $(error CONFIG_LIBUNWIND depends on LIBELF)
     endif
 
-    # Remove ELF/DWARF dependent codes
-    LIB_OBJS := $(filter-out $(OUTPUT)util/symbol-elf.o,$(LIB_OBJS))
-    LIB_OBJS := $(filter-out $(OUTPUT)util/probe-event.o,$(LIB_OBJS))
-    BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS))
-
     # Use minimal symbol handling
     LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
 endif
Signature · 1 line
1.7.10.1