1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0 2c0dd6716SJosh PoimboeufOBJECT_FILES_NON_STANDARD := y 3c0dd6716SJosh Poimboeuf 48fc5b4d4SVivek Goyalpurgatory-y := purgatory.o stack.o setup-x86_$(BITS).o sha256.o entry64.o string.o 58fc5b4d4SVivek Goyal 68fc5b4d4SVivek Goyaltargets += $(purgatory-y) 78fc5b4d4SVivek GoyalPURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y)) 88fc5b4d4SVivek Goyal 9*fa8cbda8SPhilipp Rudo$(obj)/sha256.o: $(srctree)/lib/sha256.c FORCE 10df6f2801SPhilipp Rudo $(call if_changed_rule,cc_o_c) 11df6f2801SPhilipp Rudo 128fc5b4d4SVivek GoyalLDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostdlib -z nodefaultlib 138fc5b4d4SVivek Goyaltargets += purgatory.ro 148fc5b4d4SVivek Goyal 1513a6798eSMike GalbraithKASAN_SANITIZE := n 16543c37cbSEmese RevfyKCOV_INSTRUMENT := n 17543c37cbSEmese Revfy 188fc5b4d4SVivek Goyal# Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That 198fc5b4d4SVivek Goyal# in turn leaves some undefined symbols like __fentry__ in purgatory and not 208fc5b4d4SVivek Goyal# sure how to relocate those. Like kexec-tools, use custom flags. 218fc5b4d4SVivek Goyal 22e847f6aaSSven WegenerKBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -Os -mcmodel=large 234df4185aSVivek GoyalKBUILD_CFLAGS += -m$(BITS) 2490944e40SSebastian Andrzej SiewiorKBUILD_CFLAGS += $(call cc-option,-fno-PIE) 258fc5b4d4SVivek Goyal 268fc5b4d4SVivek Goyal$(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE 278fc5b4d4SVivek Goyal $(call if_changed,ld) 288fc5b4d4SVivek Goyal 298fc5b4d4SVivek Goyaltargets += kexec-purgatory.c 308fc5b4d4SVivek Goyal 31887f4f86SBaoquan HeCMD_BIN2C = $(objtree)/scripts/basic/bin2c 328fc5b4d4SVivek Goyalquiet_cmd_bin2c = BIN2C $@ 33887f4f86SBaoquan He cmd_bin2c = $(CMD_BIN2C) kexec_purgatory < $< > $@ 348fc5b4d4SVivek Goyal 358fc5b4d4SVivek Goyal$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE 368fc5b4d4SVivek Goyal $(call if_changed,bin2c) 378fc5b4d4SVivek Goyal 3874ca317cSVivek Goyalobj-$(CONFIG_KEXEC_FILE) += kexec-purgatory.o 39