[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+rthh_dVt+Y=8__EozRfBSRCZ_rNk-gk5uuXDGu09U-WwTF3Q@mail.gmail.com>
Date: Fri, 17 Apr 2015 23:01:07 +0200
From: Mathias Krause <minipli@...glemail.com>
To: Jiri Olsa <jolsa@...hat.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Ingo Molnar <mingo@...hat.com>,
Paul Mackerras <paulus@...ba.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>
Subject: Re: [PATCH] perf: Ensure symbols for plugins are exported
On 17 April 2015 at 17:34, Jiri Olsa <jolsa@...hat.com> wrote:
> On Sun, Apr 12, 2015 at 06:00:51PM +0200, Mathias Krause wrote:
>> 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
>> [...]
>
> hum, not sure now how -export-dynamic works but should this
> be rather in traceevent lib then?
Nope. Here's the relevant excerpt from ld(1):
--export-dynamic
[...]
If you use "dlopen" to load a dynamic object which needs to
refer back to the symbols defined by the program, rather
than some other dynamic object, then you will probably need
to use this option when linking the program itself.
So that flag has to be in the linker call for perf, as the plugins
(which are dlopen()ed) want to access symbols within the perf binary
(or more specific, within libperf.a / libtraceevent.a statically
linked into perf).
Regards,
Mathias
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists