Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752868AbbELGoQ (ORCPT ); Tue, 12 May 2015 02:44:16 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:27892 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752418AbbELGoN (ORCPT ); Tue, 12 May 2015 02:44:13 -0400 Subject: Re: [PATCH 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins To: Jiri Olsa References: <1431336927-17202-1-git-send-email-hekuang@huawei.com> <20150511143309.GA22341@krava.redhat.com> CC: , , , , , , Mathias Krause From: He Kuang Message-ID: <5551A0C2.4080407@huawei.com> Date: Tue, 12 May 2015 14:42:10 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.0 MIME-Version: 1.0 In-Reply-To: <20150511143309.GA22341@krava.redhat.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.110.54.65] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2963 Lines: 78 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: > http://marc.info/?l=linux-kernel&m=142885447432384&w=2 > > it seems it's not merged yet, but I like this one better > > SNIP > > >> 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 >> export LIBTRACEEVENT >> +LIBTRACEEVENT_DYNAMIC_LIST = $(TE_PATH)libtraceevent-dynamic-list >> >> LIBAPI = $(LIB_PATH)libapi.a >> export LIBAPI >> @@ -278,8 +279,9 @@ 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) >> - $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(PERF_IN) $(LIBS) -o $@ >> +LD_LIBTRACEEVENT_FLAGS += -Xlinker --dynamic-list=$(LIBTRACEEVENT_DYNAMIC_LIST) >> +$(OUTPUT)perf: $(PERFLIBS) $(PERF_IN) $(LIBTRACEEVENT_DYNAMIC_LIST) >> + $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(LD_LIBTRACEEVENT_FLAGS) $(PERF_IN) $(LIBS) -o $@ >> >> $(GTK_IN): FORCE >> $(Q)$(MAKE) $(build)=gtk >> @@ -375,6 +377,9 @@ LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ) >> $(LIBTRACEEVENT): FORCE >> $(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent.a plugins >> >> +$(LIBTRACEEVENT_DYNAMIC_LIST): $(LIBTRACEEVENT) >> + $(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 > > jirka 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 LINK plugin_function.so GEN libtraceevent-dynamic-list LINK perf Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/