Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933247AbbELPZw (ORCPT ); Tue, 12 May 2015 11:25:52 -0400 Received: from sender1.zohomail.com ([74.201.84.155]:22384 "EHLO sender1.zohomail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753400AbbELPZu (ORCPT ); Tue, 12 May 2015 11:25:50 -0400 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type; b=Ouh+3HbNe8s7xins7VMCvlgE9C61IMVeBlhaGuOo1Z8SRcNEjEovExFX+CU+LUlQW0Etwx4sAxFN H2tqf7j5qFbndGb/rE4BnqEiYiy1zjGhrXxxMCjj2juRCE2epsLP Message-ID: <55521B79.60202@zoho.com> Date: Tue, 12 May 2015 23:25:45 +0800 From: hekuang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Jiri Olsa , He Kuang CC: acme@kernel.org, jolsa@kernel.org, mingo@redhat.com, a.p.zijlstra@chello.nl, wangnan0@huawei.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] tools lib traceevent: Export dynamic symbols used by traceevent plugins References: <1431412917-101336-1-git-send-email-hekuang@huawei.com> <20150512123744.GF22341@krava.redhat.com> In-Reply-To: <20150512123744.GF22341@krava.redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4000 Lines: 112 Hi, jirka On 05/12/2015 08:37 PM, Jiri Olsa wrote: > On Tue, May 12, 2015 at 06:41:56AM +0000, He Kuang wrote: > > SNIP > >> $(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 >> @@ -373,7 +375,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 > I thought the idea of v2 was not to introduce new target, > something like in attached patch (not completely tested) > > jirka There is a problem, the target perf executable is dependent on the dynamic-list-file, so we should add plugins or the dynamic-list-file to perf's dependencies. As your patch below, the dynamic-list-file is built implictly when building plugins, so we should not add it directly to the dependency list of perf. It seems new targets are needed. In the v2 patch, dynamic-list-file is extracted out from plugins as perf's dependncy. > > --- > diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile > index d410da335e3d..57eed0403e6a 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 > @@ -169,7 +170,10 @@ $(OUTPUT)libtraceevent.so: $(TE_IN) > $(OUTPUT)libtraceevent.a: $(TE_IN) > $(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^ > > -plugins: $(PLUGINS) > +$(OUTPUT)libtraceevent-dynamic-list: $(PLUGINS) > + $(QUIET_GEN)$(call do_generate_dynamic_list_file, $(PLUGINS), $@) > + > +plugins: $(OUTPUT)libtraceevent-dynamic-list > > __plugin_obj = $(notdir $@) > plugin_obj = $(__plugin_obj:-in.o=) > @@ -238,6 +242,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),$(bindir_SQ)) > diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf > index 03409cc02117..a8db98649ea3 100644 > --- a/tools/perf/Makefile.perf > +++ b/tools/perf/Makefile.perf > @@ -173,6 +173,8 @@ endif > LIBTRACEEVENT = $(TE_PATH)libtraceevent.a > export LIBTRACEEVENT > > +LDFLAGS += -Xlinker --dynamic-list=$(TE_PATH)libtraceevent-dynamic-list > + > LIBAPI = $(LIB_PATH)libapi.a > export LIBAPI > > -- > 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/ > > -- 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/