1c0dd6716SJosh PoimboeufOBJECT_FILES_NON_STANDARD := y 2c0dd6716SJosh Poimboeuf 38fc5b4d4SVivek Goyalpurgatory-y := purgatory.o stack.o setup-x86_$(BITS).o sha256.o entry64.o string.o 48fc5b4d4SVivek Goyal 58fc5b4d4SVivek Goyaltargets += $(purgatory-y) 68fc5b4d4SVivek GoyalPURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y)) 78fc5b4d4SVivek Goyal 88fc5b4d4SVivek GoyalLDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostdlib -z nodefaultlib 98fc5b4d4SVivek Goyaltargets += purgatory.ro 108fc5b4d4SVivek Goyal 11*13a6798eSMike GalbraithKASAN_SANITIZE := n 12543c37cbSEmese RevfyKCOV_INSTRUMENT := n 13543c37cbSEmese Revfy 148fc5b4d4SVivek Goyal# Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That 158fc5b4d4SVivek Goyal# in turn leaves some undefined symbols like __fentry__ in purgatory and not 168fc5b4d4SVivek Goyal# sure how to relocate those. Like kexec-tools, use custom flags. 178fc5b4d4SVivek Goyal 188fc5b4d4SVivek GoyalKBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -MD -Os -mcmodel=large 194df4185aSVivek GoyalKBUILD_CFLAGS += -m$(BITS) 2090944e40SSebastian Andrzej SiewiorKBUILD_CFLAGS += $(call cc-option,-fno-PIE) 218fc5b4d4SVivek Goyal 228fc5b4d4SVivek Goyal$(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE 238fc5b4d4SVivek Goyal $(call if_changed,ld) 248fc5b4d4SVivek Goyal 258fc5b4d4SVivek Goyaltargets += kexec-purgatory.c 268fc5b4d4SVivek Goyal 27887f4f86SBaoquan HeCMD_BIN2C = $(objtree)/scripts/basic/bin2c 288fc5b4d4SVivek Goyalquiet_cmd_bin2c = BIN2C $@ 29887f4f86SBaoquan He cmd_bin2c = $(CMD_BIN2C) kexec_purgatory < $< > $@ 308fc5b4d4SVivek Goyal 318fc5b4d4SVivek Goyal$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE 328fc5b4d4SVivek Goyal $(call if_changed,bin2c) 338fc5b4d4SVivek Goyal 3474ca317cSVivek Goyalobj-$(CONFIG_KEXEC_FILE) += kexec-purgatory.o 35