| .. | .. |
|---|
| 9 | 9 | $(obj)/string.o: $(srctree)/arch/x86/boot/compressed/string.c FORCE |
|---|
| 10 | 10 | $(call if_changed_rule,cc_o_c) |
|---|
| 11 | 11 | |
|---|
| 12 | | -$(obj)/sha256.o: $(srctree)/lib/sha256.c FORCE |
|---|
| 12 | +$(obj)/sha256.o: $(srctree)/lib/crypto/sha256.c FORCE |
|---|
| 13 | 13 | $(call if_changed_rule,cc_o_c) |
|---|
| 14 | 14 | |
|---|
| 15 | | -LDFLAGS_purgatory.ro := -e purgatory_start -r --no-undefined -nostdlib -z nodefaultlib |
|---|
| 16 | | -targets += purgatory.ro |
|---|
| 15 | +CFLAGS_sha256.o := -D__DISABLE_EXPORTS |
|---|
| 16 | + |
|---|
| 17 | +# When linking purgatory.ro with -r unresolved symbols are not checked, |
|---|
| 18 | +# also link a purgatory.chk binary without -r to check for unresolved symbols. |
|---|
| 19 | +PURGATORY_LDFLAGS := -e purgatory_start -nostdlib -z nodefaultlib |
|---|
| 20 | +LDFLAGS_purgatory.ro := -r $(PURGATORY_LDFLAGS) |
|---|
| 21 | +LDFLAGS_purgatory.chk := $(PURGATORY_LDFLAGS) |
|---|
| 22 | +targets += purgatory.ro purgatory.chk |
|---|
| 17 | 23 | |
|---|
| 18 | 24 | # Sanitizer, etc. runtimes are unavailable and cannot be linked here. |
|---|
| 19 | 25 | GCOV_PROFILE := n |
|---|
| 20 | 26 | KASAN_SANITIZE := n |
|---|
| 21 | 27 | UBSAN_SANITIZE := n |
|---|
| 28 | +KCSAN_SANITIZE := n |
|---|
| 22 | 29 | KCOV_INSTRUMENT := n |
|---|
| 23 | 30 | |
|---|
| 24 | 31 | # These are adjustments to the compiler flags used for objects that |
|---|
| 25 | 32 | # make up the standalone purgatory.ro |
|---|
| 26 | 33 | |
|---|
| 27 | | -PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel |
|---|
| 28 | | -PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss |
|---|
| 34 | +PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel $(CC_FLAGS_CFI) |
|---|
| 35 | +PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss -g0 |
|---|
| 29 | 36 | PURGATORY_CFLAGS += $(DISABLE_STACKLEAK_PLUGIN) -DDISABLE_BRANCH_PROFILING |
|---|
| 37 | +PURGATORY_CFLAGS += -fno-stack-protector |
|---|
| 30 | 38 | |
|---|
| 31 | 39 | # Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That |
|---|
| 32 | 40 | # in turn leaves some undefined symbols like __fentry__ in purgatory and not |
|---|
| .. | .. |
|---|
| 56 | 64 | CFLAGS_REMOVE_string.o += $(PURGATORY_CFLAGS_REMOVE) |
|---|
| 57 | 65 | CFLAGS_string.o += $(PURGATORY_CFLAGS) |
|---|
| 58 | 66 | |
|---|
| 67 | +AFLAGS_REMOVE_setup-x86_$(BITS).o += -Wa,-gdwarf-2 |
|---|
| 68 | +AFLAGS_REMOVE_entry64.o += -Wa,-gdwarf-2 |
|---|
| 69 | + |
|---|
| 59 | 70 | $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE |
|---|
| 71 | + $(call if_changed,ld) |
|---|
| 72 | + |
|---|
| 73 | +$(obj)/purgatory.chk: $(obj)/purgatory.ro FORCE |
|---|
| 60 | 74 | $(call if_changed,ld) |
|---|
| 61 | 75 | |
|---|
| 62 | 76 | targets += kexec-purgatory.c |
|---|
| .. | .. |
|---|
| 64 | 78 | quiet_cmd_bin2c = BIN2C $@ |
|---|
| 65 | 79 | cmd_bin2c = $(objtree)/scripts/bin2c kexec_purgatory < $< > $@ |
|---|
| 66 | 80 | |
|---|
| 67 | | -$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE |
|---|
| 81 | +$(obj)/kexec-purgatory.c: $(obj)/purgatory.ro $(obj)/purgatory.chk FORCE |
|---|
| 68 | 82 | $(call if_changed,bin2c) |
|---|
| 69 | 83 | |
|---|
| 70 | 84 | obj-$(CONFIG_KEXEC_FILE) += kexec-purgatory.o |
|---|