Blame view
arch/arm64/Makefile
6.58 KB
8c2c3df31 arm64: Build infr... |
1 2 3 4 5 6 7 8 9 10 11 |
# # arch/arm64/Makefile # # This file is included by the global makefile so that you can add your own # architecture-specific flags and dependencies. # # This file is subject to the terms and conditions of the GNU General Public # License. See the file "COPYING" in the main directory of this archive # for more details. # # Copyright (C) 1995-2001 by Russell King |
1cd7e30a6 arm64: link with ... |
12 |
LDFLAGS_vmlinux :=--no-undefined -X |
8c2c3df31 arm64: Build infr... |
13 |
|
fd9dde6ab arm64: prevent re... |
14 15 16 17 |
ifeq ($(CONFIG_RELOCATABLE), y) # Pass --no-apply-dynamic-relocs to restore pre-binutils-2.27 behaviour # for relative relocs, since this leads to better Image compression # with the relocation offsets always being zero. |
3b92fa748 arm64: link with ... |
18 |
LDFLAGS_vmlinux += -shared -Bsymbolic -z notext \ |
fd9dde6ab arm64: prevent re... |
19 |
$(call ld-option, --no-apply-dynamic-relocs) |
1e48ef7fc arm64: add suppor... |
20 |
endif |
6ffe9923f arm64: errata: Pa... |
21 22 23 24 25 26 27 |
ifeq ($(CONFIG_ARM64_ERRATUM_843419),y) ifeq ($(call ld-option, --fix-cortex-a53-843419),) $(warning ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum) else LDFLAGS_vmlinux += --fix-cortex-a53-843419 endif endif |
395af8613 arm64: Move the L... |
28 29 |
ifeq ($(CONFIG_ARM64_USE_LSE_ATOMICS), y) ifneq ($(CONFIG_ARM64_LSE_ATOMICS), y) |
c09d6a04d arm64: atomics: p... |
30 31 32 |
$(warning LSE atomics not supported by binutils) endif endif |
03adcbd99 arm64: atomics: U... |
33 34 35 36 37 |
cc_has_k_constraint := $(call try-run,echo \ 'int main(void) { \ asm volatile("and w0, w0, %w0" :: "K" (4294967295)); \ return 0; \ }' | $(CC) -S -x c -o "$$TMP" -,,-DCONFIG_CC_HAS_K_CONSTRAINT=1) |
8bf9284d9 arm64: Turn "brok... |
38 |
ifeq ($(CONFIG_BROKEN_GAS_INST),y) |
bbb56c272 arm64: Add detect... |
39 40 |
$(warning Detected assembler with broken .inst; disassembly will be unreliable) endif |
8bf9284d9 arm64: Turn "brok... |
41 |
KBUILD_CFLAGS += -mgeneral-regs-only \ |
03adcbd99 arm64: atomics: U... |
42 |
$(compat_vdso) $(cc_has_k_constraint) |
fa63da2ab arm64: Don't unco... |
43 |
KBUILD_CFLAGS += $(call cc-disable-warning, psabi) |
8bf9284d9 arm64: Turn "brok... |
44 |
KBUILD_AFLAGS += $(compat_vdso) |
c09d6a04d arm64: atomics: p... |
45 |
|
3d6a7b99e arm64: ensure the... |
46 47 |
KBUILD_CFLAGS += $(call cc-option,-mabi=lp64) KBUILD_AFLAGS += $(call cc-option,-mabi=lp64) |
6e0a66d10 arm64/build: Remo... |
48 49 50 |
# Avoid generating .eh_frame* sections. KBUILD_CFLAGS += -fno-asynchronous-unwind-tables -fno-unwind-tables KBUILD_AFLAGS += -fno-asynchronous-unwind-tables -fno-unwind-tables |
0a1213fa7 arm64: enable per... |
51 52 53 54 55 56 57 58 59 |
ifeq ($(CONFIG_STACKPROTECTOR_PER_TASK),y) prepare: stack_protector_prepare stack_protector_prepare: prepare0 $(eval KBUILD_CFLAGS += -mstack-protector-guard=sysreg \ -mstack-protector-guard-reg=sp_el0 \ -mstack-protector-guard-offset=$(shell \ awk '{if ($$2 == "TSK_STACK_CANARY") print $$3;}' \ include/generated/asm-offsets.h)) endif |
b8fdef311 arm64: Always for... |
60 61 62 |
# Ensure that if the compiler supports branch protection we default it # off, this will be overridden if we are using branch protection. branch-prot-flags-y += $(call cc-option,-mbranch-protection=none) |
74afda401 arm64: compile th... |
63 64 |
ifeq ($(CONFIG_ARM64_PTR_AUTH),y) branch-prot-flags-$(CONFIG_CC_HAS_SIGN_RETURN_ADDRESS) := -msign-return-address=all |
717b938e2 arm64: Document w... |
65 66 67 |
# We enable additional protection for leaf functions as there is some # narrow potential for ROP protection benefits and no substantial # performance impact has been observed. |
92e2294d8 arm64: bti: Suppo... |
68 69 70 |
ifeq ($(CONFIG_ARM64_BTI_KERNEL),y) branch-prot-flags-$(CONFIG_CC_HAS_BRANCH_PROT_PAC_RET_BTI) := -mbranch-protection=pac-ret+leaf+bti else |
74afda401 arm64: compile th... |
71 |
branch-prot-flags-$(CONFIG_CC_HAS_BRANCH_PROT_PAC_RET) := -mbranch-protection=pac-ret+leaf |
92e2294d8 arm64: bti: Suppo... |
72 |
endif |
74afda401 arm64: compile th... |
73 74 75 76 |
# -march=armv8.3-a enables the non-nops instructions for PAC, to avoid the # compiler to generate them and consequently to break the single image contract # we pass it only to the assembler. This option is utilized only in case of non # integrated assemblers. |
1764c3edc arm64: use a comm... |
77 78 |
ifeq ($(CONFIG_AS_HAS_PAC), y) asm-arch := armv8.3-a |
74afda401 arm64: compile th... |
79 |
endif |
7c78f67e9 arm64: enable tlb... |
80 |
endif |
74afda401 arm64: compile th... |
81 |
|
b8fdef311 arm64: Always for... |
82 |
KBUILD_CFLAGS += $(branch-prot-flags-y) |
7c78f67e9 arm64: enable tlb... |
83 84 |
ifeq ($(CONFIG_AS_HAS_ARMV8_4), y) # make sure to pass the newest target architecture to -march. |
1764c3edc arm64: use a comm... |
85 86 87 88 89 90 |
asm-arch := armv8.4-a endif ifdef asm-arch KBUILD_CFLAGS += -Wa,-march=$(asm-arch) \ -DARM64_ASM_ARCH='"$(asm-arch)"' |
7c78f67e9 arm64: enable tlb... |
91 |
endif |
da64e9d1f arm64: Reserve re... |
92 93 94 |
ifeq ($(CONFIG_SHADOW_CALL_STACK), y) KBUILD_CFLAGS += -ffixed-x18 endif |
a0974e6e2 arm64: big-endian... |
95 96 |
ifeq ($(CONFIG_CPU_BIG_ENDIAN), y) KBUILD_CPPFLAGS += -mbig-endian |
bcde519e8 arm64: pass endia... |
97 |
CHECKFLAGS += -D__AARCH64EB__ |
c931d34ea arm64: build with... |
98 99 |
# Prefer the baremetal ELF build target, but not all toolchains include # it so fall back to the standard linux version if needed. |
1cd7e30a6 arm64: link with ... |
100 |
KBUILD_LDFLAGS += -EB $(call ld-option, -maarch64elfb, -maarch64linuxb -z norelro) |
cfa88c794 arm64: Set UTS_MA... |
101 |
UTS_MACHINE := aarch64_be |
a0974e6e2 arm64: big-endian... |
102 |
else |
8c2c3df31 arm64: Build infr... |
103 |
KBUILD_CPPFLAGS += -mlittle-endian |
bcde519e8 arm64: pass endia... |
104 |
CHECKFLAGS += -D__AARCH64EL__ |
c931d34ea arm64: build with... |
105 |
# Same as above, prefer ELF but fall back to linux target if needed. |
1cd7e30a6 arm64: link with ... |
106 |
KBUILD_LDFLAGS += -EL $(call ld-option, -maarch64elf, -maarch64linux -z norelro) |
cfa88c794 arm64: Set UTS_MA... |
107 |
UTS_MACHINE := aarch64 |
a0974e6e2 arm64: big-endian... |
108 |
endif |
8c2c3df31 arm64: Build infr... |
109 |
|
1cd7e30a6 arm64: link with ... |
110 111 112 |
ifeq ($(CONFIG_LD_IS_LLD), y) KBUILD_LDFLAGS += -z norelro endif |
1f2f01b12 kbuild: add machi... |
113 |
CHECKFLAGS += -D__aarch64__ |
8c2c3df31 arm64: Build infr... |
114 |
|
3b23e4991 arm64: implement ... |
115 116 117 118 |
ifeq ($(CONFIG_DYNAMIC_FTRACE_WITH_REGS),y) KBUILD_CPPFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY CC_FLAGS_FTRACE := -fpatchable-function-entry=2 endif |
8c2c3df31 arm64: Build infr... |
119 120 |
# Default value head-y := arch/arm64/kernel/head.o |
b2f557eae kasan, arm64: adj... |
121 122 123 124 125 126 127 128 129 |
ifeq ($(CONFIG_KASAN_SW_TAGS), y) KASAN_SHADOW_SCALE_SHIFT := 4 else KASAN_SHADOW_SCALE_SHIFT := 3 endif KBUILD_CFLAGS += -DKASAN_SHADOW_SCALE_SHIFT=$(KASAN_SHADOW_SCALE_SHIFT) KBUILD_CPPFLAGS += -DKASAN_SHADOW_SCALE_SHIFT=$(KASAN_SHADOW_SCALE_SHIFT) KBUILD_AFLAGS += -DKASAN_SHADOW_SCALE_SHIFT=$(KASAN_SHADOW_SCALE_SHIFT) |
6bfa3134b arm64: add arch/a... |
130 |
core-y += arch/arm64/ |
8c2c3df31 arm64: Build infr... |
131 |
libs-y := arch/arm64/lib/ $(libs-y) |
c1aac64dd efi/libstub/arm64... |
132 |
libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a |
8c2c3df31 arm64: Build infr... |
133 134 |
# Default target when executing plain make |
06995804b arm64: Use full p... |
135 136 |
boot := arch/arm64/boot KBUILD_IMAGE := $(boot)/Image.gz |
8c2c3df31 arm64: Build infr... |
137 |
|
37c8a5faf kbuild: consolida... |
138 |
all: Image.gz |
8c2c3df31 arm64: Build infr... |
139 |
|
8c2c3df31 arm64: Build infr... |
140 |
|
0723c05fb arm64: enable mor... |
141 142 |
Image: vmlinux $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ |
9ca4e58c2 arm64: fix boot i... |
143 |
Image.%: Image |
70f915a29 arm64: Add dtbs t... |
144 |
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ |
8c2c3df31 arm64: Build infr... |
145 |
|
8684fa3e7 arm64: kbuild: ma... |
146 |
zinstall install: |
70f915a29 arm64: Add dtbs t... |
147 |
$(Q)$(MAKE) $(build)=$(boot) $@ |
8c2c3df31 arm64: Build infr... |
148 |
|
3c01742a8 arm64/Makefile: p... |
149 150 151 |
PHONY += vdso_install vdso_install: $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@ |
5d28ba5f8 arm64: vdso32: ma... |
152 153 |
$(if $(CONFIG_COMPAT_VDSO), \ $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso32 $@) |
3c01742a8 arm64/Makefile: p... |
154 |
|
8c2c3df31 arm64: Build infr... |
155 156 157 |
# We use MRPROPER_FILES and CLEAN_FILES now archclean: $(Q)$(MAKE) $(clean)=$(boot) |
98356eb0a arm64: makefile f... |
158 |
ifeq ($(KBUILD_EXTMOD),) |
a66649dab arm64: fix vdso-o... |
159 160 161 162 163 164 165 166 167 |
# We need to generate vdso-offsets.h before compiling certain files in kernel/. # In order to do that, we should use the archprepare target, but we can't since # asm-offsets.h is included in some files used to generate vdso-offsets.h, and # asm-offsets.h is built in prepare0, for which archprepare is a dependency. # Therefore we need to generate the header after prepare0 has been made, hence # this hack. prepare: vdso_prepare vdso_prepare: prepare0 $(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso include/generated/vdso-offsets.h |
bfe801ebe arm64: vdso: Enab... |
168 169 170 |
$(if $(CONFIG_COMPAT_VDSO),$(Q)$(MAKE) \ $(build)=arch/arm64/kernel/vdso32 \ include/generated/vdso32-offsets.h) |
98356eb0a arm64: makefile f... |
171 |
endif |
a66649dab arm64: fix vdso-o... |
172 |
|
8c2c3df31 arm64: Build infr... |
173 174 175 176 177 178 179 180 181 |
define archhelp echo '* Image.gz - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)' echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)' echo ' install - Install uncompressed kernel' echo ' zinstall - Install compressed kernel' echo ' Install using (your) ~/bin/installkernel or' echo ' (distribution) /sbin/installkernel or' echo ' install to $$(INSTALL_PATH) and run lilo' endef |