1 # SPDX-License-Identifier: GPL-2.0
3 OBJECT_FILES_NON_STANDARD := y
5 purgatory-y := head.o purgatory.o string.o sha256.o mem.o
7 targets += $(purgatory-y) purgatory.lds purgatory purgatory.ro
8 PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y))
10 $(obj)/sha256.o: $(srctree)/lib/crypto/sha256.c FORCE
11 $(call if_changed_rule,cc_o_c)
13 CFLAGS_sha256.o := -D__DISABLE_EXPORTS
15 $(obj)/mem.o: $(srctree)/arch/s390/lib/mem.S FORCE
16 $(call if_changed_rule,as_o_S)
18 $(obj)/string.o: $(srctree)/arch/s390/lib/string.c FORCE
19 $(call if_changed_rule,cc_o_c)
21 KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes
22 KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare
23 KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding
24 KBUILD_CFLAGS += -c -MD -Os -m64 -msoft-float -fno-common
25 KBUILD_CFLAGS += $(CLANG_FLAGS)
26 KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
27 KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS))
29 LDFLAGS_purgatory := -r --no-undefined -nostdlib -z nodefaultlib -T
30 $(obj)/purgatory: $(obj)/purgatory.lds $(PURGATORY_OBJS) FORCE
33 OBJCOPYFLAGS_purgatory.ro := -O elf64-s390
34 OBJCOPYFLAGS_purgatory.ro += --remove-section='*debug*'
35 OBJCOPYFLAGS_purgatory.ro += --remove-section='.comment'
36 OBJCOPYFLAGS_purgatory.ro += --remove-section='.note.*'
37 $(obj)/purgatory.ro: $(obj)/purgatory FORCE
38 $(call if_changed,objcopy)
40 $(obj)/kexec-purgatory.o: $(obj)/kexec-purgatory.S $(obj)/purgatory.ro FORCE
41 $(call if_changed_rule,as_o_S)
43 obj-$(CONFIG_ARCH_HAS_KEXEC_PURGATORY) += kexec-purgatory.o