Skip to content

Commit d3b08e5

Browse files
committed
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 <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Fixes: 32e8eaf ("um: use execveat to create userspace MMs") Link: https://patch.msgid.link/20241025102700.9fbb9c34473f.I7f1537fe075638f8da64beb52ef6c9e5adc51bc3@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 42b8b00 commit d3b08e5

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

arch/um/Makefile-skas

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
# Licensed under the GPL
44
#
55

6-
GPROF_OPT += -pg
6+
export UM_GPROF_OPT += -pg
77

88
ifdef CONFIG_CC_IS_CLANG
9-
GCOV_OPT += -fprofile-instr-generate -fcoverage-mapping
9+
export UM_GCOV_OPT += -fprofile-instr-generate -fcoverage-mapping
1010
else
11-
GCOV_OPT += -fprofile-arcs -ftest-coverage
11+
export UM_GCOV_OPT += -fprofile-arcs -ftest-coverage
1212
endif
1313

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)

arch/um/kernel/skas/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ $(obj)/stub_exe: $(obj)/stub_exe.dbg FORCE
2424

2525
quiet_cmd_stub_exe = STUB_EXE $@
2626
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) \
2828
$(filter %.o,$^)
2929

3030
STUB_EXE_LDFLAGS = -Wl,-n -static

0 commit comments

Comments
 (0)