.. | .. |
---|
4 | 4 | |
---|
5 | 5 | purgatory-y := head.o purgatory.o string.o sha256.o mem.o |
---|
6 | 6 | |
---|
7 | | -targets += $(purgatory-y) purgatory.ro kexec-purgatory.c |
---|
| 7 | +targets += $(purgatory-y) purgatory.lds purgatory purgatory.chk purgatory.ro |
---|
8 | 8 | PURGATORY_OBJS = $(addprefix $(obj)/,$(purgatory-y)) |
---|
9 | 9 | |
---|
10 | | -$(obj)/sha256.o: $(srctree)/lib/sha256.c FORCE |
---|
| 10 | +$(obj)/sha256.o: $(srctree)/lib/crypto/sha256.c FORCE |
---|
11 | 11 | $(call if_changed_rule,cc_o_c) |
---|
| 12 | + |
---|
| 13 | +CFLAGS_sha256.o := -D__DISABLE_EXPORTS |
---|
12 | 14 | |
---|
13 | 15 | $(obj)/mem.o: $(srctree)/arch/s390/lib/mem.S FORCE |
---|
14 | 16 | $(call if_changed_rule,as_o_S) |
---|
.. | .. |
---|
18 | 20 | UBSAN_SANITIZE := n |
---|
19 | 21 | KASAN_SANITIZE := n |
---|
20 | 22 | |
---|
21 | | -LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostdlib |
---|
22 | | -LDFLAGS_purgatory.ro += -z nodefaultlib |
---|
23 | 23 | KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes |
---|
24 | 24 | KBUILD_CFLAGS += -Wno-pointer-sign -Wno-sign-compare |
---|
25 | 25 | KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding |
---|
26 | 26 | KBUILD_CFLAGS += -c -MD -Os -m64 -msoft-float -fno-common |
---|
| 27 | +KBUILD_CFLAGS += -fno-stack-protector |
---|
| 28 | +KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING |
---|
| 29 | +KBUILD_CFLAGS += $(CLANG_FLAGS) |
---|
27 | 30 | KBUILD_CFLAGS += $(call cc-option,-fno-PIE) |
---|
28 | 31 | KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS)) |
---|
29 | 32 | |
---|
30 | | -$(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE |
---|
| 33 | +# Since we link purgatory with -r unresolved symbols are not checked, so we |
---|
| 34 | +# also link a purgatory.chk binary without -r to check for unresolved symbols. |
---|
| 35 | +PURGATORY_LDFLAGS := -nostdlib -z nodefaultlib |
---|
| 36 | +LDFLAGS_purgatory := -r $(PURGATORY_LDFLAGS) -T |
---|
| 37 | +LDFLAGS_purgatory.chk := -e purgatory_start $(PURGATORY_LDFLAGS) |
---|
| 38 | +$(obj)/purgatory: $(obj)/purgatory.lds $(PURGATORY_OBJS) FORCE |
---|
31 | 39 | $(call if_changed,ld) |
---|
32 | 40 | |
---|
33 | | -quiet_cmd_bin2c = BIN2C $@ |
---|
34 | | - cmd_bin2c = $(objtree)/scripts/bin2c kexec_purgatory < $< > $@ |
---|
| 41 | +$(obj)/purgatory.chk: $(obj)/purgatory FORCE |
---|
| 42 | + $(call if_changed,ld) |
---|
35 | 43 | |
---|
36 | | -$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE |
---|
37 | | - $(call if_changed,bin2c) |
---|
| 44 | +OBJCOPYFLAGS_purgatory.ro := -O elf64-s390 |
---|
| 45 | +OBJCOPYFLAGS_purgatory.ro += --remove-section='*debug*' |
---|
| 46 | +OBJCOPYFLAGS_purgatory.ro += --remove-section='.comment' |
---|
| 47 | +OBJCOPYFLAGS_purgatory.ro += --remove-section='.note.*' |
---|
| 48 | +$(obj)/purgatory.ro: $(obj)/purgatory $(obj)/purgatory.chk FORCE |
---|
| 49 | + $(call if_changed,objcopy) |
---|
| 50 | + |
---|
| 51 | +$(obj)/kexec-purgatory.o: $(obj)/kexec-purgatory.S $(obj)/purgatory.ro FORCE |
---|
| 52 | + $(call if_changed_rule,as_o_S) |
---|
38 | 53 | |
---|
39 | 54 | obj-$(CONFIG_ARCH_HAS_KEXEC_PURGATORY) += kexec-purgatory.o |
---|