Hi Benjamin, On Thu, Sep 19, 2024 at 02:45:03PM +0200, Benjamin Berg wrote: ... > diff --git a/arch/um/kernel/skas/Makefile b/arch/um/kernel/skas/Makefile > index 6f86d53e3d69..fbb61968055f 100644 > --- a/arch/um/kernel/skas/Makefile > +++ b/arch/um/kernel/skas/Makefile > @@ -3,14 +3,43 @@ > # Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) > # > > -obj-y := stub.o mmu.o process.o syscall.o uaccess.o > +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 $@ \ > + $(KBUILD_CFLAGS) $(STUB_EXE_LDFLAGS) \ > + $(filter %.o,$^) > + > +STUB_EXE_LDFLAGS = -n -static
After this change in -next as commit 32e8eaf263d9 ("um: use execveat to create userspace MMs"), I am seeing an error when building ARCH=um defconfig with clang. $ make -skj"$(nproc)" ARCH=um LLVM=1 mrproper defconfig linux clang: error: unknown argument: '-n' make[7]: *** [arch/um/kernel/skas/Makefile:19: arch/um/kernel/skas/stub_exe.dbg] Error 1 ... I have looked through the GCC manual and options index but I do not see what '-n' is. Was this intended to be passed to the linker like -Wl,-n or was there some other option that this should be? If I try dropping it, I end up running into another issue, which could be entirely unrelated. $ make -skj"$(nproc)" ARCH=um LLVM=1 mrproper defconfig arch/um/kernel/skas/ /usr/bin/ld: arch/um/kernel/skas/stub_exe.o: in function `_start': arch/um/kernel/skas/stub_exe.c:83:(.ltext+0x15): undefined reference to `memset' clang: error: linker command failed with exit code 1 (use -v to see invocation) make[7]: *** [arch/um/kernel/skas/Makefile:19: arch/um/kernel/skas/stub_exe.dbg] Error 1 Cheers, Nathan > +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) > -UNPROFILE_OBJS := stub.o > +CFLAGS_stub_exe.o := $(CFLAGS_NO_HARDENING) > +UNPROFILE_OBJS := stub.o stub_exe.o > KCOV_INSTRUMENT := n > > include $(srctree)/arch/um/scripts/Makefile.rules