]>
Commit | Line | Data |
---|---|---|
4463d21a GKH |
1 | From d2f8ae0e4c5c754f1b2a7b8388d19a1a977e698a Mon Sep 17 00:00:00 2001 |
2 | From: Masahiro Yamada <yamada.masahiro@socionext.com> | |
3 | Date: Sun, 12 May 2019 11:13:48 +0900 | |
4 | Subject: kbuild: turn auto.conf.cmd into a mandatory include file | |
5 | ||
6 | From: Masahiro Yamada <yamada.masahiro@socionext.com> | |
7 | ||
8 | commit d2f8ae0e4c5c754f1b2a7b8388d19a1a977e698a upstream. | |
9 | ||
10 | syncconfig is responsible for keeping auto.conf up-to-date, so if it | |
11 | fails for any reason, the build must be terminated immediately. | |
12 | ||
13 | However, since commit 9390dff66a52 ("kbuild: invoke syncconfig if | |
14 | include/config/auto.conf.cmd is missing"), Kbuild continues running | |
15 | even after syncconfig fails. | |
16 | ||
17 | You 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 | ||
33 | Then, 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 | ||
51 | The 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 | ||
56 | GNU Make knows this rule is responsible for making all the three files | |
57 | simultaneously. As far as examined, auto.conf.cmd is the target in | |
58 | question when this rule is invoked. It is probably because auto.conf.cmd | |
59 | is included below the inclusion of auto.conf. | |
60 | ||
61 | The inclusion of auto.conf is mandatory, while that of auto.conf.cmd | |
62 | is optional. GNU Make does not care about the failure in the process | |
63 | of updating optional include files. | |
64 | ||
65 | I filed this issue (https://savannah.gnu.org/bugs/?56301) in case this | |
66 | behavior could be improved somehow in future releases of GNU Make. | |
67 | Anyway, it is quite easy to fix our Makefile. | |
68 | ||
69 | Given that auto.conf is already a mandatory include file, there is no | |
70 | reason to stick auto.conf.cmd optional. Make it mandatory as well. | |
71 | ||
72 | Cc: linux-stable <stable@vger.kernel.org> # 5.0+ | |
73 | Fixes: 9390dff66a52 ("kbuild: invoke syncconfig if include/config/auto.conf.cmd is missing") | |
74 | Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> | |
75 | [commented out diff above to keep patch happy - gregkh] | |
76 | Signed-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): ; |