When using GNU Make >=4.3, the KBUILD_STR() definition interferes badly
with dependency checks during build, and forces a complete rebuild every
time Make runs.
In if_changed_rule, Kconfig checks if the command used to build a file
has changed since last execution. The previous command is stored in the
generated .<file>.o.cmd file. For example applets/.applets.o.cmd defines
a "cmd_applets/applets.o" variable:
cmd_applets/applets.o := gcc ... -D"KBUILD_STR(s)=#s" ...
Here the '#' should be escaped with a backslash, otherwise GNU Make
interprets it as starting a comment, and ignore the rest of the
variable. As a result of this truncation, the previous command doesn't
equal the new command and Make rebuilds each target.
The problem started to appear when GNU Make 4.3 (released January 2020),
introduced a backward-incompatible fix to macros containing a '#'. While
the above use of '#', a simple Make variable, still needs to be escaped,
a '#' within a function invocation doesn't need to be escaped anymore.
As Martin Dorey explained on the GNU Make discussion [1], the above
declaration is generated from make-cmd, defined as:
make-cmd = $(subst \#,\\\#,$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))
Since GNU Make 4.3, the first argument of subst should not have a
backslash. make-cmd now looks for literally \# and doesn't find it, and
as a result doesn't add the backslash when generating .o.cmd files.
[1] http://savannah.gnu.org/bugs/?20513
We could fix it by changing make-cmd to "$(subst #,\#,...)", but to
avoid compatibility headaches, simply get rid of the KBUILD_STR
definition, as done in Linux by b42841b7bb62 ("kbuild: Get rid of
KBUILD_STR"). Quote the string arguments directly rather than asking the
preprocessor to quote them.
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Before:
Trying libraries: crypt m resolv
Library crypt is not needed, excluding it
Library m is needed, can't exclude it (yet)
Library resolv is needed, can't exclude it (yet)
Library m is needed, can't exclude it (yet)
Library resolv is needed, can't exclude it (yet)
Final link with: m resolv
After:
Trying libraries: crypt m resolv
Library crypt is not needed, excluding it
Library m is needed, can't exclude it (yet)
Library resolv is needed, can't exclude it (yet)
Final link with: m resolv
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
The user might be including options in their LDFLAGS (like -fuse-ld=gold)
that change the behavior of the linker and thus change the results of the
flag tests. Make sure we include the user's LDFLAGS when running these
tests so we filter out flags that will fail when used later on.
URL: https://bugs.gentoo.org/499712
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
We don't use it in final link, should not use it in check_FOO then.
This uncovered a logic bug in glibc check...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
To that end, *make it complain* when check_cc fails on options
we usually want to succeed.
text data bss dec hex filename
929697 932 17692 948321 e7861 busybox-1.23.2/busybox
915361 911 17484 933756 e3f7c busybox-1.23.2.fixed/busybox
927725 932 17448 946105 e6fb9 busybox-1.24.0/busybox
913630 911 17240 931781 e37c5 busybox-1.24.0.fixed/busybox
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
The CPPFLAGS/CFLAGS settings might have features that matter, so make
sure we utilize them when testing the compiler.
URL: https://bugs.gentoo.org/471118
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
If our pkg-config queries pass back a flag like -pthread, the trylink
script will expand that to -l-pthread. So change trylink to only add
the -l prefix to a value that doesn't have a - prefix already.
Reported-by: thaehaid@incognitomail.org
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This makes them easier to change to support a non-GNU toolchain.
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>