From 1a9bbd66b07f923dc82d3317a01ce59d76d917c4 Mon Sep 17 00:00:00 2001 From: Peter Zijlstra Date: Wed, 5 Aug 2009 14:05:16 +0200 Subject: [PATCH] --- yaml --- r: 156452 b: refs/heads/master c: 2cdbc46d7b2cb0acb68c3ecad93b000552121fa6 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/tools/perf/Makefile | 18 +++++++++++++++++- trunk/tools/perf/util/symbol.c | 9 +++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index ea3844690a04..d822e9d26f9b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 114cfab222233f50f46d7162cf7d99fdc6c271e5 +refs/heads/master: 2cdbc46d7b2cb0acb68c3ecad93b000552121fa6 diff --git a/trunk/tools/perf/Makefile b/trunk/tools/perf/Makefile index 4b20fa47c3ab..ff905aceb4fd 100644 --- a/trunk/tools/perf/Makefile +++ b/trunk/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 '; echo '\#include '; 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 '; echo '\#include '; 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/trunk/tools/perf/util/symbol.c b/trunk/tools/perf/util/symbol.c index b4fe0579bd6b..0580b94785e7 100644 --- a/trunk/tools/perf/util/symbol.c +++ b/trunk/tools/perf/util/symbol.c @@ -6,7 +6,16 @@ #include #include #include + +#ifndef NO_DEMANGLE #include +#else +static inline +char *bfd_demangle(void __used *v, const char __used *c, int __used i) +{ + return NULL; +} +#endif const char *sym_hist_filter;