xref: /linux/arch/x86/purgatory/Makefile (revision b24413180f5600bcb3bb70fbed5cf186b60864bd)
1*b2441318SGreg 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
98fc5b4d4SVivek GoyalLDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostdlib -z nodefaultlib
108fc5b4d4SVivek Goyaltargets += purgatory.ro
118fc5b4d4SVivek Goyal
1213a6798eSMike GalbraithKASAN_SANITIZE	:= n
13543c37cbSEmese RevfyKCOV_INSTRUMENT := n
14543c37cbSEmese Revfy
158fc5b4d4SVivek Goyal# Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That
168fc5b4d4SVivek Goyal# in turn leaves some undefined symbols like __fentry__ in purgatory and not
178fc5b4d4SVivek Goyal# sure how to relocate those. Like kexec-tools, use custom flags.
188fc5b4d4SVivek Goyal
198fc5b4d4SVivek GoyalKBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -MD -Os -mcmodel=large
204df4185aSVivek GoyalKBUILD_CFLAGS += -m$(BITS)
2190944e40SSebastian Andrzej SiewiorKBUILD_CFLAGS += $(call cc-option,-fno-PIE)
228fc5b4d4SVivek Goyal
238fc5b4d4SVivek Goyal$(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
248fc5b4d4SVivek Goyal		$(call if_changed,ld)
258fc5b4d4SVivek Goyal
268fc5b4d4SVivek Goyaltargets += kexec-purgatory.c
278fc5b4d4SVivek Goyal
28887f4f86SBaoquan HeCMD_BIN2C = $(objtree)/scripts/basic/bin2c
298fc5b4d4SVivek Goyalquiet_cmd_bin2c = BIN2C   $@
30887f4f86SBaoquan He      cmd_bin2c = $(CMD_BIN2C) kexec_purgatory < $< > $@
318fc5b4d4SVivek Goyal
328fc5b4d4SVivek Goyal$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE
338fc5b4d4SVivek Goyal	$(call if_changed,bin2c)
348fc5b4d4SVivek Goyal
3574ca317cSVivek Goyalobj-$(CONFIG_KEXEC_FILE)	+= kexec-purgatory.o
36