]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
um: fix stub exe build with CONFIG_GCOV
authorJohannes Berg <johannes.berg@intel.com>
Fri, 25 Oct 2024 08:27:01 +0000 (10:27 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Sat, 26 Oct 2024 14:06:10 +0000 (16:06 +0200)
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>
arch/um/Makefile-skas
arch/um/kernel/skas/Makefile

index 67323b02899990b58c9f008565e7df2b7f7dcbda..1a27e65bcb9c15b97041c891d0df14a578bfd4f0 100644 (file)
@@ -3,15 +3,15 @@
 # Licensed under the GPL
 #
 
-GPROF_OPT += -pg
+export UM_GPROF_OPT += -pg
 
 ifdef CONFIG_CC_IS_CLANG
-GCOV_OPT += -fprofile-instr-generate -fcoverage-mapping
+export UM_GCOV_OPT += -fprofile-instr-generate -fcoverage-mapping
 else
-GCOV_OPT += -fprofile-arcs -ftest-coverage
+export UM_GCOV_OPT += -fprofile-arcs -ftest-coverage
 endif
 
-CFLAGS-$(CONFIG_GCOV) += $(GCOV_OPT)
-CFLAGS-$(CONFIG_GPROF) += $(GPROF_OPT)
-LINK-$(CONFIG_GCOV) += $(GCOV_OPT)
-LINK-$(CONFIG_GPROF) += $(GPROF_OPT)
+CFLAGS-$(CONFIG_GCOV) += $(UM_GCOV_OPT)
+CFLAGS-$(CONFIG_GPROF) += $(UM_GPROF_OPT)
+LINK-$(CONFIG_GCOV) += $(UM_GCOV_OPT)
+LINK-$(CONFIG_GPROF) += $(UM_GPROF_OPT)
index f6a219074772283f3c6c6d8d6ccaa8a1cfc24e33..3384be42691f89343b4f5c5e40e2553d4576f81f 100644 (file)
@@ -24,7 +24,7 @@ $(obj)/stub_exe: $(obj)/stub_exe.dbg FORCE
 
 quiet_cmd_stub_exe = STUB_EXE $@
       cmd_stub_exe = $(CC) -nostdlib -o $@ \
-                          $(KBUILD_CFLAGS) $(STUB_EXE_LDFLAGS) \
+                          $(filter-out $(UM_GPROF_OPT) $(UM_GCOV_OPT),$(KBUILD_CFLAGS)) $(STUB_EXE_LDFLAGS) \
                           $(filter %.o,$^)
 
 STUB_EXE_LDFLAGS = -Wl,-n -static