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 \ 814c3ec67SJesse Taube -include $(srctree)/include/linux/hidden.h \ 926e7aacbSAlexandre Ghiti -D__DISABLE_EXPORTS -ffreestanding \ 1026e7aacbSAlexandre Ghiti -fno-asynchronous-unwind-tables -fno-unwind-tables \ 1126e7aacbSAlexandre Ghiti $(call cc-option,-fno-addrsig) 1226e7aacbSAlexandre Ghiti 13021d2342SWende Tan# Disable LTO 14021d2342SWende TanKBUILD_CFLAGS := $(filter-out $(CC_FLAGS_LTO), $(KBUILD_CFLAGS)) 15021d2342SWende Tan 1626e7aacbSAlexandre GhitiKBUILD_CFLAGS += -mcmodel=medany 1726e7aacbSAlexandre Ghiti 1826e7aacbSAlexandre GhitiCFLAGS_cmdline_early.o += -D__NO_FORTIFY 1926e7aacbSAlexandre GhitiCFLAGS_lib-fdt_ro.o += -D__NO_FORTIFY 2026e7aacbSAlexandre Ghiti 2126e7aacbSAlexandre Ghiti$(obj)/%.pi.o: OBJCOPYFLAGS := --prefix-symbols=__pi_ \ 2226e7aacbSAlexandre Ghiti --remove-section=.note.gnu.property \ 233b90b09aSAlexandre Ghiti --prefix-alloc-sections=.init.pi 2426e7aacbSAlexandre Ghiti$(obj)/%.pi.o: $(obj)/%.o FORCE 2526e7aacbSAlexandre Ghiti $(call if_changed,objcopy) 2626e7aacbSAlexandre Ghiti 2726e7aacbSAlexandre Ghiti$(obj)/lib-%.o: $(srctree)/lib/%.c FORCE 2826e7aacbSAlexandre Ghiti $(call if_changed_rule,cc_o_c) 2926e7aacbSAlexandre Ghiti 3026e7aacbSAlexandre Ghiti$(obj)/string.o: $(srctree)/lib/string.c FORCE 3126e7aacbSAlexandre Ghiti $(call if_changed_rule,cc_o_c) 3226e7aacbSAlexandre Ghiti 3326e7aacbSAlexandre Ghiti$(obj)/ctype.o: $(srctree)/lib/ctype.c FORCE 3426e7aacbSAlexandre Ghiti $(call if_changed_rule,cc_o_c) 3526e7aacbSAlexandre Ghiti 3684fe419dSAlexandre 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 3726e7aacbSAlexandre Ghitiextra-y := $(patsubst %.pi.o,%.o,$(obj-y)) 38