lkml.org 
[lkml]   [2009]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] basic perf support for sparc
On Sun, Aug 02, 2009 at 08:41:48PM +0200, Ingo Molnar wrote:
> Could we somehow define a weak symbol for those library functions
> ourselves and thus just fall back to that (which does nothing)
> instead of failing the link?
>

Well, you could just dlopen the object, but that's kind of gross...

Why not abuse the perf Makefile, which already has this kind of
portability gunk in it?

$ make NO_BFD_DEMANGLE=1
succeeds with no libbfd.

$ make
succeeds when libbfd is around.

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index a5e9b87..67ab097 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

#
# Platform specific tweaks
@@ -541,6 +540,11 @@ endif
ifdef NO_EXTERNAL_GREP
BASIC_CFLAGS += -DNO_EXTERNAL_GREP
endif
+ifdef NO_BFD_DEMANGLE
+ BASIC_CFLAGS += -DNO_BFD_DEMANGLE
+else
+ EXTLIBS += -lbfd
+endif

ifeq ($(PERL_PATH),)
NO_PERL=NoThanks
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 2810605..736b8db 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -6,10 +6,20 @@
#include <libelf.h>
#include <gelf.h>
#include <elf.h>
+
+#ifndef NO_BFD_DEMANGLE
#include <bfd.h>
+#endif /* NO_BFD_DEMANGLE */

const char *sym_hist_filter;

+#ifdef NO_BFD_DEMANGLE
+static inline char *bfd_demangle(void __used *v, const char __used *c,
+ int __used i) {
+ return NULL;
+}
+#endif
+
#ifndef DMGL_PARAMS
#define DMGL_PARAMS (1 << 0) /* Include function args */
#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */

\
 
 \ /
  Last update: 2009-08-02 21:47    [W:0.139 / U:0.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site