1f4f75ad5SArd Biesheuvel#
2f4f75ad5SArd Biesheuvel# The stub may be linked into the kernel proper or into a separate boot binary,
3f4f75ad5SArd Biesheuvel# but in either case, it executes before the kernel does (with MMU disabled) so
4f4f75ad5SArd Biesheuvel# things like ftrace and stack-protector are likely to cause trouble if left
5f4f75ad5SArd Biesheuvel# enabled, even if doing so doesn't break the build.
6f4f75ad5SArd Biesheuvel#
7f4f75ad5SArd Biesheuvelcflags-$(CONFIG_X86_32)		:= -march=i386
8f4f75ad5SArd Biesheuvelcflags-$(CONFIG_X86_64)		:= -mcmodel=small
9f4f75ad5SArd Biesheuvelcflags-$(CONFIG_X86)		+= -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 \
10f4f75ad5SArd Biesheuvel				   -fPIC -fno-strict-aliasing -mno-red-zone \
11f4f75ad5SArd Biesheuvel				   -mno-mmx -mno-sse -DDISABLE_BRANCH_PROFILING
12f4f75ad5SArd Biesheuvel
13f4f75ad5SArd Biesheuvelcflags-$(CONFIG_ARM64)		:= $(subst -pg,,$(KBUILD_CFLAGS))
14f4f75ad5SArd Biesheuvelcflags-$(CONFIG_ARM)		:= $(subst -pg,,$(KBUILD_CFLAGS)) \
15f4f75ad5SArd Biesheuvel				   -fno-builtin -fpic -mno-single-pic-base
16f4f75ad5SArd Biesheuvel
17f4f75ad5SArd BiesheuvelKBUILD_CFLAGS			:= $(cflags-y) \
18f4f75ad5SArd Biesheuvel				   $(call cc-option,-ffreestanding) \
19f4f75ad5SArd Biesheuvel				   $(call cc-option,-fno-stack-protector)
20f4f75ad5SArd Biesheuvel
21f4f75ad5SArd BiesheuvelGCOV_PROFILE			:= n
22f4f75ad5SArd Biesheuvel
23f4f75ad5SArd Biesheuvellib-y				:= efi-stub-helper.o
24f4f75ad5SArd Biesheuvellib-$(CONFIG_EFI_ARMSTUB)	+= arm-stub.o fdt.o
25f4f75ad5SArd Biesheuvel
26f4f75ad5SArd BiesheuvelCFLAGS_fdt.o			+= -I$(srctree)/scripts/dtc/libfdt/
27