| 1 |
# SPDX-License-Identifier: GPL-2.0 |
| 2 |
# |
| 3 |
# Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
| 4 |
# |
| 5 |
|
| 6 |
obj-y := stub.o mmu.o process.o syscall.o uaccess.o \ |
| 7 |
stub_exe_embed.o |
| 8 |
|
| 9 |
# Stub executable |
| 10 |
|
| 11 |
stub_exe_objs-y := stub_exe.o |
| 12 |
|
| 13 |
stub_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 |
|
| 25 |
quiet_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 |
|
| 30 |
STUB_EXE_LDFLAGS = -Wl,-n -static |
| 31 |
|
| 32 |
targets += 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 |
|
| 40 |
CFLAGS_stub.o := $(CFLAGS_NO_HARDENING) |
| 41 |
CFLAGS_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. |
| 45 |
CFLAGS_stub_exe.o += $(call cc-option, -ftrivial-auto-var-init=uninitialized) |
| 46 |
|
| 47 |
UNPROFILE_OBJS := stub.o stub_exe.o |
| 48 |
KCOV_INSTRUMENT := n |
| 49 |
|
| 50 |
include $(srctree)/arch/um/scripts/Makefile.rules |