xref: /linux/arch/riscv/kernel/pi/Makefile (revision 3b90b09af5be42491a8a74a549318cfa265b3029)
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
1226e7aacbSAlexandre GhitiKBUILD_CFLAGS	+= -mcmodel=medany
1326e7aacbSAlexandre Ghiti
1426e7aacbSAlexandre GhitiCFLAGS_cmdline_early.o += -D__NO_FORTIFY
1526e7aacbSAlexandre GhitiCFLAGS_lib-fdt_ro.o += -D__NO_FORTIFY
1626e7aacbSAlexandre Ghiti
1726e7aacbSAlexandre GhitiGCOV_PROFILE	:= n
1826e7aacbSAlexandre GhitiKASAN_SANITIZE	:= n
1926e7aacbSAlexandre GhitiKCSAN_SANITIZE	:= n
2026e7aacbSAlexandre GhitiUBSAN_SANITIZE	:= n
2126e7aacbSAlexandre GhitiKCOV_INSTRUMENT	:= n
2226e7aacbSAlexandre Ghiti
2326e7aacbSAlexandre Ghiti$(obj)/%.pi.o: OBJCOPYFLAGS := --prefix-symbols=__pi_ \
2426e7aacbSAlexandre Ghiti			       --remove-section=.note.gnu.property \
25*3b90b09aSAlexandre Ghiti			       --prefix-alloc-sections=.init.pi
2626e7aacbSAlexandre Ghiti$(obj)/%.pi.o: $(obj)/%.o FORCE
2726e7aacbSAlexandre Ghiti	$(call if_changed,objcopy)
2826e7aacbSAlexandre Ghiti
2926e7aacbSAlexandre Ghiti$(obj)/lib-%.o: $(srctree)/lib/%.c FORCE
3026e7aacbSAlexandre Ghiti	$(call if_changed_rule,cc_o_c)
3126e7aacbSAlexandre Ghiti
3226e7aacbSAlexandre Ghiti$(obj)/string.o: $(srctree)/lib/string.c FORCE
3326e7aacbSAlexandre Ghiti	$(call if_changed_rule,cc_o_c)
3426e7aacbSAlexandre Ghiti
3526e7aacbSAlexandre Ghiti$(obj)/ctype.o: $(srctree)/lib/ctype.c FORCE
3626e7aacbSAlexandre Ghiti	$(call if_changed_rule,cc_o_c)
3726e7aacbSAlexandre Ghiti
3826e7aacbSAlexandre Ghitiobj-y		:= cmdline_early.pi.o string.pi.o ctype.pi.o lib-fdt.pi.o lib-fdt_ro.pi.o
3926e7aacbSAlexandre Ghitiextra-y		:= $(patsubst %.pi.o,%.o,$(obj-y))
40