1# SPDX-License-Identifier: GPL-2.0 2 3KBUILD_AFLAGS += -D__DISABLE_EXPORTS 4KBUILD_CFLAGS += -D__DISABLE_EXPORTS -mcmodel=small -fPIC \ 5 -Os -DDISABLE_BRANCH_PROFILING \ 6 $(DISABLE_STACKLEAK_PLUGIN) \ 7 $(DISABLE_LATENT_ENTROPY_PLUGIN) \ 8 -fno-stack-protector -D__NO_FORTIFY \ 9 -fno-jump-tables \ 10 -include $(srctree)/include/linux/hidden.h 11 12# disable ftrace hooks and LTO 13KBUILD_CFLAGS := $(subst $(CC_FLAGS_FTRACE),,$(KBUILD_CFLAGS)) 14KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_LTO),$(KBUILD_CFLAGS)) 15KASAN_SANITIZE := n 16KCSAN_SANITIZE := n 17KMSAN_SANITIZE := n 18UBSAN_SANITIZE := n 19KCOV_INSTRUMENT := n 20 21obj-$(CONFIG_X86_64) += gdt_idt.o map_kernel.o 22obj-$(CONFIG_AMD_MEM_ENCRYPT) += sme.o sev-startup.o 23pi-objs := $(patsubst %.o,$(obj)/%.o,$(obj-y)) 24 25lib-$(CONFIG_X86_64) += la57toggle.o 26lib-$(CONFIG_EFI_MIXED) += efi-mixed.o 27 28# 29# Disable objtool validation for all library code, which is intended 30# to be linked into the decompressor or the EFI stub but not vmlinux 31# 32$(patsubst %.o,$(obj)/%.o,$(lib-y)): OBJECT_FILES_NON_STANDARD := y 33 34# 35# Invoke objtool for each object individually to check for absolute 36# relocations, even if other objtool actions are being deferred. 37# 38$(pi-objs): objtool-enabled = 1 39$(pi-objs): objtool-args = $(if $(delay-objtool),,$(objtool-args-y)) --noabs 40 41# 42# Confine the startup code by prefixing all symbols with __pi_ (for position 43# independent). This ensures that startup code can only call other startup 44# code, or code that has explicitly been made accessible to it via a symbol 45# alias. 46# 47$(obj)/%.pi.o: OBJCOPYFLAGS := --prefix-symbols=__pi_ 48$(obj)/%.pi.o: $(obj)/%.o FORCE 49 $(call if_changed,objcopy) 50 51targets += $(obj-y) 52obj-y := $(patsubst %.o,%.pi.o,$(obj-y)) 53