From: tip-bot for Peter Zijlstra <a.p.zijlstra@chello.nl>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, acme@redhat.com, hpa@zytor.com,
mingo@redhat.com, a.p.zijlstra@chello.nl, kyle@mcmartin.ca,
jens.axboe@oracle.com, tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perfcounters/urgent] perf: Auto-detect libbfd
Date: Wed, 5 Aug 2009 12:16:30 GMT [thread overview]
Message-ID: <tip-2cdbc46d7b2cb0acb68c3ecad93b000552121fa6@git.kernel.org> (raw)
In-Reply-To: <20090801082048.GX12579@kernel.dk>
Commit-ID: 2cdbc46d7b2cb0acb68c3ecad93b000552121fa6
Gitweb: http://git.kernel.org/tip/2cdbc46d7b2cb0acb68c3ecad93b000552121fa6
Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Wed, 5 Aug 2009 14:05:16 +0200
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 5 Aug 2009 14:12:08 +0200
perf: Auto-detect libbfd
Since the C++ demangling isn't needed for everybody and
bfd/iberty aren't widely/easily available on all machines, make
it optional.
It also allows you to forcefully disable demangling by using
NO_DEMANGLE=1 and otherwise tries to detect libbfd/libiberty
combinations that result in a compiling demangler.
Reported-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Kyle McMartin <kyle@mcmartin.ca>
LKML-Reference: <20090801082048.GX12579@kernel.dk>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
tools/perf/Makefile | 18 +++++++++++++++++-
tools/perf/util/symbol.c | 9 +++++++++
2 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 4b20fa4..ff905ac 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -345,7 +345,6 @@ BUILTIN_OBJS += builtin-stat.o
BUILTIN_OBJS += builtin-top.o
PERFLIBS = $(LIB_FILE)
-EXTLIBS = -lbfd -liberty
#
# Platform specific tweaks
@@ -374,6 +373,23 @@ ifeq ($(uname_S),Darwin)
PTHREAD_LIBS =
endif
+ifdef NO_DEMANGLE
+ BASIC_CFLAGS += -DNO_DEMANGLE
+else
+
+ has_bfd := $(shell sh -c "(echo '\#include <stdio.h>'; echo '\#include <bfd.h>'; echo '\#ifndef DMGL_PARAMS'; echo '\#define DMGL_PARAMS (1 << 0)'; echo '\#define DMGL_ANSI (1 << 1)'; echo '\#endif'; echo 'int main(int argc, char **argv) { bfd_demangle(NULL, argv[0], DMGL_PARAMS | DMGL_ANSI); return 0; }') | gcc -x c - -lbfd > /dev/null 2>&1 && echo y")
+
+ has_bfd_iberty := $(shell sh -c "(echo '\#include <stdio.h>'; echo '\#include <bfd.h>'; echo '\#ifndef DMGL_PARAMS'; echo '\#define DMGL_PARAMS (1 << 0)'; echo '\#define DMGL_ANSI (1 << 1)'; echo '\#endif'; echo 'int main(int argc, char **argv) { bfd_demangle(NULL, argv[0], DMGL_PARAMS | DMGL_ANSI); return 0; }') | gcc -x c - -lbfd -liberty > /dev/null 2>&1 && echo y")
+
+ ifeq ($(has_bfd),y)
+ EXTLIBS += -lbfd
+ else ifeq ($(has_bfd_iberty),y)
+ EXTLIBS += -lbfd -liberty
+ else
+ BASIC_CFLAGS += -DNO_DEMANGLE
+ endif
+endif
+
ifndef CC_LD_DYNPATH
ifdef NO_R_TO_GCC_LINKER
# Some gcc does not accept and pass -R to the linker to specify
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index b4fe057..0580b94 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -6,7 +6,16 @@
#include <libelf.h>
#include <gelf.h>
#include <elf.h>
+
+#ifndef NO_DEMANGLE
#include <bfd.h>
+#else
+static inline
+char *bfd_demangle(void __used *v, const char __used *c, int __used i)
+{
+ return NULL;
+}
+#endif
const char *sym_hist_filter;
next prev parent reply other threads:[~2009-08-05 12:17 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-29 11:25 [PATCH] basic perf support for sparc Jens Axboe
2009-07-29 19:28 ` Jens Axboe
2009-08-01 1:14 ` Anton Blanchard
2009-08-01 8:20 ` Jens Axboe
2009-08-01 18:22 ` Arnaldo Carvalho de Melo
2009-08-02 18:41 ` Ingo Molnar
2009-08-02 19:44 ` Kyle McMartin
2009-08-02 19:50 ` Ingo Molnar
2009-08-02 20:11 ` Kyle McMartin
2009-08-02 20:33 ` Ingo Molnar
2009-08-02 20:47 ` Arnaldo Carvalho de Melo
2009-08-03 1:54 ` Arnaldo Carvalho de Melo
2009-08-04 3:33 ` Kyle McMartin
2009-08-04 9:25 ` Ingo Molnar
2009-08-04 9:29 ` Peter Zijlstra
2009-08-04 13:02 ` David Miller
2009-08-04 10:32 ` Frederic Riss
2009-08-04 10:38 ` Peter Zijlstra
2009-08-04 11:23 ` Frederic Riss
2009-08-04 11:28 ` Ingo Molnar
2009-08-05 12:10 ` Peter Zijlstra
2009-08-05 12:21 ` Jens Axboe
2009-08-05 12:33 ` Ingo Molnar
2009-08-05 12:16 ` tip-bot for Peter Zijlstra [this message]
2009-08-05 14:29 ` [tip:perfcounters/urgent] perf: Auto-detect libbfd Peter Zijlstra
2009-08-05 18:58 ` Peter Zijlstra
2009-08-02 20:17 ` [PATCH] basic perf support for sparc David Miller
2009-08-02 20:25 ` Ingo Molnar
2009-08-06 7:02 ` Jens Axboe
2009-08-12 18:06 ` David Miller
2009-08-12 18:13 ` Jens Axboe
2009-08-17 1:31 ` David Miller
2009-08-17 6:48 ` Jens Axboe
2009-08-17 7:57 ` Ingo Molnar
2009-09-04 4:37 ` David Miller
2009-09-04 5:02 ` Ingo Molnar
2009-09-04 5:09 ` David Miller
2009-09-04 5:20 ` Jens Axboe
2009-09-04 6:34 ` Jens Axboe
2009-09-04 6:44 ` Ingo Molnar
2009-09-04 9:57 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-2cdbc46d7b2cb0acb68c3ecad93b000552121fa6@git.kernel.org \
--to=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=hpa@zytor.com \
--cc=jens.axboe@oracle.com \
--cc=kyle@mcmartin.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox