forked from luck/tmp_suning_uos_patched
cff11abeca
- fix warnings in 'make clean' for ARCH=um, hexagon, h8300, unicore32 - ensure to rebuild all objects when the compiler is upgraded - exclude system headers from dependency tracking and fixdep processing - fix potential bit-size mismatch between the kernel and BPF user-mode helper - add the new syntax 'userprogs' to build user-space programs for the target architecture (the same arch as the kernel) - compile user-space sample code under samples/ for the target arch instead of the host arch - make headers_install fail if a CONFIG option is leaked to user-space - sanitize the output format of scripts/checkstack.pl - handle ARM 'push' instruction in scripts/checkstack.pl - error out before modpost if a module name conflict is found - error out when multiple directories are passed to M= because this feature is broken for a long time - add CONFIG_DEBUG_INFO_COMPRESSED to support compressed debug info - a lot of cleanups of modpost - dump vmlinux symbols out into vmlinux.symvers, and reuse it in the second pass of modpost - do not run the second pass of modpost if nothing in modules is updated - install modules.builtin(.modinfo) by 'make install' as well as by 'make modules_install' because it is useful even when CONFIG_MODULES=n - add new command line variables, GZIP, BZIP2, LZOP, LZMA, LZ4, and XZ to allow users to use alternatives such as pigz, pbzip2, etc. -----BEGIN PGP SIGNATURE----- iQJJBAABCgAzFiEEbmPs18K1szRHjPqEPYsBB53g2wYFAl7brm0VHG1hc2FoaXJv eUBrZXJuZWwub3JnAAoJED2LAQed4NsGjeEP/Rrf8H9cp/Tq+ALQCBycI3W5ZEHg n2EqprZkVP2MlOV0d+8b9t4PdZf6E5Wmfv26sMaBAhl6X1KQI/0NgPMnTINvy5jJ Q2SMhj9y8Gwr3XKFu9Hd/0U+Sax5rz+LmY84tdF95dXzPIUWjAEVnbmN+ofY6T++ sNf2YGNFSR6iiqr3uCYA0hHZmpKlfhVgDPAdncWa5aadSsuQb79nZQWefGeVEsuD HrISpwnkhBc0qY1xyWry6agE92xWmkNkdjKq6A7peguZL02XySWLRWjyHoiiaPOB 6U4urKs/NSXqPgxGxwZthhwERHryC3+g4s8wRBDKE6ISRWKBBA2ruHpgdF5h/utu re1ZP2qRcAt8NBFynr4MEb2AU0mYkv7iEgfLJ7NUCRlMOtqrn5RFwnS4r8ReyQp5 1UM11RbPhYgYjM5g9hBHJ7nK944/kfvy1/4jF4I1+M5O7QL6f00pu3r2bBIa/65g DWrNOpIliKG27GgnRlxi7HgLfxs9etFcXTpHO0ymgnMmlz+7FQsdceR9qqybGU9o yBWw6zculMQjb3E+k0DTnE5kLWsycbua921wxM9ABSxRmJi7WciNF73RdLUIBoAY VUbwrP2aIpdL+2uyX6RqdTaWzEBpW8omszr46aQ96pX+RiqMrPvJRLaA/tr3ZH8g tdHenJPWdHSaOcO4 =GKe5 -----END PGP SIGNATURE----- Merge tag 'kbuild-v5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild Pull Kbuild updates from Masahiro Yamada: - fix warnings in 'make clean' for ARCH=um, hexagon, h8300, unicore32 - ensure to rebuild all objects when the compiler is upgraded - exclude system headers from dependency tracking and fixdep processing - fix potential bit-size mismatch between the kernel and BPF user-mode helper - add the new syntax 'userprogs' to build user-space programs for the target architecture (the same arch as the kernel) - compile user-space sample code under samples/ for the target arch instead of the host arch - make headers_install fail if a CONFIG option is leaked to user-space - sanitize the output format of scripts/checkstack.pl - handle ARM 'push' instruction in scripts/checkstack.pl - error out before modpost if a module name conflict is found - error out when multiple directories are passed to M= because this feature is broken for a long time - add CONFIG_DEBUG_INFO_COMPRESSED to support compressed debug info - a lot of cleanups of modpost - dump vmlinux symbols out into vmlinux.symvers, and reuse it in the second pass of modpost - do not run the second pass of modpost if nothing in modules is updated - install modules.builtin(.modinfo) by 'make install' as well as by 'make modules_install' because it is useful even when CONFIG_MODULES=n - add new command line variables, GZIP, BZIP2, LZOP, LZMA, LZ4, and XZ to allow users to use alternatives such as pigz, pbzip2, etc. * tag 'kbuild-v5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (96 commits) kbuild: add variables for compression tools Makefile: install modules.builtin even if CONFIG_MODULES=n mksysmap: Fix the mismatch of '.L' symbols in System.map kbuild: doc: rename LDFLAGS to KBUILD_LDFLAGS modpost: change elf_info->size to size_t modpost: remove is_vmlinux() helper modpost: strip .o from modname before calling new_module() modpost: set have_vmlinux in new_module() modpost: remove mod->skip struct member modpost: add mod->is_vmlinux struct member modpost: remove is_vmlinux() call in check_for_{gpl_usage,unused}() modpost: remove mod->is_dot_o struct member modpost: move -d option in scripts/Makefile.modpost modpost: remove -s option modpost: remove get_next_text() and make {grab,release_}file static modpost: use read_text_file() and get_line() for reading text files modpost: avoid false-positive file open error modpost: fix potential mmap'ed file overrun in get_src_version() modpost: add read_text_file() and get_line() helpers modpost: do not call get_modinfo() for vmlinux(.o) ...
196 lines
6.6 KiB
Makefile
196 lines
6.6 KiB
Makefile
#
|
|
# 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
|
|
|
|
LDFLAGS_vmlinux :=--no-undefined -X
|
|
CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
|
|
|
|
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.
|
|
LDFLAGS_vmlinux += -shared -Bsymbolic -z notext -z norelro \
|
|
$(call ld-option, --no-apply-dynamic-relocs)
|
|
endif
|
|
|
|
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
|
|
|
|
ifeq ($(CONFIG_ARM64_USE_LSE_ATOMICS), y)
|
|
ifneq ($(CONFIG_ARM64_LSE_ATOMICS), y)
|
|
$(warning LSE atomics not supported by binutils)
|
|
endif
|
|
endif
|
|
|
|
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)
|
|
|
|
ifeq ($(CONFIG_BROKEN_GAS_INST),y)
|
|
$(warning Detected assembler with broken .inst; disassembly will be unreliable)
|
|
endif
|
|
|
|
KBUILD_CFLAGS += -mgeneral-regs-only \
|
|
$(compat_vdso) $(cc_has_k_constraint)
|
|
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
|
|
KBUILD_CFLAGS += $(call cc-disable-warning, psabi)
|
|
KBUILD_AFLAGS += $(compat_vdso)
|
|
|
|
KBUILD_CFLAGS += $(call cc-option,-mabi=lp64)
|
|
KBUILD_AFLAGS += $(call cc-option,-mabi=lp64)
|
|
|
|
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
|
|
|
|
# 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)
|
|
|
|
ifeq ($(CONFIG_ARM64_PTR_AUTH),y)
|
|
branch-prot-flags-$(CONFIG_CC_HAS_SIGN_RETURN_ADDRESS) := -msign-return-address=all
|
|
# 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.
|
|
ifeq ($(CONFIG_ARM64_BTI_KERNEL),y)
|
|
branch-prot-flags-$(CONFIG_CC_HAS_BRANCH_PROT_PAC_RET_BTI) := -mbranch-protection=pac-ret+leaf+bti
|
|
else
|
|
branch-prot-flags-$(CONFIG_CC_HAS_BRANCH_PROT_PAC_RET) := -mbranch-protection=pac-ret+leaf
|
|
endif
|
|
# -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.
|
|
branch-prot-flags-$(CONFIG_AS_HAS_PAC) += -Wa,-march=armv8.3-a
|
|
endif
|
|
|
|
KBUILD_CFLAGS += $(branch-prot-flags-y)
|
|
|
|
ifeq ($(CONFIG_SHADOW_CALL_STACK), y)
|
|
KBUILD_CFLAGS += -ffixed-x18
|
|
endif
|
|
|
|
ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
|
|
KBUILD_CPPFLAGS += -mbig-endian
|
|
CHECKFLAGS += -D__AARCH64EB__
|
|
# Prefer the baremetal ELF build target, but not all toolchains include
|
|
# it so fall back to the standard linux version if needed.
|
|
KBUILD_LDFLAGS += -EB $(call ld-option, -maarch64elfb, -maarch64linuxb)
|
|
UTS_MACHINE := aarch64_be
|
|
else
|
|
KBUILD_CPPFLAGS += -mlittle-endian
|
|
CHECKFLAGS += -D__AARCH64EL__
|
|
# Same as above, prefer ELF but fall back to linux target if needed.
|
|
KBUILD_LDFLAGS += -EL $(call ld-option, -maarch64elf, -maarch64linux)
|
|
UTS_MACHINE := aarch64
|
|
endif
|
|
|
|
CHECKFLAGS += -D__aarch64__
|
|
|
|
ifeq ($(CONFIG_ARM64_MODULE_PLTS),y)
|
|
KBUILD_LDS_MODULE += $(srctree)/arch/arm64/kernel/module.lds
|
|
endif
|
|
|
|
ifeq ($(CONFIG_DYNAMIC_FTRACE_WITH_REGS),y)
|
|
KBUILD_CPPFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY
|
|
CC_FLAGS_FTRACE := -fpatchable-function-entry=2
|
|
endif
|
|
|
|
# Default value
|
|
head-y := arch/arm64/kernel/head.o
|
|
|
|
# The byte offset of the kernel image in RAM from the start of RAM.
|
|
ifeq ($(CONFIG_ARM64_RANDOMIZE_TEXT_OFFSET), y)
|
|
TEXT_OFFSET := $(shell awk "BEGIN {srand(); printf \"0x%06x\n\", \
|
|
int(2 * 1024 * 1024 / (2 ^ $(CONFIG_ARM64_PAGE_SHIFT)) * \
|
|
rand()) * (2 ^ $(CONFIG_ARM64_PAGE_SHIFT))}")
|
|
else
|
|
TEXT_OFFSET := 0x0
|
|
endif
|
|
|
|
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)
|
|
|
|
export TEXT_OFFSET
|
|
|
|
core-y += arch/arm64/
|
|
libs-y := arch/arm64/lib/ $(libs-y)
|
|
core-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
|
|
|
|
# Default target when executing plain make
|
|
boot := arch/arm64/boot
|
|
KBUILD_IMAGE := $(boot)/Image.gz
|
|
|
|
all: Image.gz
|
|
|
|
|
|
Image: vmlinux
|
|
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
|
|
|
|
Image.%: Image
|
|
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
|
|
|
|
zinstall install:
|
|
$(Q)$(MAKE) $(build)=$(boot) $@
|
|
|
|
PHONY += vdso_install
|
|
vdso_install:
|
|
$(Q)$(MAKE) $(build)=arch/arm64/kernel/vdso $@
|
|
|
|
# We use MRPROPER_FILES and CLEAN_FILES now
|
|
archclean:
|
|
$(Q)$(MAKE) $(clean)=$(boot)
|
|
|
|
ifeq ($(KBUILD_EXTMOD),)
|
|
# 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
|
|
$(if $(CONFIG_COMPAT_VDSO),$(Q)$(MAKE) \
|
|
$(build)=arch/arm64/kernel/vdso32 \
|
|
include/generated/vdso32-offsets.h)
|
|
endif
|
|
|
|
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
|