mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-09-02 08:32:55 +00:00

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: 32e8eaf263
("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>
51 lines
1.4 KiB
Makefile
51 lines
1.4 KiB
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
#
|
|
# Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
|
|
#
|
|
|
|
obj-y := stub.o mmu.o process.o syscall.o uaccess.o \
|
|
stub_exe_embed.o
|
|
|
|
# Stub executable
|
|
|
|
stub_exe_objs-y := stub_exe.o
|
|
|
|
stub_exe_objs := $(foreach F,$(stub_exe_objs-y),$(obj)/$F)
|
|
|
|
# Object file containing the ELF executable
|
|
$(obj)/stub_exe_embed.o: $(src)/stub_exe_embed.S $(obj)/stub_exe
|
|
|
|
$(obj)/stub_exe.dbg: $(stub_exe_objs) FORCE
|
|
$(call if_changed,stub_exe)
|
|
|
|
$(obj)/stub_exe: OBJCOPYFLAGS := -S
|
|
$(obj)/stub_exe: $(obj)/stub_exe.dbg FORCE
|
|
$(call if_changed,objcopy)
|
|
|
|
quiet_cmd_stub_exe = STUB_EXE $@
|
|
cmd_stub_exe = $(CC) -nostdlib -o $@ \
|
|
$(filter-out $(UM_GPROF_OPT) $(UM_GCOV_OPT),$(KBUILD_CFLAGS)) $(STUB_EXE_LDFLAGS) \
|
|
$(filter %.o,$^)
|
|
|
|
STUB_EXE_LDFLAGS = -Wl,-n -static
|
|
|
|
targets += stub_exe.dbg stub_exe $(stub_exe_objs-y)
|
|
|
|
# end
|
|
|
|
# stub.o is in the stub, so it can't be built with profiling
|
|
# GCC hardened also auto-enables -fpic, but we need %ebx so it can't work ->
|
|
# disable it
|
|
|
|
CFLAGS_stub.o := $(CFLAGS_NO_HARDENING)
|
|
CFLAGS_stub_exe.o := $(CFLAGS_NO_HARDENING)
|
|
|
|
# Clang will call memset() from __builtin_alloca() when stack variable
|
|
# initialization is enabled, which is used in stub_exe.c.
|
|
CFLAGS_stub_exe.o += $(call cc-option, -ftrivial-auto-var-init=uninitialized)
|
|
|
|
UNPROFILE_OBJS := stub.o stub_exe.o
|
|
KCOV_INSTRUMENT := n
|
|
|
|
include $(srctree)/arch/um/scripts/Makefile.rules
|