Skip to content

Commit 1a49b2f

Browse files
joe-lawrencemasahir0y
authored andcommitted
kbuild: strip whitespace in cmd_record_mcount findstring
CC_FLAGS_FTRACE may contain trailing whitespace that interferes with findstring. For example, commit 6977f95 ("powerpc: avoid -mno-sched-epilog on GCC 4.9 and newer") introduced a change such that on my ppc64le box, CC_FLAGS_FTRACE="-pg -mprofile-kernel ". (Note the trailing space.) When cmd_record_mcount is now invoked, findstring fails as the ftrace flags were found at very end of _c_flags, without the trailing space. _c_flags=" ... -pg -mprofile-kernel" CC_FLAGS_FTRACE="-pg -mprofile-kernel " ^ findstring is looking for this extra space Remove the redundant whitespaces from CC_FLAGS_FTRACE in cmd_record_mcount to avoid this problem. [masahiro.yamada: This issue only happens in the released versions of GNU Make. CC_FLAGS_FTRACE will not contain the trailing space if you use the latest GNU Make, which contains commit b90fabc8d6f3 ("* NEWS: Do not insert a space during '+=' if the value is empty.") ] Suggested-by: Masahiro Yamada <yamada.masahiro@socionext.com> (refactoring) Fixes: 6977f95 ("powerpc: avoid -mno-sched-epilog on GCC 4.9 and newer"). Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com> Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
1 parent 156e7cb commit 1a49b2f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

scripts/Makefile.build

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,8 @@ sub_cmd_record_mcount = perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
199199
"$(if $(part-of-module),1,0)" "$(@)";
200200
recordmcount_source := $(srctree)/scripts/recordmcount.pl
201201
endif # BUILD_C_RECORDMCOUNT
202-
cmd_record_mcount = \
203-
if [ "$(findstring $(CC_FLAGS_FTRACE),$(_c_flags))" = \
204-
"$(CC_FLAGS_FTRACE)" ]; then \
205-
$(sub_cmd_record_mcount) \
206-
fi
202+
cmd_record_mcount = $(if $(findstring $(strip $(CC_FLAGS_FTRACE)),$(_c_flags)), \
203+
$(sub_cmd_record_mcount))
207204
endif # CC_USING_RECORD_MCOUNT
208205
endif # CONFIG_FTRACE_MCOUNT_RECORD
209206

0 commit comments

Comments
 (0)