Re: [PATCH v2] kbuild: fix if_change and friends to consider argument order

From: Michal Marek
Date: Tue May 10 2016 - 15:22:13 EST


On Sat, May 07, 2016 at 03:48:26PM +0900, Masahiro Yamada wrote:
> Currently, arg-check is implemented as follows:
>
> arg-check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
> $(filter-out $(cmd_$@), $(cmd_$(1))) )
>
> This does not care about the order of arguments that appear in
> $(cmd_$(1)) and $(cmd_$@). So, if_changed and friends never rebuild
> the target if only the argument order is changed. This is a problem
> when the link order is changed.
>
> Apparently,
>
> obj-y += foo.o
> obj-y += bar.o
>
> and
>
> obj-y += bar.o
> obj-y += foo.o
>
> should be distinguished because the link order determines the probe
> order of drivers. So, built-in.o should be rebuilt when the order
> of objects is changed.
>
> This commit fixes arg-check to compare the old/current commands
> including the argument order.
>
> Of course, this change has a side effect; Kbuild will react to the
> change of compile option order. For example, "-DFOO -DBAR" and
> "-DBAR -DFOO" should give no difference to the build result, but
> false positive should be better than false negative.

Agreed. Applied to kbuild.git#kbuild now.

Michal