Re: [PATCH 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins

From: He Kuang
Date: Tue May 12 2015 - 02:44:19 EST

Hi, jirka

On 2015/5/11 22:33, Jiri Olsa wrote:
On Mon, May 11, 2015 at 09:35:26AM +0000, He Kuang wrote:
Traceevent plugins need dynamic symbols exported from libtraceevent.a,
otherwise a dlopen error will occur during plugins loading.

This patch uses dynamic-list-file to export dynamic symbols which will
be used in plugins to perf executable.

The problem is covered up if feature-libpython is enabled, because
PYTHON_EMBED_LDOPTS contains '-Xlinker --export-dynamic' which adds all
symbols to the dynamic symbol table. So we should reproduce the problem
by setting NO_LIBPYTHON=1.
there's was another patch taking the shortcut:

it seems it's not merged yet, but I like this one better


diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 03409cc..19c61e0 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -172,6 +172,7 @@ endif
LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
+LIBTRACEEVENT_DYNAMIC_LIST = $(TE_PATH)libtraceevent-dynamic-list
LIBAPI = $(LIB_PATH)libapi.a
export LIBAPI
@@ -278,8 +279,9 @@ build := -f $(srctree)/tools/build/ dir=. obj
$(Q)$(MAKE) $(build)=perf
$(Q)$(MAKE) $(build)=gtk
@@ -375,6 +377,9 @@ LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ)
$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent.a plugins
+ $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent-dynamic-list
hum, do we need extra target in Makefile.perf, it could be rebuilt any time
'plugins:' target in lib/tracevent/Makefile is called


Yes, the dynamic-list-file should be rebuilt when plugins
changed, and not depends on $(LIBTRACEEVENT).

I sent a new version, please review that patch.

$ touch ../lib/traceevent/plugin_function.c
$ make
CC plugin_function.o
LD plugin_function-in.o
GEN libtraceevent-dynamic-list
LINK perf


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at