126e7aacbSAlexandre Ghiti# SPDX-License-Identifier: GPL-2.0 226e7aacbSAlexandre Ghiti# This file was copied from arm64/kernel/pi/Makefile. 326e7aacbSAlexandre Ghiti 426e7aacbSAlexandre GhitiKBUILD_CFLAGS := $(subst $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) -fpie \ 526e7aacbSAlexandre Ghiti -Os -DDISABLE_BRANCH_PROFILING $(DISABLE_STACKLEAK_PLUGIN) \ 626e7aacbSAlexandre Ghiti $(call cc-option,-mbranch-protection=none) \ 726e7aacbSAlexandre Ghiti -I$(srctree)/scripts/dtc/libfdt -fno-stack-protector \ 826e7aacbSAlexandre Ghiti -D__DISABLE_EXPORTS -ffreestanding \ 926e7aacbSAlexandre Ghiti -fno-asynchronous-unwind-tables -fno-unwind-tables \ 1026e7aacbSAlexandre Ghiti $(call cc-option,-fno-addrsig) 1126e7aacbSAlexandre Ghiti 12*021d2342SWende Tan# Disable LTO 13*021d2342SWende TanKBUILD_CFLAGS := $(filter-out $(CC_FLAGS_LTO), $(KBUILD_CFLAGS)) 14*021d2342SWende Tan 1526e7aacbSAlexandre GhitiKBUILD_CFLAGS += -mcmodel=medany 1626e7aacbSAlexandre Ghiti 1726e7aacbSAlexandre GhitiCFLAGS_cmdline_early.o += -D__NO_FORTIFY 1826e7aacbSAlexandre GhitiCFLAGS_lib-fdt_ro.o += -D__NO_FORTIFY 1926e7aacbSAlexandre Ghiti 2026e7aacbSAlexandre GhitiGCOV_PROFILE := n 2126e7aacbSAlexandre GhitiKASAN_SANITIZE := n 2226e7aacbSAlexandre GhitiKCSAN_SANITIZE := n 2326e7aacbSAlexandre GhitiUBSAN_SANITIZE := n 2426e7aacbSAlexandre GhitiKCOV_INSTRUMENT := n 2526e7aacbSAlexandre Ghiti 2626e7aacbSAlexandre Ghiti$(obj)/%.pi.o: OBJCOPYFLAGS := --prefix-symbols=__pi_ \ 2726e7aacbSAlexandre Ghiti --remove-section=.note.gnu.property \ 283b90b09aSAlexandre Ghiti --prefix-alloc-sections=.init.pi 2926e7aacbSAlexandre Ghiti$(obj)/%.pi.o: $(obj)/%.o FORCE 3026e7aacbSAlexandre Ghiti $(call if_changed,objcopy) 3126e7aacbSAlexandre Ghiti 3226e7aacbSAlexandre Ghiti$(obj)/lib-%.o: $(srctree)/lib/%.c FORCE 3326e7aacbSAlexandre Ghiti $(call if_changed_rule,cc_o_c) 3426e7aacbSAlexandre Ghiti 3526e7aacbSAlexandre Ghiti$(obj)/string.o: $(srctree)/lib/string.c FORCE 3626e7aacbSAlexandre Ghiti $(call if_changed_rule,cc_o_c) 3726e7aacbSAlexandre Ghiti 3826e7aacbSAlexandre Ghiti$(obj)/ctype.o: $(srctree)/lib/ctype.c FORCE 3926e7aacbSAlexandre Ghiti $(call if_changed_rule,cc_o_c) 4026e7aacbSAlexandre Ghiti 4184fe419dSAlexandre Ghitiobj-y := cmdline_early.pi.o fdt_early.pi.o string.pi.o ctype.pi.o lib-fdt.pi.o lib-fdt_ro.pi.o 4226e7aacbSAlexandre Ghitiextra-y := $(patsubst %.pi.o,%.o,$(obj-y)) 43