Ard Biesheuvel | f4f75ad5 | 2014-07-02 14:54:43 +0200 | [diff] [blame] | 1 | # |
| 2 | # The stub may be linked into the kernel proper or into a separate boot binary, |
| 3 | # but in either case, it executes before the kernel does (with MMU disabled) so |
| 4 | # things like ftrace and stack-protector are likely to cause trouble if left |
| 5 | # enabled, even if doing so doesn't break the build. |
| 6 | # |
| 7 | cflags-$(CONFIG_X86_32) := -march=i386 |
| 8 | cflags-$(CONFIG_X86_64) := -mcmodel=small |
| 9 | cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 \ |
| 10 | -fPIC -fno-strict-aliasing -mno-red-zone \ |
| 11 | -mno-mmx -mno-sse -DDISABLE_BRANCH_PROFILING |
| 12 | |
| 13 | cflags-$(CONFIG_ARM64) := $(subst -pg,,$(KBUILD_CFLAGS)) |
| 14 | cflags-$(CONFIG_ARM) := $(subst -pg,,$(KBUILD_CFLAGS)) \ |
| 15 | -fno-builtin -fpic -mno-single-pic-base |
| 16 | |
| 17 | KBUILD_CFLAGS := $(cflags-y) \ |
| 18 | $(call cc-option,-ffreestanding) \ |
| 19 | $(call cc-option,-fno-stack-protector) |
| 20 | |
| 21 | GCOV_PROFILE := n |
Andrey Ryabinin | 0b24bec | 2015-02-13 14:39:17 -0800 | [diff] [blame] | 22 | KASAN_SANITIZE := n |
Ard Biesheuvel | f4f75ad5 | 2014-07-02 14:54:43 +0200 | [diff] [blame] | 23 | |
| 24 | lib-y := efi-stub-helper.o |
| 25 | lib-$(CONFIG_EFI_ARMSTUB) += arm-stub.o fdt.o |
| 26 | |
Ard Biesheuvel | ddeeefe | 2015-01-12 20:28:20 +0000 | [diff] [blame] | 27 | # |
| 28 | # arm64 puts the stub in the kernel proper, which will unnecessarily retain all |
| 29 | # code indefinitely unless it is annotated as __init/__initdata/__initconst etc. |
| 30 | # So let's apply the __init annotations at the section level, by prefixing |
| 31 | # the section names directly. This will ensure that even all the inline string |
| 32 | # literals are covered. |
| 33 | # |
| 34 | extra-$(CONFIG_ARM64) := $(lib-y) |
| 35 | lib-$(CONFIG_ARM64) := $(patsubst %.o,%.init.o,$(lib-y)) |
| 36 | |
| 37 | OBJCOPYFLAGS := --prefix-alloc-sections=.init |
| 38 | $(obj)/%.init.o: $(obj)/%.o FORCE |
| 39 | $(call if_changed,objcopy) |