public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf: Ensure symbols for plugins are exported
@ 2015-04-12 16:00 Mathias Krause
  2015-04-17 15:34 ` Jiri Olsa
  0 siblings, 1 reply; 5+ messages in thread
From: Mathias Krause @ 2015-04-12 16:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mathias Krause, Arnaldo Carvalho de Melo, Ingo Molnar, Jiri Olsa,
	Paul Mackerras, Peter Zijlstra

When building perf with perl or python support it implicitly gets linked
with the -export-dynamic linker option through the additional linker
flags, namely with -Wl,-E via perl or -Xlinker -export-dynamic via
python. That flag is essential for the traceevent plugin support so we
shouldn't rely on adding it implicitly.

Ensure perf's exported symbols can be used by dlopen()ed plugins by
unconditionally adding this flag when linking perf. Otherwise plugins
won't be able to access symbols in the perf binary.

This fixes the following warning / bug when trying to load plugins:

  Warning: could not load plugin '/home/minipli/.traceevent/plugins/plugin_xen.so'
  /home/minipli/.traceevent/plugins/plugin_xen.so: undefined symbol: trace_seq_printf
  Warning: could not load plugin '/home/minipli/.traceevent/plugins/plugin_function.so'
  /home/minipli/.traceevent/plugins/plugin_function.so: undefined symbol: warning
  Warning: could not load plugin '/home/minipli/.traceevent/plugins/plugin_sched_switch.so'
  /home/minipli/.traceevent/plugins/plugin_sched_switch.so: undefined symbol: pevent_unregister_event_handler
  [...]

Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
This patch should go on top of tip.git#perf/core

 tools/perf/Makefile.perf |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index c43a20517591..2ab8525f366b 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -250,7 +250,8 @@ ifdef ASCIIDOC8
   export ASCIIDOC8
 endif
 
-LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
+LIBS  = -Wl,--export-dynamic -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive
+LIBS += -Wl,--start-group $(EXTLIBS) -Wl,--end-group
 
 export INSTALL SHELL_PATH
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-04-22 20:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-12 16:00 [PATCH] perf: Ensure symbols for plugins are exported Mathias Krause
2015-04-17 15:34 ` Jiri Olsa
2015-04-17 21:01   ` Mathias Krause
2015-04-18 15:46     ` Jiri Olsa
2015-04-22 20:12       ` Mathias Krause

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox