1*aacd149bSArd Biesheuvel# SPDX-License-Identifier: GPL-2.0 2*aacd149bSArd Biesheuvel# Copyright 2022 Google LLC 3*aacd149bSArd Biesheuvel 4*aacd149bSArd BiesheuvelKBUILD_CFLAGS := $(subst $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) -fpie \ 5*aacd149bSArd Biesheuvel -Os -DDISABLE_BRANCH_PROFILING $(DISABLE_STACKLEAK_PLUGIN) \ 6*aacd149bSArd Biesheuvel $(call cc-option,-mbranch-protection=none) \ 7*aacd149bSArd Biesheuvel -I$(srctree)/scripts/dtc/libfdt -fno-stack-protector \ 8*aacd149bSArd Biesheuvel -include $(srctree)/include/linux/hidden.h \ 9*aacd149bSArd Biesheuvel -D__DISABLE_EXPORTS -ffreestanding -D__NO_FORTIFY \ 10*aacd149bSArd Biesheuvel $(call cc-option,-fno-addrsig) 11*aacd149bSArd Biesheuvel 12*aacd149bSArd Biesheuvel# remove SCS flags from all objects in this directory 13*aacd149bSArd BiesheuvelKBUILD_CFLAGS := $(filter-out $(CC_FLAGS_SCS), $(KBUILD_CFLAGS)) 14*aacd149bSArd Biesheuvel# disable LTO 15*aacd149bSArd BiesheuvelKBUILD_CFLAGS := $(filter-out $(CC_FLAGS_LTO), $(KBUILD_CFLAGS)) 16*aacd149bSArd Biesheuvel 17*aacd149bSArd BiesheuvelGCOV_PROFILE := n 18*aacd149bSArd BiesheuvelKASAN_SANITIZE := n 19*aacd149bSArd BiesheuvelKCSAN_SANITIZE := n 20*aacd149bSArd BiesheuvelUBSAN_SANITIZE := n 21*aacd149bSArd BiesheuvelKCOV_INSTRUMENT := n 22*aacd149bSArd Biesheuvel 23*aacd149bSArd Biesheuvel$(obj)/%.pi.o: OBJCOPYFLAGS := --prefix-symbols=__pi_ \ 24*aacd149bSArd Biesheuvel --remove-section=.note.gnu.property \ 25*aacd149bSArd Biesheuvel --prefix-alloc-sections=.init 26*aacd149bSArd Biesheuvel$(obj)/%.pi.o: $(obj)/%.o FORCE 27*aacd149bSArd Biesheuvel $(call if_changed,objcopy) 28*aacd149bSArd Biesheuvel 29*aacd149bSArd Biesheuvel$(obj)/lib-%.o: $(srctree)/lib/%.c FORCE 30*aacd149bSArd Biesheuvel $(call if_changed_rule,cc_o_c) 31*aacd149bSArd Biesheuvel 32*aacd149bSArd Biesheuvelobj-y := kaslr_early.pi.o lib-fdt.pi.o lib-fdt_ro.pi.o 33*aacd149bSArd Biesheuvelextra-y := $(patsubst %.pi.o,%.o,$(obj-y)) 34