10d1fb0a4SAlex Dewar# SPDX-License-Identifier: GPL-2.0 21da177e4SLinus Torvalds# 3ba180fd4SJeff Dike# Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) 41da177e4SLinus Torvalds# 51da177e4SLinus Torvalds 632e8eaf2SBenjamin Bergobj-y := stub.o mmu.o process.o syscall.o uaccess.o \ 732e8eaf2SBenjamin Berg stub_exe_embed.o 832e8eaf2SBenjamin Berg 932e8eaf2SBenjamin Berg# Stub executable 1032e8eaf2SBenjamin Berg 1132e8eaf2SBenjamin Bergstub_exe_objs-y := stub_exe.o 1232e8eaf2SBenjamin Berg 1332e8eaf2SBenjamin Bergstub_exe_objs := $(foreach F,$(stub_exe_objs-y),$(obj)/$F) 1432e8eaf2SBenjamin Berg 1532e8eaf2SBenjamin Berg# Object file containing the ELF executable 1632e8eaf2SBenjamin Berg$(obj)/stub_exe_embed.o: $(src)/stub_exe_embed.S $(obj)/stub_exe 1732e8eaf2SBenjamin Berg 1832e8eaf2SBenjamin Berg$(obj)/stub_exe.dbg: $(stub_exe_objs) FORCE 1932e8eaf2SBenjamin Berg $(call if_changed,stub_exe) 2032e8eaf2SBenjamin Berg 2132e8eaf2SBenjamin Berg$(obj)/stub_exe: OBJCOPYFLAGS := -S 2232e8eaf2SBenjamin Berg$(obj)/stub_exe: $(obj)/stub_exe.dbg FORCE 2332e8eaf2SBenjamin Berg $(call if_changed,objcopy) 2432e8eaf2SBenjamin Berg 2532e8eaf2SBenjamin Bergquiet_cmd_stub_exe = STUB_EXE $@ 2632e8eaf2SBenjamin Berg cmd_stub_exe = $(CC) -nostdlib -o $@ \ 27*d3b08e5fSJohannes Berg $(filter-out $(UM_GPROF_OPT) $(UM_GCOV_OPT),$(KBUILD_CFLAGS)) $(STUB_EXE_LDFLAGS) \ 2832e8eaf2SBenjamin Berg $(filter %.o,$^) 2932e8eaf2SBenjamin Berg 3089350defSNathan ChancellorSTUB_EXE_LDFLAGS = -Wl,-n -static 3132e8eaf2SBenjamin Berg 3232e8eaf2SBenjamin Bergtargets += stub_exe.dbg stub_exe $(stub_exe_objs-y) 3332e8eaf2SBenjamin Berg 3432e8eaf2SBenjamin Berg# end 351da177e4SLinus Torvalds 36a5d2cfe7SBenjamin Berg# stub.o is in the stub, so it can't be built with profiling 37275e6e1eSPaolo 'Blaisorblade' Giarrusso# GCC hardened also auto-enables -fpic, but we need %ebx so it can't work -> 38275e6e1eSPaolo 'Blaisorblade' Giarrusso# disable it 39275e6e1eSPaolo 'Blaisorblade' Giarrusso 4076ed9158SBenjamin BergCFLAGS_stub.o := $(CFLAGS_NO_HARDENING) 4132e8eaf2SBenjamin BergCFLAGS_stub_exe.o := $(CFLAGS_NO_HARDENING) 421e3071d6SNathan Chancellor 431e3071d6SNathan Chancellor# Clang will call memset() from __builtin_alloca() when stack variable 441e3071d6SNathan Chancellor# initialization is enabled, which is used in stub_exe.c. 451e3071d6SNathan ChancellorCFLAGS_stub_exe.o += $(call cc-option, -ftrivial-auto-var-init=uninitialized) 461e3071d6SNathan Chancellor 4732e8eaf2SBenjamin BergUNPROFILE_OBJS := stub.o stub_exe.o 48c4683cd5SMarek MajkowskiKCOV_INSTRUMENT := n 49c4683cd5SMarek Majkowski 5067d7c302SMasahiro Yamadainclude $(srctree)/arch/um/scripts/Makefile.rules 51