Loading Documentation/admin-guide/kernel-parameters.txt +3 −0 Original line number Diff line number Diff line Loading @@ -2556,6 +2556,9 @@ noalign [KNL,ARM] noaltinstr [S390] Disables alternative instructions patching (CPU alternatives feature). noapic [SMP,APIC] Tells the kernel to not make use of any IOAPICs that may be present in the system. Loading Makefile +86 −2 Original line number Diff line number Diff line # SPDX-License-Identifier: GPL-2.0 VERSION = 4 PATCHLEVEL = 14 SUBLEVEL = 37 SUBLEVEL = 38 EXTRAVERSION = NAME = Petit Gorille Loading Loading @@ -378,6 +378,7 @@ endif AS = $(CROSS_COMPILE)as LD = $(CROSS_COMPILE)ld REAL_CC = $(CROSS_COMPILE)gcc LDGOLD = $(CROSS_COMPILE)ld.gold CPP = $(CC) -E AR = $(CROSS_COMPILE)ar NM = $(CROSS_COMPILE)nm Loading Loading @@ -640,6 +641,20 @@ CFLAGS_GCOV := -fprofile-arcs -ftest-coverage -fno-tree-loop-im $(call cc-disabl CFLAGS_KCOV := $(call cc-option,-fsanitize-coverage=trace-pc,) export CFLAGS_GCOV CFLAGS_KCOV # Make toolchain changes before including arch/$(SRCARCH)/Makefile to ensure # ar/cc/ld-* macros return correct values. ifdef CONFIG_LTO_CLANG # use GNU gold with LLVMgold for LTO linking, and LD for vmlinux_link LDFINAL_vmlinux := $(LD) LD := $(LDGOLD) LDFLAGS += -plugin LLVMgold.so # use llvm-ar for building symbol tables from IR files, and llvm-dis instead # of objdump for processing symbol versions and exports LLVM_AR := llvm-ar LLVM_DIS := llvm-dis export LLVM_AR LLVM_DIS endif # The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default # values of the respective KBUILD_* variables ARCH_CPPFLAGS := Loading Loading @@ -818,6 +833,53 @@ KBUILD_CFLAGS += $(call cc-option,-ffunction-sections,) KBUILD_CFLAGS += $(call cc-option,-fdata-sections,) endif ifdef CONFIG_LTO_CLANG lto-clang-flags := -flto -fvisibility=hidden # allow disabling only clang LTO where needed DISABLE_LTO_CLANG := -fno-lto -fvisibility=default export DISABLE_LTO_CLANG endif ifdef CONFIG_LTO lto-flags := $(lto-clang-flags) KBUILD_CFLAGS += $(lto-flags) DISABLE_LTO := $(DISABLE_LTO_CLANG) export DISABLE_LTO # LDFINAL_vmlinux and LDFLAGS_FINAL_vmlinux can be set to override # the linker and flags for vmlinux_link. export LDFINAL_vmlinux LDFLAGS_FINAL_vmlinux endif ifdef CONFIG_CFI_CLANG cfi-clang-flags += -fsanitize=cfi DISABLE_CFI_CLANG := -fno-sanitize=cfi ifdef CONFIG_MODULES cfi-clang-flags += -fsanitize-cfi-cross-dso DISABLE_CFI_CLANG += -fno-sanitize-cfi-cross-dso endif ifdef CONFIG_CFI_PERMISSIVE cfi-clang-flags += -fsanitize-recover=cfi -fno-sanitize-trap=cfi endif # also disable CFI when LTO is disabled DISABLE_LTO_CLANG += $(DISABLE_CFI_CLANG) # allow disabling only clang CFI where needed export DISABLE_CFI_CLANG endif ifdef CONFIG_CFI # cfi-flags are re-tested in prepare-compiler-check cfi-flags := $(cfi-clang-flags) KBUILD_CFLAGS += $(cfi-flags) DISABLE_CFI := $(DISABLE_CFI_CLANG) DISABLE_LTO += $(DISABLE_CFI) export DISABLE_CFI endif # arch Makefile may override CC so keep this after arch Makefile is included NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) CHECKFLAGS += $(NOSTDINC_FLAGS) Loading Loading @@ -1135,6 +1197,22 @@ prepare-objtool: $(objtool_target) # CC_STACKPROTECTOR_STRONG! Why did it build with _REGULAR?!") PHONY += prepare-compiler-check prepare-compiler-check: FORCE # Make sure we're using a supported toolchain with LTO_CLANG ifdef CONFIG_LTO_CLANG ifneq ($(call clang-ifversion, -ge, 0500, y), y) @echo Cannot use CONFIG_LTO_CLANG: requires clang 5.0 or later >&2 && exit 1 endif ifneq ($(call gold-ifversion, -ge, 112000000, y), y) @echo Cannot use CONFIG_LTO_CLANG: requires GNU gold 1.12 or later >&2 && exit 1 endif endif # Make sure compiler supports LTO flags ifdef lto-flags ifeq ($(call cc-option, $(lto-flags)),) @echo Cannot use CONFIG_LTO: $(lto-flags) not supported by compiler \ >&2 && exit 1 endif endif # Make sure compiler supports requested stack protector flag. ifdef stackp-name ifeq ($(call cc-option, $(stackp-flag)),) Loading @@ -1148,6 +1226,11 @@ ifdef stackp-check @echo Cannot use CONFIG_CC_STACKPROTECTOR_$(stackp-name): \ $(stackp-flag) available but compiler is broken >&2 && exit 1 endif endif ifdef cfi-flags ifeq ($(call cc-option, $(cfi-flags)),) @echo Cannot use CONFIG_CFI: $(cfi-flags) not supported by compiler >&2 && exit 1 endif endif @: Loading Loading @@ -1608,7 +1691,8 @@ clean: $(clean-dirs) -o -name modules.builtin -o -name '.tmp_*.o.*' \ -o -name '*.c.[012]*.*' \ -o -name '*.ll' \ -o -name '*.gcno' \) -type f -print | xargs rm -f -o -name '*.gcno' \ -o -name '*.*.symversions' \) -type f -print | xargs rm -f # Generate tags for editors # --------------------------------------------------------------------------- Loading arch/Kconfig +68 −0 Original line number Diff line number Diff line Loading @@ -605,6 +605,74 @@ config LD_DEAD_CODE_DATA_ELIMINATION sections (e.g., '.text.init'). Typically '.' in section names is used to distinguish them from label names / C identifiers. config LTO def_bool n config ARCH_SUPPORTS_LTO_CLANG bool help An architecture should select this option it supports: - compiling with clang, - compiling inline assembly with clang's integrated assembler, - and linking with either lld or GNU gold w/ LLVMgold. choice prompt "Link-Time Optimization (LTO) (EXPERIMENTAL)" default LTO_NONE help This option turns on Link-Time Optimization (LTO). config LTO_NONE bool "None" config LTO_CLANG bool "Use clang Link Time Optimization (LTO) (EXPERIMENTAL)" depends on ARCH_SUPPORTS_LTO_CLANG depends on !FTRACE_MCOUNT_RECORD || HAVE_C_RECORDMCOUNT select LTO select THIN_ARCHIVES select LD_DEAD_CODE_DATA_ELIMINATION help This option enables clang's Link Time Optimization (LTO), which allows the compiler to optimize the kernel globally at link time. If you enable this option, the compiler generates LLVM IR instead of object files, and the actual compilation from IR occurs at the LTO link step, which may take several minutes. If you select this option, you must compile the kernel with clang >= 5.0 (make CC=clang) and GNU gold from binutils >= 2.27, and have the LLVMgold plug-in in LD_LIBRARY_PATH. endchoice config CFI bool config CFI_PERMISSIVE bool "Use CFI in permissive mode" depends on CFI help When selected, Control Flow Integrity (CFI) violations result in a warning instead of a kernel panic. This option is useful for finding CFI violations in drivers during development. config CFI_CLANG bool "Use clang Control Flow Integrity (CFI) (EXPERIMENTAL)" depends on LTO_CLANG depends on KALLSYMS select CFI help This option enables clang Control Flow Integrity (CFI), which adds runtime checking for indirect function calls. config CFI_CLANG_SHADOW bool "Use CFI shadow to speed up cross-module checks" default y depends on CFI_CLANG help If you select this option, the kernel builds a fast look-up table of CFI check functions in loaded modules to reduce overhead. config HAVE_ARCH_WITHIN_STACK_FRAMES bool help Loading arch/arm64/Kconfig +3 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ config ARM64 select ARCH_HAVE_NMI_SAFE_CMPXCHG if ACPI_APEI_SEA select ARCH_USE_CMPXCHG_LOCKREF select ARCH_SUPPORTS_MEMORY_FAILURE select ARCH_SUPPORTS_LTO_CLANG select ARCH_SUPPORTS_ATOMIC_RMW select ARCH_SUPPORTS_NUMA_BALANCING select ARCH_WANT_COMPAT_IPC_PARSE_VERSION Loading Loading @@ -433,7 +434,7 @@ config ARM64_ERRATUM_845719 config ARM64_ERRATUM_843419 bool "Cortex-A53: 843419: A load or store might access an incorrect address" default y default y if !LTO_CLANG select ARM64_MODULE_CMODEL_LARGE if MODULES help This option links the kernel with '--fix-cortex-a53-843419' and Loading Loading @@ -1090,7 +1091,7 @@ config RANDOMIZE_BASE config RANDOMIZE_MODULE_REGION_FULL bool "Randomize the module region independently from the core kernel" depends on RANDOMIZE_BASE depends on RANDOMIZE_BASE && !LTO_CLANG default y help Randomizes the location of the module region without considering the Loading arch/arm64/Makefile +21 −0 Original line number Diff line number Diff line Loading @@ -26,8 +26,17 @@ 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 ifeq ($(call gold-ifversion, -lt, 114000000, y), y) $(warning This version of GNU gold may generate incorrect code with --fix-cortex-a53-843419;\ see https://sourceware.org/bugzilla/show_bug.cgi?id=21491) endif LDFLAGS_vmlinux += --fix-cortex-a53-843419 endif else ifeq ($(ld-name),gold) # Pass --no-fix-cortex-a53-843419 to ensure the erratum fix is disabled LDFLAGS += --no-fix-cortex-a53-843419 endif endif KBUILD_DEFCONFIG := defconfig Loading Loading @@ -70,14 +79,22 @@ KBUILD_CPPFLAGS += -mbig-endian CHECKFLAGS += -D__AARCH64EB__ AS += -EB LD += -EB ifeq ($(ld-name),gold) LDFLAGS += -maarch64_elf64_be_vec else LDFLAGS += -maarch64linuxb endif UTS_MACHINE := aarch64_be else KBUILD_CPPFLAGS += -mlittle-endian CHECKFLAGS += -D__AARCH64EL__ AS += -EL LD += -EL ifeq ($(ld-name),gold) LDFLAGS += -maarch64_elf64_le_vec else LDFLAGS += -maarch64linux endif UTS_MACHINE := aarch64 endif Loading @@ -85,6 +102,10 @@ CHECKFLAGS += -D__aarch64__ -m64 ifeq ($(CONFIG_ARM64_MODULE_CMODEL_LARGE), y) KBUILD_CFLAGS_MODULE += -mcmodel=large ifeq ($(CONFIG_LTO_CLANG), y) # Code model is not stored in LLVM IR, so we need to pass it also to LLVMgold LDFLAGS += -plugin-opt=-code-model=large endif endif ifeq ($(CONFIG_ARM64_MODULE_PLTS),y) Loading Loading
Documentation/admin-guide/kernel-parameters.txt +3 −0 Original line number Diff line number Diff line Loading @@ -2556,6 +2556,9 @@ noalign [KNL,ARM] noaltinstr [S390] Disables alternative instructions patching (CPU alternatives feature). noapic [SMP,APIC] Tells the kernel to not make use of any IOAPICs that may be present in the system. Loading
Makefile +86 −2 Original line number Diff line number Diff line # SPDX-License-Identifier: GPL-2.0 VERSION = 4 PATCHLEVEL = 14 SUBLEVEL = 37 SUBLEVEL = 38 EXTRAVERSION = NAME = Petit Gorille Loading Loading @@ -378,6 +378,7 @@ endif AS = $(CROSS_COMPILE)as LD = $(CROSS_COMPILE)ld REAL_CC = $(CROSS_COMPILE)gcc LDGOLD = $(CROSS_COMPILE)ld.gold CPP = $(CC) -E AR = $(CROSS_COMPILE)ar NM = $(CROSS_COMPILE)nm Loading Loading @@ -640,6 +641,20 @@ CFLAGS_GCOV := -fprofile-arcs -ftest-coverage -fno-tree-loop-im $(call cc-disabl CFLAGS_KCOV := $(call cc-option,-fsanitize-coverage=trace-pc,) export CFLAGS_GCOV CFLAGS_KCOV # Make toolchain changes before including arch/$(SRCARCH)/Makefile to ensure # ar/cc/ld-* macros return correct values. ifdef CONFIG_LTO_CLANG # use GNU gold with LLVMgold for LTO linking, and LD for vmlinux_link LDFINAL_vmlinux := $(LD) LD := $(LDGOLD) LDFLAGS += -plugin LLVMgold.so # use llvm-ar for building symbol tables from IR files, and llvm-dis instead # of objdump for processing symbol versions and exports LLVM_AR := llvm-ar LLVM_DIS := llvm-dis export LLVM_AR LLVM_DIS endif # The arch Makefile can set ARCH_{CPP,A,C}FLAGS to override the default # values of the respective KBUILD_* variables ARCH_CPPFLAGS := Loading Loading @@ -818,6 +833,53 @@ KBUILD_CFLAGS += $(call cc-option,-ffunction-sections,) KBUILD_CFLAGS += $(call cc-option,-fdata-sections,) endif ifdef CONFIG_LTO_CLANG lto-clang-flags := -flto -fvisibility=hidden # allow disabling only clang LTO where needed DISABLE_LTO_CLANG := -fno-lto -fvisibility=default export DISABLE_LTO_CLANG endif ifdef CONFIG_LTO lto-flags := $(lto-clang-flags) KBUILD_CFLAGS += $(lto-flags) DISABLE_LTO := $(DISABLE_LTO_CLANG) export DISABLE_LTO # LDFINAL_vmlinux and LDFLAGS_FINAL_vmlinux can be set to override # the linker and flags for vmlinux_link. export LDFINAL_vmlinux LDFLAGS_FINAL_vmlinux endif ifdef CONFIG_CFI_CLANG cfi-clang-flags += -fsanitize=cfi DISABLE_CFI_CLANG := -fno-sanitize=cfi ifdef CONFIG_MODULES cfi-clang-flags += -fsanitize-cfi-cross-dso DISABLE_CFI_CLANG += -fno-sanitize-cfi-cross-dso endif ifdef CONFIG_CFI_PERMISSIVE cfi-clang-flags += -fsanitize-recover=cfi -fno-sanitize-trap=cfi endif # also disable CFI when LTO is disabled DISABLE_LTO_CLANG += $(DISABLE_CFI_CLANG) # allow disabling only clang CFI where needed export DISABLE_CFI_CLANG endif ifdef CONFIG_CFI # cfi-flags are re-tested in prepare-compiler-check cfi-flags := $(cfi-clang-flags) KBUILD_CFLAGS += $(cfi-flags) DISABLE_CFI := $(DISABLE_CFI_CLANG) DISABLE_LTO += $(DISABLE_CFI) export DISABLE_CFI endif # arch Makefile may override CC so keep this after arch Makefile is included NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) CHECKFLAGS += $(NOSTDINC_FLAGS) Loading Loading @@ -1135,6 +1197,22 @@ prepare-objtool: $(objtool_target) # CC_STACKPROTECTOR_STRONG! Why did it build with _REGULAR?!") PHONY += prepare-compiler-check prepare-compiler-check: FORCE # Make sure we're using a supported toolchain with LTO_CLANG ifdef CONFIG_LTO_CLANG ifneq ($(call clang-ifversion, -ge, 0500, y), y) @echo Cannot use CONFIG_LTO_CLANG: requires clang 5.0 or later >&2 && exit 1 endif ifneq ($(call gold-ifversion, -ge, 112000000, y), y) @echo Cannot use CONFIG_LTO_CLANG: requires GNU gold 1.12 or later >&2 && exit 1 endif endif # Make sure compiler supports LTO flags ifdef lto-flags ifeq ($(call cc-option, $(lto-flags)),) @echo Cannot use CONFIG_LTO: $(lto-flags) not supported by compiler \ >&2 && exit 1 endif endif # Make sure compiler supports requested stack protector flag. ifdef stackp-name ifeq ($(call cc-option, $(stackp-flag)),) Loading @@ -1148,6 +1226,11 @@ ifdef stackp-check @echo Cannot use CONFIG_CC_STACKPROTECTOR_$(stackp-name): \ $(stackp-flag) available but compiler is broken >&2 && exit 1 endif endif ifdef cfi-flags ifeq ($(call cc-option, $(cfi-flags)),) @echo Cannot use CONFIG_CFI: $(cfi-flags) not supported by compiler >&2 && exit 1 endif endif @: Loading Loading @@ -1608,7 +1691,8 @@ clean: $(clean-dirs) -o -name modules.builtin -o -name '.tmp_*.o.*' \ -o -name '*.c.[012]*.*' \ -o -name '*.ll' \ -o -name '*.gcno' \) -type f -print | xargs rm -f -o -name '*.gcno' \ -o -name '*.*.symversions' \) -type f -print | xargs rm -f # Generate tags for editors # --------------------------------------------------------------------------- Loading
arch/Kconfig +68 −0 Original line number Diff line number Diff line Loading @@ -605,6 +605,74 @@ config LD_DEAD_CODE_DATA_ELIMINATION sections (e.g., '.text.init'). Typically '.' in section names is used to distinguish them from label names / C identifiers. config LTO def_bool n config ARCH_SUPPORTS_LTO_CLANG bool help An architecture should select this option it supports: - compiling with clang, - compiling inline assembly with clang's integrated assembler, - and linking with either lld or GNU gold w/ LLVMgold. choice prompt "Link-Time Optimization (LTO) (EXPERIMENTAL)" default LTO_NONE help This option turns on Link-Time Optimization (LTO). config LTO_NONE bool "None" config LTO_CLANG bool "Use clang Link Time Optimization (LTO) (EXPERIMENTAL)" depends on ARCH_SUPPORTS_LTO_CLANG depends on !FTRACE_MCOUNT_RECORD || HAVE_C_RECORDMCOUNT select LTO select THIN_ARCHIVES select LD_DEAD_CODE_DATA_ELIMINATION help This option enables clang's Link Time Optimization (LTO), which allows the compiler to optimize the kernel globally at link time. If you enable this option, the compiler generates LLVM IR instead of object files, and the actual compilation from IR occurs at the LTO link step, which may take several minutes. If you select this option, you must compile the kernel with clang >= 5.0 (make CC=clang) and GNU gold from binutils >= 2.27, and have the LLVMgold plug-in in LD_LIBRARY_PATH. endchoice config CFI bool config CFI_PERMISSIVE bool "Use CFI in permissive mode" depends on CFI help When selected, Control Flow Integrity (CFI) violations result in a warning instead of a kernel panic. This option is useful for finding CFI violations in drivers during development. config CFI_CLANG bool "Use clang Control Flow Integrity (CFI) (EXPERIMENTAL)" depends on LTO_CLANG depends on KALLSYMS select CFI help This option enables clang Control Flow Integrity (CFI), which adds runtime checking for indirect function calls. config CFI_CLANG_SHADOW bool "Use CFI shadow to speed up cross-module checks" default y depends on CFI_CLANG help If you select this option, the kernel builds a fast look-up table of CFI check functions in loaded modules to reduce overhead. config HAVE_ARCH_WITHIN_STACK_FRAMES bool help Loading
arch/arm64/Kconfig +3 −2 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ config ARM64 select ARCH_HAVE_NMI_SAFE_CMPXCHG if ACPI_APEI_SEA select ARCH_USE_CMPXCHG_LOCKREF select ARCH_SUPPORTS_MEMORY_FAILURE select ARCH_SUPPORTS_LTO_CLANG select ARCH_SUPPORTS_ATOMIC_RMW select ARCH_SUPPORTS_NUMA_BALANCING select ARCH_WANT_COMPAT_IPC_PARSE_VERSION Loading Loading @@ -433,7 +434,7 @@ config ARM64_ERRATUM_845719 config ARM64_ERRATUM_843419 bool "Cortex-A53: 843419: A load or store might access an incorrect address" default y default y if !LTO_CLANG select ARM64_MODULE_CMODEL_LARGE if MODULES help This option links the kernel with '--fix-cortex-a53-843419' and Loading Loading @@ -1090,7 +1091,7 @@ config RANDOMIZE_BASE config RANDOMIZE_MODULE_REGION_FULL bool "Randomize the module region independently from the core kernel" depends on RANDOMIZE_BASE depends on RANDOMIZE_BASE && !LTO_CLANG default y help Randomizes the location of the module region without considering the Loading
arch/arm64/Makefile +21 −0 Original line number Diff line number Diff line Loading @@ -26,8 +26,17 @@ 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 ifeq ($(call gold-ifversion, -lt, 114000000, y), y) $(warning This version of GNU gold may generate incorrect code with --fix-cortex-a53-843419;\ see https://sourceware.org/bugzilla/show_bug.cgi?id=21491) endif LDFLAGS_vmlinux += --fix-cortex-a53-843419 endif else ifeq ($(ld-name),gold) # Pass --no-fix-cortex-a53-843419 to ensure the erratum fix is disabled LDFLAGS += --no-fix-cortex-a53-843419 endif endif KBUILD_DEFCONFIG := defconfig Loading Loading @@ -70,14 +79,22 @@ KBUILD_CPPFLAGS += -mbig-endian CHECKFLAGS += -D__AARCH64EB__ AS += -EB LD += -EB ifeq ($(ld-name),gold) LDFLAGS += -maarch64_elf64_be_vec else LDFLAGS += -maarch64linuxb endif UTS_MACHINE := aarch64_be else KBUILD_CPPFLAGS += -mlittle-endian CHECKFLAGS += -D__AARCH64EL__ AS += -EL LD += -EL ifeq ($(ld-name),gold) LDFLAGS += -maarch64_elf64_le_vec else LDFLAGS += -maarch64linux endif UTS_MACHINE := aarch64 endif Loading @@ -85,6 +102,10 @@ CHECKFLAGS += -D__aarch64__ -m64 ifeq ($(CONFIG_ARM64_MODULE_CMODEL_LARGE), y) KBUILD_CFLAGS_MODULE += -mcmodel=large ifeq ($(CONFIG_LTO_CLANG), y) # Code model is not stored in LLVM IR, so we need to pass it also to LLVMgold LDFLAGS += -plugin-opt=-code-model=large endif endif ifeq ($(CONFIG_ARM64_MODULE_PLTS),y) Loading