2017-08-28 06:32:36 -07:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
|
|
|
|
purgatory-y := head.o purgatory.o string.o sha256.o mem.o
|
|
|
|
|
2019-12-12 13:53:04 -07:00
|
|
|
targets += $(purgatory-y) purgatory.lds purgatory purgatory.chk purgatory.ro
|
2017-08-28 06:32:36 -07:00
|
|
|
PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y))
|
|
|
|
|
2019-08-17 07:24:31 -07:00
|
|
|
$(obj)/sha256.o: $(srctree)/lib/crypto/sha256.c FORCE
|
2017-08-28 06:32:36 -07:00
|
|
|
$(call if_changed_rule,cc_o_c)
|
|
|
|
|
2023-05-30 17:34:15 -07:00
|
|
|
CFLAGS_sha256.o := -D__DISABLE_EXPORTS -D__NO_FORTIFY
|
2019-08-17 07:24:33 -07:00
|
|
|
|
2018-06-26 09:24:52 -07:00
|
|
|
$(obj)/mem.o: $(srctree)/arch/s390/lib/mem.S FORCE
|
2017-08-28 06:32:36 -07:00
|
|
|
$(call if_changed_rule,as_o_S)
|
|
|
|
|
|
|
|
KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes
|
|
|
|
KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare
|
|
|
|
KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding
|
2023-01-11 20:05:08 -07:00
|
|
|
KBUILD_CFLAGS += -Os -m64 -msoft-float -fno-common
|
2021-05-09 22:31:33 -07:00
|
|
|
KBUILD_CFLAGS += -fno-stack-protector
|
2023-05-25 10:41:45 -07:00
|
|
|
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
|
2019-04-15 01:35:52 -07:00
|
|
|
KBUILD_CFLAGS += $(CLANG_FLAGS)
|
2017-08-28 06:32:36 -07:00
|
|
|
KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
|
2018-06-26 03:24:30 -07:00
|
|
|
KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS))
|
2017-08-28 06:32:36 -07:00
|
|
|
|
2019-12-12 13:53:04 -07:00
|
|
|
# Since we link purgatory with -r unresolved symbols are not checked, so we
|
|
|
|
# also link a purgatory.chk binary without -r to check for unresolved symbols.
|
|
|
|
PURGATORY_LDFLAGS := -nostdlib -z nodefaultlib
|
|
|
|
LDFLAGS_purgatory := -r $(PURGATORY_LDFLAGS) -T
|
|
|
|
LDFLAGS_purgatory.chk := -e purgatory_start $(PURGATORY_LDFLAGS)
|
2019-03-05 09:18:13 -07:00
|
|
|
$(obj)/purgatory: $(obj)/purgatory.lds $(PURGATORY_OBJS) FORCE
|
2017-08-28 06:32:36 -07:00
|
|
|
$(call if_changed,ld)
|
|
|
|
|
2019-12-12 13:53:04 -07:00
|
|
|
$(obj)/purgatory.chk: $(obj)/purgatory FORCE
|
|
|
|
$(call if_changed,ld)
|
|
|
|
|
2019-03-05 09:18:13 -07:00
|
|
|
OBJCOPYFLAGS_purgatory.ro := -O elf64-s390
|
|
|
|
OBJCOPYFLAGS_purgatory.ro += --remove-section='*debug*'
|
|
|
|
OBJCOPYFLAGS_purgatory.ro += --remove-section='.comment'
|
|
|
|
OBJCOPYFLAGS_purgatory.ro += --remove-section='.note.*'
|
2019-12-12 13:53:04 -07:00
|
|
|
$(obj)/purgatory.ro: $(obj)/purgatory $(obj)/purgatory.chk FORCE
|
2019-03-05 09:18:13 -07:00
|
|
|
$(call if_changed,objcopy)
|
|
|
|
|
2022-06-13 10:09:02 -07:00
|
|
|
$(obj)/kexec-purgatory.o: $(obj)/purgatory.ro
|
2017-08-28 06:32:36 -07:00
|
|
|
|
2022-06-13 10:09:01 -07:00
|
|
|
obj-y += kexec-purgatory.o
|