diff options
author | David Carrillo-Cisneros <davidcc@google.com> | 2017-02-08 00:28:40 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-02-08 08:27:45 -0500 |
commit | 6467753d613993f30965d4e0717f7304eb933ef7 (patch) | |
tree | bc73628886e9a05a32bfe4c0ab533d2a8abe0a2b /tools/lib | |
parent | 360e071b1822d40357e371357f24f6ec43f0a080 (diff) |
tools lib traceevent: Robustify do_generate_dynamic_list_file
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.
v2: Accept "W" and "w" symbol options.
Signed-off-by: David Carrillo-Cisneros <davidcc@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Michal Marek <mmarek@suse.com>
Cc: Paul Turner <pjt@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20170208052840.112182-1-davidcc@google.com
[ Use STRING1 = STRING1 instead of == to make this work on Ubuntu systems ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/traceevent/Makefile | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile index 2616c66e10c1..47076b15eebe 100644 --- a/tools/lib/traceevent/Makefile +++ b/tools/lib/traceevent/Makefile | |||
@@ -257,10 +257,16 @@ define do_install_plugins | |||
257 | endef | 257 | endef |
258 | 258 | ||
259 | define do_generate_dynamic_list_file | 259 | define do_generate_dynamic_list_file |
260 | (echo '{'; \ | 260 | symbol_type=`$(NM) -u -D $1 | awk 'NF>1 {print $$1}' | \ |
261 | $(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u; \ | 261 | xargs echo "U W w" | tr ' ' '\n' | sort -u | xargs echo`;\ |
262 | echo '};'; \ | 262 | if [ "$$symbol_type" = "U W w" ];then \ |
263 | ) > $2 | 263 | (echo '{'; \ |
264 | $(NM) -u -D $1 | awk 'NF>1 {print "\t"$$2";"}' | sort -u;\ | ||
265 | echo '};'; \ | ||
266 | ) > $2; \ | ||
267 | else \ | ||
268 | (echo Either missing one of [$1] or bad version of $(NM)) 1>&2;\ | ||
269 | fi | ||
264 | endef | 270 | endef |
265 | 271 | ||
266 | install_lib: all_cmd install_plugins | 272 | install_lib: all_cmd install_plugins |