diff mbox

kbuild: fix ksym_dep_filter when multiple EXPORT_SYMBOL() on the same line

Message ID alpine.LFD.2.20.1604281718520.5091@knanqh.ubzr (mailing list archive)
State New, archived
Headers show

Commit Message

Nicolas Pitre April 28, 2016, 9:29 p.m. UTC
In kernel/cgroup.c there is:

    #define SUBSYS(_x)                                             \
        DEFINE_STATIC_KEY_TRUE(_x ## _cgrp_subsys_enabled_key);    \
        DEFINE_STATIC_KEY_TRUE(_x ## _cgrp_subsys_on_dfl_key);     \
        EXPORT_SYMBOL_GPL(_x ## _cgrp_subsys_enabled_key);         \
        EXPORT_SYMBOL_GPL(_x ## _cgrp_subsys_on_dfl_key);

The expansion of this macro causes multiple EXPORT_SYMBOL_GPL() instances
to appear on the same preprocessor line output, confusing the sed script
expecting only one of them per line.  Unfortunately this can't be fixed
nicely in the sed script as sed's regexp can't do non greedy matching.

Fix this by turning any semicolon into a line break before filtering.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Nicolas Pitre <nico@linaro.org>

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Arnd Bergmann April 28, 2016, 9:32 p.m. UTC | #1
On Thursday 28 April 2016 17:29:42 Nicolas Pitre wrote:
> In kernel/cgroup.c there is:
> 
>     #define SUBSYS(_x)                                             \
>         DEFINE_STATIC_KEY_TRUE(_x ## _cgrp_subsys_enabled_key);    \
>         DEFINE_STATIC_KEY_TRUE(_x ## _cgrp_subsys_on_dfl_key);     \
>         EXPORT_SYMBOL_GPL(_x ## _cgrp_subsys_enabled_key);         \
>         EXPORT_SYMBOL_GPL(_x ## _cgrp_subsys_on_dfl_key);
> 
> The expansion of this macro causes multiple EXPORT_SYMBOL_GPL() instances
> to appear on the same preprocessor line output, confusing the sed script
> expecting only one of them per line.  Unfortunately this can't be fixed
> nicely in the sed script as sed's regexp can't do non greedy matching.
> 
> Fix this by turning any semicolon into a line break before filtering.
> 
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Nicolas Pitre <nico@linaro.org>

Tested-by: Arnd Bergmann <arnd@arndb.de>
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michal Marek May 10, 2016, 3:24 p.m. UTC | #2
On Thu, Apr 28, 2016 at 05:29:42PM -0400, Nicolas Pitre wrote:
> In kernel/cgroup.c there is:
> 
>     #define SUBSYS(_x)                                             \
>         DEFINE_STATIC_KEY_TRUE(_x ## _cgrp_subsys_enabled_key);    \
>         DEFINE_STATIC_KEY_TRUE(_x ## _cgrp_subsys_on_dfl_key);     \
>         EXPORT_SYMBOL_GPL(_x ## _cgrp_subsys_enabled_key);         \
>         EXPORT_SYMBOL_GPL(_x ## _cgrp_subsys_on_dfl_key);
> 
> The expansion of this macro causes multiple EXPORT_SYMBOL_GPL() instances
> to appear on the same preprocessor line output, confusing the sed script
> expecting only one of them per line.  Unfortunately this can't be fixed
> nicely in the sed script as sed's regexp can't do non greedy matching.
> 
> Fix this by turning any semicolon into a line break before filtering.
> 
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Nicolas Pitre <nico@linaro.org>

Applied to kbuild.git#kbuild.

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 36e9475395..1f0d41cc73 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -281,7 +281,7 @@  ksym_dep_filter =                                                            \
 	    $(CPP) $(call flags_nodeps,a_flags) -D__KSYM_DEPS__ $< ;;        \
 	  boot*|build*|*cpp_lds_S|dtc|host*|vdso*) : ;;                      \
 	  *) echo "Don't know how to preprocess $(1)" >&2; false ;;          \
-	esac | sed -rn 's/^.*=== __KSYM_(.*) ===.*$$/KSYM_\1/p'
+	esac | tr ";" "\n" | sed -rn 's/^.*=== __KSYM_(.*) ===.*$$/KSYM_\1/p'
 
 cmd_and_fixdep =                                                             \
 	$(echo-cmd) $(cmd_$(1));                                             \