From: David Carrillo-Cisneros <davidcc@google.com>
To: linux-kernel@vger.kernel.org
Cc: "Ingo Molnar" <mingo@redhat.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Arnaldo Carvalho de Melo" <acme@kernel.org>,
"Jiri Olsa" <jolsa@kernel.org>,
"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
"Wang Nan" <wangnan0@huawei.com>, "He Kuang" <hekuang@huawei.com>,
"Michal Marek" <mmarek@suse.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Stephane Eranian" <eranian@google.com>,
"Paul Turner" <pjt@google.com>,
"David Carrillo-Cisneros" <davidcc@google.com>
Subject: [PATCH v2] tools lib traceevent: Robustify do_generate_dynamic_list_file
Date: Tue, 7 Feb 2017 21:28:40 -0800 [thread overview]
Message-ID: <20170208052840.112182-1-davidcc@google.com> (raw)
In-Reply-To: <CALcN6miT9VzeevAkZsyioFF2Evf8xKGyn9PKXRV=vvuQohe8pQ@mail.gmail.com>
v2: Accept "W" and "w" symbol options.
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 the built of dynamic symbol list by enforcing that the second
column of $(NM) -u <files> is either "U" (Undefined), "W" or "w" (undefined
weak), which are the possible outputs from non-ancient $(NM) versions.
Print an error if format is unexpected.
Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
---
tools/lib/traceevent/Makefile | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 2616c66e10c1..a7046ec01a5b 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -257,10 +257,16 @@ 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}' | \
+ xargs echo "U W w" | tr ' ' '\n' | sort -u | xargs echo`;\
+ if [ "$$symbol_type" == "U W w" ];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
next prev parent reply other threads:[~2017-02-08 5:29 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-02 6:38 [PATCH 0/4] Fixes for perf build and feature detection David Carrillo-Cisneros
2017-02-02 6:38 ` [PATCH 1/4] perf tools: pass PYTHON config to " David Carrillo-Cisneros
2017-02-06 13:19 ` Arnaldo Carvalho de Melo
2017-02-06 15:19 ` Namhyung Kim
2017-02-07 19:47 ` Arnaldo Carvalho de Melo
2017-02-08 3:15 ` David Carrillo-Cisneros
2017-02-08 5:28 ` David Carrillo-Cisneros [this message]
2017-02-08 12:44 ` [PATCH v2] tools lib traceevent: Robustify do_generate_dynamic_list_file Arnaldo Carvalho de Melo
2017-02-08 13:24 ` Arnaldo Carvalho de Melo
2017-02-09 5:03 ` David Carrillo-Cisneros
2017-02-10 7:47 ` [tip:perf/core] " tip-bot for David Carrillo-Cisneros
2017-02-02 6:38 ` [PATCH 2/4] " David Carrillo-Cisneros
2017-02-06 17:45 ` Arnaldo Carvalho de Melo
2017-02-02 6:38 ` [PATCH 3/4] tools lib feature: Do not redefine compiler configuration David Carrillo-Cisneros
2017-02-06 13:38 ` Arnaldo Carvalho de Melo
2017-02-06 15:42 ` Jiri Olsa
2017-02-02 6:38 ` [PATCH 4/4] tools include: Fix include path for uapi/asm-generic/mman.h David Carrillo-Cisneros
2017-02-02 12:56 ` Jiri Olsa
2017-02-06 18:25 ` Arnaldo Carvalho de Melo
2017-02-06 20:09 ` David Carrillo-Cisneros
2017-02-02 12:56 ` [PATCH 0/4] Fixes for perf build and feature detection Jiri Olsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170208052840.112182-1-davidcc@google.com \
--to=davidcc@google.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=eranian@google.com \
--cc=hekuang@huawei.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=mmarek@suse.com \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=wangnan0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.