Skip to content

Commit 65bba04

Browse files
committed
kbuild: fix UML build error with CONFIG_GCC_PLUGINS
UML fails to build with CONFIG_GCC_PLUGINS=y. $ make -s ARCH=um mrproper $ make -s ARCH=um allmodconfig $ make ARCH=um UPD include/generated/uapi/linux/version.h WRAP arch/x86/include/generated/uapi/asm/bpf_perf_event.h WRAP arch/x86/include/generated/uapi/asm/poll.h WRAP arch/x86/include/generated/asm/dma-contiguous.h WRAP arch/x86/include/generated/asm/early_ioremap.h WRAP arch/x86/include/generated/asm/export.h WRAP arch/x86/include/generated/asm/mcs_spinlock.h WRAP arch/x86/include/generated/asm/mm-arch-hooks.h SYSTBL arch/x86/include/generated/asm/syscalls_32.h SYSHDR arch/x86/include/generated/asm/unistd_32_ia32.h SYSHDR arch/x86/include/generated/asm/unistd_64_x32.h SYSTBL arch/x86/include/generated/asm/syscalls_64.h SYSHDR arch/x86/include/generated/uapi/asm/unistd_32.h SYSHDR arch/x86/include/generated/uapi/asm/unistd_64.h SYSHDR arch/x86/include/generated/uapi/asm/unistd_x32.h HOSTCC scripts/unifdef CC arch/x86/um/user-offsets.s cc1: error: cannot load plugin ./scripts/gcc-plugins/cyc_complexity_plugin.so ./scripts/gcc-plugins/cyc_complexity_plugin.so: cannot open shared object file: No such file or directory cc1: error: cannot load plugin ./scripts/gcc-plugins/structleak_plugin.so ./scripts/gcc-plugins/structleak_plugin.so: cannot open shared object file: No such file or directory cc1: error: cannot load plugin ./scripts/gcc-plugins/latent_entropy_plugin.so ./scripts/gcc-plugins/latent_entropy_plugin.so: cannot open shared object file: No such file or directory cc1: error: cannot load plugin ./scripts/gcc-plugins/randomize_layout_plugin.so ./scripts/gcc-plugins/randomize_layout_plugin.so: cannot open shared object file: No such file or directory make[1]: *** [scripts/Makefile.build;119: arch/x86/um/user-offsets.s] Error 1 make: *** [arch/um/Makefile;152: arch/x86/um/user-offsets.s] Error 2 Reorder the preparation stage (with cleanups) to make sure gcc-plugins is built before descending to arch/x86/um/. Fixes: 6b90bd4 ("GCC plugin infrastructure") Reported-by: kbuild test robot <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 3b41528 commit 65bba04

File tree

3 files changed

+7
-25
lines changed

3 files changed

+7
-25
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,9 +1110,9 @@ prepare1: prepare2 $(version_h) $(autoksyms_h) include/generated/utsrelease.h
11101110

11111111
macroprepare: prepare1 archmacros
11121112

1113-
archprepare: archheaders archscripts macroprepare scripts_basic
1113+
archprepare: archheaders archscripts macroprepare scripts_basic gcc-plugins
11141114

1115-
prepare0: archprepare gcc-plugins
1115+
prepare0: archprepare
11161116
$(Q)$(MAKE) $(build)=.
11171117

11181118
# All the preparing..

arch/um/Makefile

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ endef
116116
archheaders:
117117
$(Q)$(MAKE) -f $(srctree)/Makefile ARCH=$(HEADER_ARCH) asm-generic archheaders
118118

119-
archprepare: include/generated/user_constants.h
119+
archprepare:
120+
$(Q)$(MAKE) $(build)=$(HOST_DIR)/um include/generated/user_constants.h
120121

121122
LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
122123
LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib $(call cc-option, -no-pie)
@@ -146,25 +147,4 @@ archclean:
146147
@find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \
147148
-o -name '*.gcov' \) -type f -print | xargs rm -f
148149

149-
# Generated files
150-
151-
$(HOST_DIR)/um/user-offsets.s: __headers FORCE
152-
$(Q)$(MAKE) $(build)=$(HOST_DIR)/um $@
153-
154-
define filechk_gen-asm-offsets
155-
(set -e; \
156-
echo "/*"; \
157-
echo " * DO NOT MODIFY."; \
158-
echo " *"; \
159-
echo " * This file was generated by arch/$(ARCH)/Makefile"; \
160-
echo " *"; \
161-
echo " */"; \
162-
echo ""; \
163-
sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" < $<; \
164-
echo ""; )
165-
endef
166-
167-
include/generated/user_constants.h: $(HOST_DIR)/um/user-offsets.s
168-
$(call filechk,gen-asm-offsets)
169-
170150
export HEADER_ARCH SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS DEV_NULL_PATH

arch/x86/um/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ subarch-$(CONFIG_MODULES) += ../kernel/module.o
3636

3737
USER_OBJS := bugs_$(BITS).o ptrace_user.o fault.o
3838

39-
extra-y += user-offsets.s
4039
$(obj)/user-offsets.s: c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) \
4140
-Iarch/x86/include/generated
4241

42+
include/generated/user_constants.h: $(obj)/user-offsets.s
43+
$(call filechk,offsets,__USER_CONSTANT_H__)
44+
4345
UNPROFILE_OBJS := stub_segv.o
4446
CFLAGS_stub_segv.o := $(CFLAGS_NO_HARDENING)
4547

0 commit comments

Comments
 (0)