Skip to content

Commit 736b342

Browse files
glebfmgregkh
authored andcommitted
jump label: fix passing kbuild_cflags when checking for asm goto support
commit 7292ae3d5a18fb922be496e6bb687647193569b4 upstream. The latest change of asm goto support check added passing of KBUILD_CFLAGS to compiler. When these flags reference gcc plugins that are not built yet, the check fails. When one runs "make bzImage" followed by "make modules", the kernel is always built with HAVE_JUMP_LABEL disabled, while the modules are built depending on CONFIG_JUMP_LABEL. If HAVE_JUMP_LABEL macro happens to be different, modules are built with undefined references, e.g.: ERROR: "static_key_slow_inc" [net/netfilter/xt_TEE.ko] undefined! ERROR: "static_key_slow_dec" [net/netfilter/xt_TEE.ko] undefined! ERROR: "static_key_slow_dec" [net/netfilter/nft_meta.ko] undefined! ERROR: "static_key_slow_inc" [net/netfilter/nft_meta.ko] undefined! ERROR: "nf_hooks_needed" [net/netfilter/ipvs/ip_vs.ko] undefined! ERROR: "nf_hooks_needed" [net/ipv6/ipv6.ko] undefined! ERROR: "static_key_count" [net/ipv6/ipv6.ko] undefined! ERROR: "static_key_slow_inc" [net/ipv6/ipv6.ko] undefined! This change moves the check before all these references are added to KBUILD_CFLAGS. This is correct because subsequent KBUILD_CFLAGS modifications are not relevant to this check. Reported-by: Anton V. Boyarshinov <boyarsh@altlinux.org> Fixes: 35f860f9ba6a ("jump label: pass kbuild_cflags when checking for asm goto support") Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Acked-by: David Lin <dtwlin@google.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 53ae0c2 commit 736b342

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,12 @@ endif
633633
# Tell gcc to never replace conditional load with a non-conditional one
634634
KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
635635

636+
# check for 'asm goto'
637+
ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
638+
KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
639+
KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
640+
endif
641+
636642
ifdef CONFIG_READABLE_ASM
637643
# Disable optimizations that make assembler listings hard to read.
638644
# reorder blocks reorders the control in the function
@@ -788,12 +794,6 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=date-time)
788794
# use the deterministic mode of AR if available
789795
KBUILD_ARFLAGS := $(call ar-option,D)
790796

791-
# check for 'asm goto'
792-
ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
793-
KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
794-
KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
795-
endif
796-
797797
include scripts/Makefile.kasan
798798
include scripts/Makefile.extrawarn
799799

0 commit comments

Comments
 (0)