aboutsummaryrefslogtreecommitdiff
path: root/scripts/trylink
diff options
context:
space:
mode:
authorJean-Philippe Brucker <jean-philippe@linaro.org>2020-03-12 17:19:45 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2020-04-29 14:52:19 +0200
commited8af51b600fd16d22c6663a241547c3a9d7f2b4 (patch)
treecefe5aea5aaf30a1d96de97184aba405825ea509 /scripts/trylink
parentb9943741c26e1e597edc142066f428540d1f1207 (diff)
downloadbusybox-ed8af51b600fd16d22c6663a241547c3a9d7f2b4.tar.gz
build system: remove KBUILD_STR()
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>
Diffstat (limited to 'scripts/trylink')
-rwxr-xr-xscripts/trylink3
1 files changed, 0 insertions, 3 deletions
diff --git a/scripts/trylink b/scripts/trylink
index bb6b2de2f..6b74f092d 100755
--- a/scripts/trylink
+++ b/scripts/trylink
@@ -50,9 +50,6 @@ check_cc() {
echo "int main(int argc,char**argv){return argv?argc:0;}" >"$tempname".c
# Can use "-o /dev/null", but older gcc tend to *unlink it* on failure! :(
# Was using "-xc /dev/null", but we need a valid C program.
- # "eval" may be needed if CFLAGS can contain
- # '... -D"BB_VER=KBUILD_STR(1.N.M)" ...'
- # and we need shell to process quotes!
$CC $CFLAGS $LDFLAGS $1 "$tempname".c -o "$tempname" >/dev/null 2>&1
exitcode=$?
rm -f "$tempname" "$tempname".c "$tempname".o