]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.19.45/kbuild-turn-auto.conf.cmd-into-a-mandatory-include-file.patch
drop queue-4.14/mips-make-sure-dt-memory-regions-are-valid.patch
[thirdparty/kernel/stable-queue.git] / releases / 4.19.45 / kbuild-turn-auto.conf.cmd-into-a-mandatory-include-file.patch
CommitLineData
4463d21a
GKH
1From d2f8ae0e4c5c754f1b2a7b8388d19a1a977e698a Mon Sep 17 00:00:00 2001
2From: Masahiro Yamada <yamada.masahiro@socionext.com>
3Date: Sun, 12 May 2019 11:13:48 +0900
4Subject: kbuild: turn auto.conf.cmd into a mandatory include file
5
6From: Masahiro Yamada <yamada.masahiro@socionext.com>
7
8commit d2f8ae0e4c5c754f1b2a7b8388d19a1a977e698a upstream.
9
10syncconfig is responsible for keeping auto.conf up-to-date, so if it
11fails for any reason, the build must be terminated immediately.
12
13However, since commit 9390dff66a52 ("kbuild: invoke syncconfig if
14include/config/auto.conf.cmd is missing"), Kbuild continues running
15even after syncconfig fails.
16
17You can confirm this by intentionally making syncconfig error out:
18
19# diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
20# index 08ba146..307b9de 100644
21# --- a/scripts/kconfig/confdata.c
22# +++ b/scripts/kconfig/confdata.c
23# @@ -1023,6 +1023,9 @@ int conf_write_autoconf(int overwrite)
24# FILE *out, *tristate, *out_h;
25# int i;
26#
27# + if (overwrite)
28# + return 1;
29# +
30# if (!overwrite && is_present(autoconf_name))
31# return 0;
32
33Then, syncconfig fails, but Make would not stop:
34
35 $ make -s mrproper allyesconfig defconfig
36 $ make
37 scripts/kconfig/conf --syncconfig Kconfig
38
39 *** Error during sync of the configuration.
40
41 make[2]: *** [scripts/kconfig/Makefile;69: syncconfig] Error 1
42 make[1]: *** [Makefile;557: syncconfig] Error 2
43 make: *** [include/config/auto.conf.cmd] Deleting file 'include/config/tristate.conf'
44 make: Failed to remake makefile 'include/config/auto.conf'.
45 SYSTBL arch/x86/include/generated/asm/syscalls_32.h
46 SYSHDR arch/x86/include/generated/asm/unistd_32_ia32.h
47 SYSHDR arch/x86/include/generated/asm/unistd_64_x32.h
48 SYSTBL arch/x86/include/generated/asm/syscalls_64.h
49 [ continue running ... ]
50
51The reason is in the behavior of a pattern rule with multi-targets.
52
53 %/auto.conf %/auto.conf.cmd %/tristate.conf: $(KCONFIG_CONFIG)
54 $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig
55
56GNU Make knows this rule is responsible for making all the three files
57simultaneously. As far as examined, auto.conf.cmd is the target in
58question when this rule is invoked. It is probably because auto.conf.cmd
59is included below the inclusion of auto.conf.
60
61The inclusion of auto.conf is mandatory, while that of auto.conf.cmd
62is optional. GNU Make does not care about the failure in the process
63of updating optional include files.
64
65I filed this issue (https://savannah.gnu.org/bugs/?56301) in case this
66behavior could be improved somehow in future releases of GNU Make.
67Anyway, it is quite easy to fix our Makefile.
68
69Given that auto.conf is already a mandatory include file, there is no
70reason to stick auto.conf.cmd optional. Make it mandatory as well.
71
72Cc: linux-stable <stable@vger.kernel.org> # 5.0+
73Fixes: 9390dff66a52 ("kbuild: invoke syncconfig if include/config/auto.conf.cmd is missing")
74Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
75[commented out diff above to keep patch happy - gregkh]
76Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
77
78---
79 Makefile | 2 +-
80 1 file changed, 1 insertion(+), 1 deletion(-)
81
82--- a/Makefile
83+++ b/Makefile
84@@ -623,7 +623,7 @@ ifeq ($(may-sync-config),1)
85 # Read in dependencies to all Kconfig* files, make sure to run syncconfig if
86 # changes are detected. This should be included after arch/$(SRCARCH)/Makefile
87 # because some architectures define CROSS_COMPILE there.
88--include include/config/auto.conf.cmd
89+include include/config/auto.conf.cmd
90
91 # To avoid any implicit rule to kick in, define an empty command
92 $(KCONFIG_CONFIG): ;