Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

um: fix stub exe build with CONFIG_GCOV

CONFIG_GCOV is special and only in UML since it builds the
kernel with a "userspace" option. This is fine, but the stub
is even more special and not really a full userspace process,
so it then fails to link as reported.

Remove the GCOV options from the stub build.

For good measure, also remove the GPROF options, even though
they don't seem to cause build failures now.

To be able to do this, export the specific options (GCOV_OPT
and GPROF_OPT) but rename them so there's less chance of any
conflicts.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202410242238.SXhs2kQ4-lkp@intel.com/
Fixes: 32e8eaf263d9 ("um: use execveat to create userspace MMs")
Link: https://patch.msgid.link/20241025102700.9fbb9c34473f.I7f1537fe075638f8da64beb52ef6c9e5adc51bc3@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

+8 -8
+7 -7
arch/um/Makefile-skas
··· 3 3 # Licensed under the GPL 4 4 # 5 5 6 - GPROF_OPT += -pg 6 + export UM_GPROF_OPT += -pg 7 7 8 8 ifdef CONFIG_CC_IS_CLANG 9 - GCOV_OPT += -fprofile-instr-generate -fcoverage-mapping 9 + export UM_GCOV_OPT += -fprofile-instr-generate -fcoverage-mapping 10 10 else 11 - GCOV_OPT += -fprofile-arcs -ftest-coverage 11 + export UM_GCOV_OPT += -fprofile-arcs -ftest-coverage 12 12 endif 13 13 14 - CFLAGS-$(CONFIG_GCOV) += $(GCOV_OPT) 15 - CFLAGS-$(CONFIG_GPROF) += $(GPROF_OPT) 16 - LINK-$(CONFIG_GCOV) += $(GCOV_OPT) 17 - LINK-$(CONFIG_GPROF) += $(GPROF_OPT) 14 + CFLAGS-$(CONFIG_GCOV) += $(UM_GCOV_OPT) 15 + CFLAGS-$(CONFIG_GPROF) += $(UM_GPROF_OPT) 16 + LINK-$(CONFIG_GCOV) += $(UM_GCOV_OPT) 17 + LINK-$(CONFIG_GPROF) += $(UM_GPROF_OPT)
+1 -1
arch/um/kernel/skas/Makefile
··· 24 24 25 25 quiet_cmd_stub_exe = STUB_EXE $@ 26 26 cmd_stub_exe = $(CC) -nostdlib -o $@ \ 27 - $(KBUILD_CFLAGS) $(STUB_EXE_LDFLAGS) \ 27 + $(filter-out $(UM_GPROF_OPT) $(UM_GCOV_OPT),$(KBUILD_CFLAGS)) $(STUB_EXE_LDFLAGS) \ 28 28 $(filter %.o,$^) 29 29 30 30 STUB_EXE_LDFLAGS = -Wl,-n -static