0001
0002 OBJECT_FILES_NON_STANDARD := y
0003
0004 purgatory-y := purgatory.o stack.o setup-x86_$(BITS).o sha256.o entry64.o string.o
0005
0006 targets += $(purgatory-y)
0007 PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y))
0008
0009 $(obj)/string.o: $(srctree)/arch/x86/boot/compressed/string.c FORCE
0010 $(call if_changed_rule,cc_o_c)
0011
0012 $(obj)/sha256.o: $(srctree)/lib/crypto/sha256.c FORCE
0013 $(call if_changed_rule,cc_o_c)
0014
0015 CFLAGS_sha256.o := -D__DISABLE_EXPORTS
0016
0017
0018
0019 PURGATORY_LDFLAGS := -e purgatory_start -z nodefaultlib
0020 LDFLAGS_purgatory.ro := -r $(PURGATORY_LDFLAGS)
0021 LDFLAGS_purgatory.chk := $(PURGATORY_LDFLAGS)
0022 targets += purgatory.ro purgatory.chk
0023
0024
0025 GCOV_PROFILE := n
0026 KASAN_SANITIZE := n
0027 UBSAN_SANITIZE := n
0028 KCSAN_SANITIZE := n
0029 KCOV_INSTRUMENT := n
0030
0031
0032
0033
0034 PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel
0035 PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss -g0
0036 PURGATORY_CFLAGS += $(DISABLE_STACKLEAK_PLUGIN) -DDISABLE_BRANCH_PROFILING
0037 PURGATORY_CFLAGS += -fno-stack-protector
0038
0039
0040
0041
0042 ifdef CONFIG_FUNCTION_TRACER
0043 PURGATORY_CFLAGS_REMOVE += $(CC_FLAGS_FTRACE)
0044 endif
0045
0046 ifdef CONFIG_STACKPROTECTOR
0047 PURGATORY_CFLAGS_REMOVE += -fstack-protector
0048 endif
0049
0050 ifdef CONFIG_STACKPROTECTOR_STRONG
0051 PURGATORY_CFLAGS_REMOVE += -fstack-protector-strong
0052 endif
0053
0054 ifdef CONFIG_RETPOLINE
0055 PURGATORY_CFLAGS_REMOVE += $(RETPOLINE_CFLAGS)
0056 endif
0057
0058 CFLAGS_REMOVE_purgatory.o += $(PURGATORY_CFLAGS_REMOVE)
0059 CFLAGS_purgatory.o += $(PURGATORY_CFLAGS)
0060
0061 CFLAGS_REMOVE_sha256.o += $(PURGATORY_CFLAGS_REMOVE)
0062 CFLAGS_sha256.o += $(PURGATORY_CFLAGS)
0063
0064 CFLAGS_REMOVE_string.o += $(PURGATORY_CFLAGS_REMOVE)
0065 CFLAGS_string.o += $(PURGATORY_CFLAGS)
0066
0067 AFLAGS_REMOVE_setup-x86_$(BITS).o += -Wa,-gdwarf-2
0068 AFLAGS_REMOVE_entry64.o += -Wa,-gdwarf-2
0069
0070 $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE
0071 $(call if_changed,ld)
0072
0073 $(obj)/purgatory.chk: $(obj)/purgatory.ro FORCE
0074 $(call if_changed,ld)
0075
0076 $(obj)/kexec-purgatory.o: $(obj)/purgatory.ro $(obj)/purgatory.chk
0077
0078 obj-y += kexec-purgatory.o