aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/symbol-elf.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2014-11-24 15:10:52 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-11-24 16:03:47 -0500
commitaaba4e12a99cc56fc8614a3f2a3ec6db4fcde76e (patch)
treea86d9524dbeb1ca301d62668641183ea3f1d195f /tools/perf/util/symbol-elf.c
parent23f0981bbd89fcc1496d0490ec39ca7c91599e32 (diff)
perf symbols: Move bfd_demangle stubbing to its only user
We need to define bfd_demangle() to either a wrapper for cplus_demangle() or to a stub when NO_DEMANGLE is defined. That is at odds with using bfd.h for some other reason, as it defines bfd_demangle() and then if code that wants to use symbol.h, where the above stubbing/wrapping is done, and bfd.h for other reasons, we end up with a build error where bfd_demangle() is found to be redefined. Avoid that by moving the stubbing/wrapping to symbol-elf.c, that is the only user of such function. If we ever get to a point where there are more valid users, we can then introduce a header for that. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Borislav Petkov <bp@suse.de> Cc: David Ahern <dsahern@gmail.com> Cc: Don Zickus <dzickus@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-6wzjpe2fy9xtgchshulixlzw@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/symbol-elf.c')
-rw-r--r--tools/perf/util/symbol-elf.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index efc7eb6b8f0f..06fcd1bf98b6 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -11,6 +11,27 @@
11#include <symbol/kallsyms.h> 11#include <symbol/kallsyms.h>
12#include "debug.h" 12#include "debug.h"
13 13
14#ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
15extern char *cplus_demangle(const char *, int);
16
17static inline char *bfd_demangle(void __maybe_unused *v, const char *c, int i)
18{
19 return cplus_demangle(c, i);
20}
21#else
22#ifdef NO_DEMANGLE
23static inline char *bfd_demangle(void __maybe_unused *v,
24 const char __maybe_unused *c,
25 int __maybe_unused i)
26{
27 return NULL;
28}
29#else
30#define PACKAGE 'perf'
31#include <bfd.h>
32#endif
33#endif
34
14#ifndef HAVE_ELF_GETPHDRNUM_SUPPORT 35#ifndef HAVE_ELF_GETPHDRNUM_SUPPORT
15static int elf_getphdrnum(Elf *elf, size_t *dst) 36static int elf_getphdrnum(Elf *elf, size_t *dst)
16{ 37{