From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752038AbdBFRpZ (ORCPT ); Mon, 6 Feb 2017 12:45:25 -0500 Received: from mail.kernel.org ([198.145.29.136]:39780 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751654AbdBFRpX (ORCPT ); Mon, 6 Feb 2017 12:45:23 -0500 Date: Mon, 6 Feb 2017 14:45:16 -0300 From: Arnaldo Carvalho de Melo To: David Carrillo-Cisneros Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Peter Zijlstra , Jiri Olsa , Alexander Shishkin , Wang Nan , He Kuang , Michal Marek , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Stephane Eranian , Paul Turner Subject: Re: [PATCH 2/4] tools lib traceevent: Robustify do_generate_dynamic_list_file Message-ID: <20170206174516.GA24988@kernel.org> References: <20170202063804.94027-1-davidcc@google.com> <20170202063804.94027-3-davidcc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170202063804.94027-3-davidcc@google.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Wed, Feb 01, 2017 at 10:38:02PM -0800, David Carrillo-Cisneros escreveu: > The dynamic-list-file used to export dynamic symbols introduced in > > commit e3d09ec8126f ("tools lib traceevent: Export dynamic symbols > used by traceevent plugins") > > is generated without any sort of error checking. > > I experienced problems due to an old version of nm (v 0.158) that outputs > in a format distinct from the assumed by the script. > > Robustify this by enforcing that the second column in the symbol output > is an "U" (Undefined) as it should be since we are calling $(NM) -u ... > and print an error message otherwise. Thanks, applied. - Arnaldo > Signed-off-by: David Carrillo-Cisneros > --- > tools/lib/traceevent/Makefile | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile > index 2616c66e10c1..1b6e146429d0 100644 > --- a/tools/lib/traceevent/Makefile > +++ b/tools/lib/traceevent/Makefile > @@ -257,10 +257,15 @@ define do_install_plugins > endef > > define do_generate_dynamic_list_file > - (echo '{'; \ > - $(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u; \ > - echo '};'; \ > - ) > $2 > + symbol_type=`$(NM) -u -D $1 | awk 'NF>1 {print $$1}' | sort -u`;\ > + if [ "$$symbol_type" == "U" ];then \ > + (echo '{'; \ > + $(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;\ > + echo '};'; \ > + ) > $2; \ > + else \ > + (echo Either missing one of [$1] or bad version of $(NM)) 1>&2;\ > + fi > endef > > install_lib: all_cmd install_plugins > -- > 2.11.0.483.g087da7b7c-goog