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 19945302dfSJesse TaubeCFLAGS_fdt_early.o += -D__NO_FORTIFY 20*afedc312SAlexandre Ghiti# lib/string.c already defines __NO_FORTIFY 21*afedc312SAlexandre GhitiCFLAGS_ctype.o += -D__NO_FORTIFY 22*afedc312SAlexandre GhitiCFLAGS_lib-fdt.o += -D__NO_FORTIFY 23*afedc312SAlexandre GhitiCFLAGS_lib-fdt_ro.o += -D__NO_FORTIFY 24*afedc312SAlexandre GhitiCFLAGS_archrandom_early.o += -D__NO_FORTIFY 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 41945302dfSJesse Taubeobj-y := cmdline_early.pi.o fdt_early.pi.o string.pi.o ctype.pi.o lib-fdt.pi.o lib-fdt_ro.pi.o archrandom_early.pi.o 4226e7aacbSAlexandre Ghitiextra-y := $(patsubst %.pi.o,%.o,$(obj-y)) 43