xref: /linux/arch/um/kernel/skas/Makefile (revision 7f71507851fc7764b36a3221839607d3a45c2025)
1# SPDX-License-Identifier: GPL-2.0
2#
3# Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4#
5
6obj-y := stub.o mmu.o process.o syscall.o uaccess.o \
7	 stub_exe_embed.o
8
9# Stub executable
10
11stub_exe_objs-y := stub_exe.o
12
13stub_exe_objs := $(foreach F,$(stub_exe_objs-y),$(obj)/$F)
14
15# Object file containing the ELF executable
16$(obj)/stub_exe_embed.o: $(src)/stub_exe_embed.S $(obj)/stub_exe
17
18$(obj)/stub_exe.dbg: $(stub_exe_objs) FORCE
19	$(call if_changed,stub_exe)
20
21$(obj)/stub_exe: OBJCOPYFLAGS := -S
22$(obj)/stub_exe: $(obj)/stub_exe.dbg FORCE
23	$(call if_changed,objcopy)
24
25quiet_cmd_stub_exe = STUB_EXE $@
26      cmd_stub_exe = $(CC) -nostdlib -o $@ \
27			   $(filter-out $(UM_GPROF_OPT) $(UM_GCOV_OPT),$(KBUILD_CFLAGS)) $(STUB_EXE_LDFLAGS) \
28			   $(filter %.o,$^)
29
30STUB_EXE_LDFLAGS = -Wl,-n -static
31
32targets += stub_exe.dbg stub_exe $(stub_exe_objs-y)
33
34# end
35
36# stub.o is in the stub, so it can't be built with profiling
37# GCC hardened also auto-enables -fpic, but we need %ebx so it can't work ->
38# disable it
39
40CFLAGS_stub.o := $(CFLAGS_NO_HARDENING)
41CFLAGS_stub_exe.o := $(CFLAGS_NO_HARDENING)
42
43# Clang will call memset() from __builtin_alloca() when stack variable
44# initialization is enabled, which is used in stub_exe.c.
45CFLAGS_stub_exe.o += $(call cc-option, -ftrivial-auto-var-init=uninitialized)
46
47UNPROFILE_OBJS := stub.o stub_exe.o
48KCOV_INSTRUMENT := n
49
50include $(srctree)/arch/um/scripts/Makefile.rules
51