linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins
@ 2015-05-28 13:28 He Kuang
  2015-05-28 13:28 ` [PATCH RESEND 2/2] tools lib traceevent: Ignore libtrace-dynamic-list file He Kuang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: He Kuang @ 2015-05-28 13:28 UTC (permalink / raw)
  To: acme, jolsa, mingo, a.p.zijlstra; +Cc: wangnan0, linux-kernel

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.

Before this patch:

  (Prepare plugins)
  $ ls /root/.traceevent/plugins/
  plugin_sched_switch.so
  plugin_function.so
  ...

  $ perf record -e 'ftrace:function' ls

  $ perf script
    Warning: could not load plugin '/mnt/data/root/.traceevent/plugins/plugin_sched_switch.so'
    /root/.traceevent/plugins/plugin_sched_switch.so: undefined symbol: pevent_unregister_event_handler

    Warning: could not load plugin '/root/.traceevent/plugins/plugin_function.so'
    /root/.traceevent/plugins/plugin_function.so: undefined symbol: warning
    ...
           :1049  1049 [000]  9666.754487: ftrace:function:  ffffffff8118bc50 <-- ffffffff8118c5b3
           :1049  1049 [000]  9666.754487: ftrace:function:  ffffffff818e2440 <-- ffffffff8118bc75
           :1049  1049 [000]  9666.754487: ftrace:function:  ffffffff8106eee0 <-- ffffffff811212e2

After this patch:

  $ perf record -e 'ftrace:function' ls
  $ perf script
           :1049  1049 [000]  9666.754487: ftrace:function: __set_task_comm
           :1049  1049 [000]  9666.754487: ftrace:function:    _raw_spin_lock
           :1049  1049 [000]  9666.754487: ftrace:function: task_tgid_nr_ns
           ...

Signed-off-by: He Kuang <hekuang@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/lib/traceevent/Makefile | 14 +++++++++++++-
 tools/perf/Makefile.perf      | 14 ++++++++++++--
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 8464039..6daaff6 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -23,6 +23,7 @@ endef
 # Allow setting CC and AR, or setting CROSS_COMPILE as a prefix.
 $(call allow-override,CC,$(CROSS_COMPILE)gcc)
 $(call allow-override,AR,$(CROSS_COMPILE)ar)
+$(call allow-override,NM,$(CROSS_COMPILE)nm)
 
 EXT = -std=gnu99
 INSTALL = install
@@ -157,8 +158,9 @@ PLUGINS_IN := $(PLUGINS:.so=-in.o)
 
 TE_IN    := $(OUTPUT)libtraceevent-in.o
 LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE))
+DYNAMIC_LIST_FILE := $(OUTPUT)libtraceevent-dynamic-list
 
-CMD_TARGETS = $(LIB_FILE) $(PLUGINS)
+CMD_TARGETS = $(LIB_FILE) $(PLUGINS) $(DYNAMIC_LIST_FILE)
 
 TARGETS = $(CMD_TARGETS)
 
@@ -175,6 +177,9 @@ $(OUTPUT)libtraceevent.so: $(TE_IN)
 $(OUTPUT)libtraceevent.a: $(TE_IN)
 	$(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^
 
+$(OUTPUT)libtraceevent-dynamic-list: $(PLUGINS)
+	$(QUIET_GEN)$(call do_generate_dynamic_list_file, $(PLUGINS), $@)
+
 plugins: $(PLUGINS)
 
 __plugin_obj = $(notdir $@)
@@ -244,6 +249,13 @@ define do_install_plugins
 	done
 endef
 
+define do_generate_dynamic_list_file
+	(echo '{';							\
+	$(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;	\
+	echo '};';							\
+	) > $2
+endef
+
 install_lib: all_cmd install_plugins
 	$(call QUIET_INSTALL, $(LIB_FILE)) \
 		$(call do_install,$(LIB_FILE),$(libdir_SQ))
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 5816a3b..b1dfcd8 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -173,6 +173,9 @@ endif
 LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
 export LIBTRACEEVENT
 
+LIBTRACEEVENT_DYNAMIC_LIST = $(TE_PATH)libtraceevent-dynamic-list
+LDFLAGS += -Xlinker --dynamic-list=$(LIBTRACEEVENT_DYNAMIC_LIST)
+
 LIBAPI = $(LIB_PATH)libapi.a
 export LIBAPI
 
@@ -278,7 +281,7 @@ build := -f $(srctree)/tools/build/Makefile.build dir=. obj
 $(PERF_IN): $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h FORCE
 	$(Q)$(MAKE) $(build)=perf
 
-$(OUTPUT)perf: $(PERFLIBS) $(PERF_IN)
+$(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(LIBTRACEEVENT_DYNAMIC_LIST)
 	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(PERF_IN) $(LIBS) -o $@
 
 $(GTK_IN): FORCE
@@ -373,7 +376,13 @@ $(LIB_FILE): $(LIBPERF_IN)
 LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ)
 
 $(LIBTRACEEVENT): FORCE
-	$(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.a
+
+libtraceevent_plugins: FORCE
+	$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) plugins
+
+$(LIBTRACEEVENT_DYNAMIC_LIST): libtraceevent_plugins
+	$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent-dynamic-list
 
 $(LIBTRACEEVENT)-clean:
 	$(call QUIET_CLEAN, libtraceevent)
@@ -555,4 +564,5 @@ FORCE:
 .PHONY: all install clean config-clean strip install-gtk
 .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
 .PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope FORCE single_dep
+.PHONY: libtraceevent_plugins
 
-- 
1.8.5.2


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

* [PATCH RESEND 2/2] tools lib traceevent: Ignore libtrace-dynamic-list file
  2015-05-28 13:28 [PATCH RESEND 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins He Kuang
@ 2015-05-28 13:28 ` He Kuang
  2015-06-09  9:52   ` [tip:perf/core] " tip-bot for He Kuang
  2015-06-05 11:39 ` [PATCH RESEND 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins He Kuang
  2015-06-09  9:51 ` [tip:perf/core] " tip-bot for He Kuang
  2 siblings, 1 reply; 6+ messages in thread
From: He Kuang @ 2015-05-28 13:28 UTC (permalink / raw)
  To: acme, jolsa, mingo, a.p.zijlstra; +Cc: wangnan0, linux-kernel

The libtrace-dynamic-list file is used to export symbols used by
traceevent plugins.

Signed-off-by: He Kuang <hekuang@huawei.com>
---
 tools/lib/traceevent/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/lib/traceevent/.gitignore b/tools/lib/traceevent/.gitignore
index 35f56be..3c60335 100644
--- a/tools/lib/traceevent/.gitignore
+++ b/tools/lib/traceevent/.gitignore
@@ -1 +1,2 @@
 TRACEEVENT-CFLAGS
+libtraceevent-dynamic-list
-- 
1.8.5.2


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

* Re: [PATCH RESEND 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins
  2015-05-28 13:28 [PATCH RESEND 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins He Kuang
  2015-05-28 13:28 ` [PATCH RESEND 2/2] tools lib traceevent: Ignore libtrace-dynamic-list file He Kuang
@ 2015-06-05 11:39 ` He Kuang
  2015-06-05 14:41   ` Arnaldo Carvalho de Melo
  2015-06-09  9:51 ` [tip:perf/core] " tip-bot for He Kuang
  2 siblings, 1 reply; 6+ messages in thread
From: He Kuang @ 2015-06-05 11:39 UTC (permalink / raw)
  To: acme, jolsa, mingo, a.p.zijlstra, Namhyung Kim, Steven Rostedt
  Cc: wangnan0, linux-kernel

hi, Arnaldo

ping..

On 2015/5/28 21:28, 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.
>
> Before this patch:
>
>    (Prepare plugins)
>    $ ls /root/.traceevent/plugins/
>    plugin_sched_switch.so
>    plugin_function.so
>    ...
>
>    $ perf record -e 'ftrace:function' ls
>
>    $ perf script
>      Warning: could not load plugin '/mnt/data/root/.traceevent/plugins/plugin_sched_switch.so'
>      /root/.traceevent/plugins/plugin_sched_switch.so: undefined symbol: pevent_unregister_event_handler
>
>      Warning: could not load plugin '/root/.traceevent/plugins/plugin_function.so'
>      /root/.traceevent/plugins/plugin_function.so: undefined symbol: warning
>      ...
>             :1049  1049 [000]  9666.754487: ftrace:function:  ffffffff8118bc50 <-- ffffffff8118c5b3
>             :1049  1049 [000]  9666.754487: ftrace:function:  ffffffff818e2440 <-- ffffffff8118bc75
>             :1049  1049 [000]  9666.754487: ftrace:function:  ffffffff8106eee0 <-- ffffffff811212e2
>
> After this patch:
>
>    $ perf record -e 'ftrace:function' ls
>    $ perf script
>             :1049  1049 [000]  9666.754487: ftrace:function: __set_task_comm
>             :1049  1049 [000]  9666.754487: ftrace:function:    _raw_spin_lock
>             :1049  1049 [000]  9666.754487: ftrace:function: task_tgid_nr_ns
>             ...
>
> Signed-off-by: He Kuang <hekuang@huawei.com>
> Acked-by: Jiri Olsa <jolsa@kernel.org>
> ---
>   tools/lib/traceevent/Makefile | 14 +++++++++++++-
>   tools/perf/Makefile.perf      | 14 ++++++++++++--
>   2 files changed, 25 insertions(+), 3 deletions(-)
>
> diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
> index 8464039..6daaff6 100644
> --- a/tools/lib/traceevent/Makefile
> +++ b/tools/lib/traceevent/Makefile
> @@ -23,6 +23,7 @@ endef
>   # Allow setting CC and AR, or setting CROSS_COMPILE as a prefix.
>   $(call allow-override,CC,$(CROSS_COMPILE)gcc)
>   $(call allow-override,AR,$(CROSS_COMPILE)ar)
> +$(call allow-override,NM,$(CROSS_COMPILE)nm)
>
>   EXT = -std=gnu99
>   INSTALL = install
> @@ -157,8 +158,9 @@ PLUGINS_IN := $(PLUGINS:.so=-in.o)
>
>   TE_IN    := $(OUTPUT)libtraceevent-in.o
>   LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE))
> +DYNAMIC_LIST_FILE := $(OUTPUT)libtraceevent-dynamic-list
>
> -CMD_TARGETS = $(LIB_FILE) $(PLUGINS)
> +CMD_TARGETS = $(LIB_FILE) $(PLUGINS) $(DYNAMIC_LIST_FILE)
>
>   TARGETS = $(CMD_TARGETS)
>
> @@ -175,6 +177,9 @@ $(OUTPUT)libtraceevent.so: $(TE_IN)
>   $(OUTPUT)libtraceevent.a: $(TE_IN)
>   	$(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^
>
> +$(OUTPUT)libtraceevent-dynamic-list: $(PLUGINS)
> +	$(QUIET_GEN)$(call do_generate_dynamic_list_file, $(PLUGINS), $@)
> +
>   plugins: $(PLUGINS)
>
>   __plugin_obj = $(notdir $@)
> @@ -244,6 +249,13 @@ define do_install_plugins
>   	done
>   endef
>
> +define do_generate_dynamic_list_file
> +	(echo '{';							\
> +	$(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;	\
> +	echo '};';							\
> +	) > $2
> +endef
> +
>   install_lib: all_cmd install_plugins
>   	$(call QUIET_INSTALL, $(LIB_FILE)) \
>   		$(call do_install,$(LIB_FILE),$(libdir_SQ))
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 5816a3b..b1dfcd8 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -173,6 +173,9 @@ endif
>   LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
>   export LIBTRACEEVENT
>
> +LIBTRACEEVENT_DYNAMIC_LIST = $(TE_PATH)libtraceevent-dynamic-list
> +LDFLAGS += -Xlinker --dynamic-list=$(LIBTRACEEVENT_DYNAMIC_LIST)
> +
>   LIBAPI = $(LIB_PATH)libapi.a
>   export LIBAPI
>
> @@ -278,7 +281,7 @@ build := -f $(srctree)/tools/build/Makefile.build dir=. obj
>   $(PERF_IN): $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h FORCE
>   	$(Q)$(MAKE) $(build)=perf
>
> -$(OUTPUT)perf: $(PERFLIBS) $(PERF_IN)
> +$(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(LIBTRACEEVENT_DYNAMIC_LIST)
>   	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(PERF_IN) $(LIBS) -o $@
>
>   $(GTK_IN): FORCE
> @@ -373,7 +376,13 @@ $(LIB_FILE): $(LIBPERF_IN)
>   LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ)
>
>   $(LIBTRACEEVENT): FORCE
> -	$(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.a
> +
> +libtraceevent_plugins: FORCE
> +	$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) plugins
> +
> +$(LIBTRACEEVENT_DYNAMIC_LIST): libtraceevent_plugins
> +	$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent-dynamic-list
>
>   $(LIBTRACEEVENT)-clean:
>   	$(call QUIET_CLEAN, libtraceevent)
> @@ -555,4 +564,5 @@ FORCE:
>   .PHONY: all install clean config-clean strip install-gtk
>   .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
>   .PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope FORCE single_dep
> +.PHONY: libtraceevent_plugins
>
>


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

* Re: [PATCH RESEND 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins
  2015-06-05 11:39 ` [PATCH RESEND 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins He Kuang
@ 2015-06-05 14:41   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-06-05 14:41 UTC (permalink / raw)
  To: He Kuang
  Cc: jolsa, mingo, a.p.zijlstra, Namhyung Kim, Steven Rostedt,
	wangnan0, linux-kernel

Em Fri, Jun 05, 2015 at 07:39:26PM +0800, He Kuang escreveu:
> hi, Arnaldo
> 
> ping..

Thanks, applied both.

- Arnaldo

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

* [tip:perf/core] tools lib traceevent: Export dynamic symbols used by traceevent plugins
  2015-05-28 13:28 [PATCH RESEND 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins He Kuang
  2015-05-28 13:28 ` [PATCH RESEND 2/2] tools lib traceevent: Ignore libtrace-dynamic-list file He Kuang
  2015-06-05 11:39 ` [PATCH RESEND 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins He Kuang
@ 2015-06-09  9:51 ` tip-bot for He Kuang
  2 siblings, 0 replies; 6+ messages in thread
From: tip-bot for He Kuang @ 2015-06-09  9:51 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: a.p.zijlstra, mingo, hekuang, tglx, wangnan0, acme, hpa,
	linux-kernel, jolsa

Commit-ID:  e3d09ec8126fe2c9a3ade661e2126e215ca27a80
Gitweb:     http://git.kernel.org/tip/e3d09ec8126fe2c9a3ade661e2126e215ca27a80
Author:     He Kuang <hekuang@huawei.com>
AuthorDate: Thu, 28 May 2015 13:28:54 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 8 Jun 2015 10:30:31 -0300

tools lib traceevent: Export dynamic symbols used by traceevent plugins

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.

Before this patch:

  (Prepare plugins)
  $ ls /root/.traceevent/plugins/
  plugin_sched_switch.so
  plugin_function.so
  ...

  $ perf record -e 'ftrace:function' ls

  $ perf script
    Warning: could not load plugin '/mnt/data/root/.traceevent/plugins/plugin_sched_switch.so'
    /root/.traceevent/plugins/plugin_sched_switch.so: undefined symbol: pevent_unregister_event_handler

    Warning: could not load plugin '/root/.traceevent/plugins/plugin_function.so'
    /root/.traceevent/plugins/plugin_function.so: undefined symbol: warning
    ...
           :1049  1049 [000]  9666.754487: ftrace:function:  ffffffff8118bc50 <-- ffffffff8118c5b3
           :1049  1049 [000]  9666.754487: ftrace:function:  ffffffff818e2440 <-- ffffffff8118bc75
           :1049  1049 [000]  9666.754487: ftrace:function:  ffffffff8106eee0 <-- ffffffff811212e2

After this patch:

  $ perf record -e 'ftrace:function' ls
  $ perf script
           :1049  1049 [000]  9666.754487: ftrace:function: __set_task_comm
           :1049  1049 [000]  9666.754487: ftrace:function:    _raw_spin_lock
           :1049  1049 [000]  9666.754487: ftrace:function: task_tgid_nr_ns
           ...

Signed-off-by: He Kuang <hekuang@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1432819735-35040-1-git-send-email-hekuang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/Makefile | 14 +++++++++++++-
 tools/perf/Makefile.perf      | 14 ++++++++++++--
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 8464039..6daaff6 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -23,6 +23,7 @@ endef
 # Allow setting CC and AR, or setting CROSS_COMPILE as a prefix.
 $(call allow-override,CC,$(CROSS_COMPILE)gcc)
 $(call allow-override,AR,$(CROSS_COMPILE)ar)
+$(call allow-override,NM,$(CROSS_COMPILE)nm)
 
 EXT = -std=gnu99
 INSTALL = install
@@ -157,8 +158,9 @@ PLUGINS_IN := $(PLUGINS:.so=-in.o)
 
 TE_IN    := $(OUTPUT)libtraceevent-in.o
 LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE))
+DYNAMIC_LIST_FILE := $(OUTPUT)libtraceevent-dynamic-list
 
-CMD_TARGETS = $(LIB_FILE) $(PLUGINS)
+CMD_TARGETS = $(LIB_FILE) $(PLUGINS) $(DYNAMIC_LIST_FILE)
 
 TARGETS = $(CMD_TARGETS)
 
@@ -175,6 +177,9 @@ $(OUTPUT)libtraceevent.so: $(TE_IN)
 $(OUTPUT)libtraceevent.a: $(TE_IN)
 	$(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^
 
+$(OUTPUT)libtraceevent-dynamic-list: $(PLUGINS)
+	$(QUIET_GEN)$(call do_generate_dynamic_list_file, $(PLUGINS), $@)
+
 plugins: $(PLUGINS)
 
 __plugin_obj = $(notdir $@)
@@ -244,6 +249,13 @@ define do_install_plugins
 	done
 endef
 
+define do_generate_dynamic_list_file
+	(echo '{';							\
+	$(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;	\
+	echo '};';							\
+	) > $2
+endef
+
 install_lib: all_cmd install_plugins
 	$(call QUIET_INSTALL, $(LIB_FILE)) \
 		$(call do_install,$(LIB_FILE),$(libdir_SQ))
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 5816a3b..b1dfcd8 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -173,6 +173,9 @@ endif
 LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
 export LIBTRACEEVENT
 
+LIBTRACEEVENT_DYNAMIC_LIST = $(TE_PATH)libtraceevent-dynamic-list
+LDFLAGS += -Xlinker --dynamic-list=$(LIBTRACEEVENT_DYNAMIC_LIST)
+
 LIBAPI = $(LIB_PATH)libapi.a
 export LIBAPI
 
@@ -278,7 +281,7 @@ build := -f $(srctree)/tools/build/Makefile.build dir=. obj
 $(PERF_IN): $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h FORCE
 	$(Q)$(MAKE) $(build)=perf
 
-$(OUTPUT)perf: $(PERFLIBS) $(PERF_IN)
+$(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(LIBTRACEEVENT_DYNAMIC_LIST)
 	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(PERF_IN) $(LIBS) -o $@
 
 $(GTK_IN): FORCE
@@ -373,7 +376,13 @@ $(LIB_FILE): $(LIBPERF_IN)
 LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ)
 
 $(LIBTRACEEVENT): FORCE
-	$(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.a
+
+libtraceevent_plugins: FORCE
+	$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) plugins
+
+$(LIBTRACEEVENT_DYNAMIC_LIST): libtraceevent_plugins
+	$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent-dynamic-list
 
 $(LIBTRACEEVENT)-clean:
 	$(call QUIET_CLEAN, libtraceevent)
@@ -555,4 +564,5 @@ FORCE:
 .PHONY: all install clean config-clean strip install-gtk
 .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
 .PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope FORCE single_dep
+.PHONY: libtraceevent_plugins
 

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

* [tip:perf/core] tools lib traceevent: Ignore libtrace-dynamic-list file
  2015-05-28 13:28 ` [PATCH RESEND 2/2] tools lib traceevent: Ignore libtrace-dynamic-list file He Kuang
@ 2015-06-09  9:52   ` tip-bot for He Kuang
  0 siblings, 0 replies; 6+ messages in thread
From: tip-bot for He Kuang @ 2015-06-09  9:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, acme, wangnan0, a.p.zijlstra, jolsa, linux-kernel, hekuang,
	tglx, mingo

Commit-ID:  38e096249b4fca1a26ca8908ea2018a5faf366e2
Gitweb:     http://git.kernel.org/tip/38e096249b4fca1a26ca8908ea2018a5faf366e2
Author:     He Kuang <hekuang@huawei.com>
AuthorDate: Thu, 28 May 2015 13:28:55 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 8 Jun 2015 10:30:32 -0300

tools lib traceevent: Ignore libtrace-dynamic-list file

The libtrace-dynamic-list file is used to export symbols used by
traceevent plugins.

Signed-off-by: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1432819735-35040-2-git-send-email-hekuang@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/lib/traceevent/.gitignore b/tools/lib/traceevent/.gitignore
index 35f56be..3c60335 100644
--- a/tools/lib/traceevent/.gitignore
+++ b/tools/lib/traceevent/.gitignore
@@ -1 +1,2 @@
 TRACEEVENT-CFLAGS
+libtraceevent-dynamic-list

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

end of thread, other threads:[~2015-06-09  9:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-28 13:28 [PATCH RESEND 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins He Kuang
2015-05-28 13:28 ` [PATCH RESEND 2/2] tools lib traceevent: Ignore libtrace-dynamic-list file He Kuang
2015-06-09  9:52   ` [tip:perf/core] " tip-bot for He Kuang
2015-06-05 11:39 ` [PATCH RESEND 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins He Kuang
2015-06-05 14:41   ` Arnaldo Carvalho de Melo
2015-06-09  9:51 ` [tip:perf/core] " tip-bot for He Kuang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).