Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kbuild: require gcc-8 and binutils-2.30

Commit a3e8fe814ad1 ("x86/build: Raise the minimum GCC version to 8.1")
raised the minimum compiler version as enforced by Kbuild to gcc-8.1
and clang-15 for x86.

This is actually the same gcc version that has been discussed as the
minimum for all architectures several times in the past, with little
objection. A previous concern was the kernel for SLE15-SP7 needing to
be built with gcc-7. As this ended up still using linux-6.4 and there
is no plan for an SP8, this is no longer a problem.

Change it for all architectures and adjust the documentation accordingly.
A few version checks can be removed in the process. The binutils
version 2.30 is the lowest version used in combination with gcc-8 on
common distros, so use that as the corresponding minimum.

Link: https://lore.kernel.org/lkml/20240925150059.3955569-32-ardb+git@google.com/
Link: https://lore.kernel.org/lkml/871q7yxrgv.wl-tiwai@suse.de/
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+14 -72
+1 -1
Documentation/admin-guide/README.rst
··· 259 259 Compiling the kernel 260 260 -------------------- 261 261 262 - - Make sure you have at least gcc 5.1 available. 262 + - Make sure you have at least gcc 8.1 available. 263 263 For more information, refer to :ref:`Documentation/process/changes.rst <changes>`. 264 264 265 265 - Do a ``make`` to create a compressed kernel image. It is also possible to do
+2 -2
Documentation/kbuild/makefiles.rst
··· 625 625 626 626 Example:: 627 627 628 - cflags-$(call gcc-min-version, 70100) := -foo 628 + cflags-$(call gcc-min-version, 110100) := -foo 629 629 630 630 In this example, cflags-y will be assigned the value -foo if $(CC) is gcc and 631 - $(CONFIG_GCC_VERSION) is >= 7.1. 631 + $(CONFIG_GCC_VERSION) is >= 11.1. 632 632 633 633 clang-min-version 634 634 clang-min-version tests if the value of $(CONFIG_CLANG_VERSION) is greater
+2 -2
Documentation/process/changes.rst
··· 29 29 ====================== =============== ======================================== 30 30 Program Minimal version Command to check the version 31 31 ====================== =============== ======================================== 32 - GNU C 5.1 gcc --version 32 + GNU C 8.1 gcc --version 33 33 Clang/LLVM (optional) 13.0.1 clang --version 34 34 Rust (optional) 1.78.0 rustc --version 35 35 bindgen (optional) 0.65.1 bindgen --version 36 36 GNU make 4.0 make --version 37 37 bash 4.2 bash --version 38 - binutils 2.25 ld -v 38 + binutils 2.30 ld -v 39 39 flex 2.5.35 flex --version 40 40 bison 2.0 bison --version 41 41 pahole 1.16 pahole --version
+2 -2
Documentation/translations/it_IT/process/changes.rst
··· 32 32 ====================== ================= ======================================== 33 33 Programma Versione minima Comando per verificare la versione 34 34 ====================== ================= ======================================== 35 - GNU C 5.1 gcc --version 35 + GNU C 8.1 gcc --version 36 36 Clang/LLVM (optional) 13.0.0 clang --version 37 37 Rust (opzionale) 1.78.0 rustc --version 38 38 bindgen (opzionale) 0.65.1 bindgen --version 39 39 GNU make 4.0 make --version 40 40 bash 4.2 bash --version 41 - binutils 2.25 ld -v 41 + binutils 2.30 ld -v 42 42 flex 2.5.35 flex --version 43 43 bison 2.0 bison --version 44 44 pahole 1.16 pahole --version
+1 -1
Documentation/translations/zh_CN/admin-guide/README.rst
··· 224 224 编译内核 225 225 --------- 226 226 227 - - 确保您至少有gcc 5.1可用。 227 + - 确保您至少有gcc 8.1可用。 228 228 有关更多信息,请参阅 :ref:`Documentation/process/changes.rst <changes>` 。 229 229 230 230 - 执行 ``make`` 来创建压缩内核映像。如果您安装了lilo以适配内核makefile,
+1 -3
arch/um/Makefile
··· 118 118 $(Q)$(MAKE) $(build)=$(HOST_DIR)/um include/generated/user_constants.h 119 119 120 120 LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static 121 - ifdef CONFIG_LD_SCRIPT_DYN 122 - LINK-$(call gcc-min-version, 60100)$(CONFIG_CC_IS_CLANG) += -no-pie 123 - endif 121 + LINK-$(CONFIG_LD_SCRIPT_DYN) += -no-pie 124 122 LINK-$(CONFIG_LD_SCRIPT_DYN_RPATH) += -Wl,-rpath,/lib 125 123 126 124 CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,) \
+1 -3
include/linux/unroll.h
··· 11 11 12 12 #ifdef CONFIG_CC_IS_CLANG 13 13 #define __pick_unrolled(x, y) _Pragma(#x) 14 - #elif CONFIG_GCC_VERSION >= 80000 15 - #define __pick_unrolled(x, y) _Pragma(#y) 16 14 #else 17 - #define __pick_unrolled(x, y) /* not supported */ 15 + #define __pick_unrolled(x, y) _Pragma(#y) 18 16 #endif 19 17 20 18 /**
-4
kernel/gcov/gcc_4_7.c
··· 22 22 #define GCOV_COUNTERS 9 23 23 #elif (__GNUC__ >= 10) 24 24 #define GCOV_COUNTERS 8 25 - #elif (__GNUC__ >= 7) 26 - #define GCOV_COUNTERS 9 27 - #elif (__GNUC__ > 5) || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1) 28 - #define GCOV_COUNTERS 10 29 25 #else 30 26 #define GCOV_COUNTERS 9 31 27 #endif
+1 -4
lib/test_fortify/Makefile
··· 18 18 $(obj)/test_fortify.log: $(addprefix $(obj)/, $(logs)) FORCE 19 19 $(call if_changed,gen_fortify_log) 20 20 21 - # GCC<=7 does not always produce *.d files. 22 - # Run the tests only for GCC>=8 or Clang. 23 - always-$(call gcc-min-version, 80000) += test_fortify.log 24 - always-$(CONFIG_CC_IS_CLANG) += test_fortify.log 21 + always-y += test_fortify.log 25 22 26 23 # Some architectures define __NO_FORTIFY if __SANITIZE_ADDRESS__ is undefined. 27 24 # Pass CFLAGS_KASAN to avoid warnings.
+1 -1
scripts/Makefile.compiler
··· 60 60 cc-disable-warning = $(if $(call cc-option,-W$(strip $1)),-Wno-$(strip $1)) 61 61 62 62 # gcc-min-version 63 - # Usage: cflags-$(call gcc-min-version, 70100) += -foo 63 + # Usage: cflags-$(call gcc-min-version, 110100) += -foo 64 64 gcc-min-version = $(call test-ge, $(CONFIG_GCC_VERSION), $1) 65 65 66 66 # clang-min-version
-45
scripts/gcc-plugins/gcc-common.h
··· 3 3 #define GCC_COMMON_H_INCLUDED 4 4 5 5 #include "bversion.h" 6 - #if BUILDING_GCC_VERSION >= 6000 7 6 #include "gcc-plugin.h" 8 - #else 9 - #include "plugin.h" 10 - #endif 11 7 #include "plugin-version.h" 12 8 #include "config.h" 13 9 #include "system.h" ··· 35 39 36 40 #include "hash-map.h" 37 41 38 - #if BUILDING_GCC_VERSION >= 7000 39 42 #include "memmodel.h" 40 - #endif 41 43 #include "emit-rtl.h" 42 44 #include "debug.h" 43 45 #include "target.h" ··· 68 74 #include "context.h" 69 75 #include "tree-ssa-alias.h" 70 76 #include "tree-ssa.h" 71 - #if BUILDING_GCC_VERSION >= 7000 72 77 #include "tree-vrp.h" 73 - #endif 74 78 #include "tree-ssanames.h" 75 79 #include "print-tree.h" 76 80 #include "tree-eh.h" ··· 141 149 return g->get_passes()->get_pass_for_id(id); 142 150 } 143 151 144 - #if BUILDING_GCC_VERSION < 6000 145 - /* gimple related */ 146 - template <> 147 - template <> 148 - inline bool is_a_helper<const gassign *>::test(const_gimple gs) 149 - { 150 - return gs->code == GIMPLE_ASSIGN; 151 - } 152 - #endif 153 - 154 152 #define TODO_verify_ssa TODO_verify_il 155 153 #define TODO_verify_flow TODO_verify_il 156 154 #define TODO_verify_stmts TODO_verify_il ··· 163 181 #define varpool_get_node(decl) varpool_node::get(decl) 164 182 #define dump_varpool_node(file, node) (node)->dump(file) 165 183 166 - #if BUILDING_GCC_VERSION >= 8000 167 184 #define cgraph_create_edge(caller, callee, call_stmt, count, freq) \ 168 185 (caller)->create_edge((callee), (call_stmt), (count)) 169 186 ··· 170 189 old_call_stmt, call_stmt, count, freq, reason) \ 171 190 (caller)->create_edge_including_clones((callee), \ 172 191 (old_call_stmt), (call_stmt), (count), (reason)) 173 - #else 174 - #define cgraph_create_edge(caller, callee, call_stmt, count, freq) \ 175 - (caller)->create_edge((callee), (call_stmt), (count), (freq)) 176 - 177 - #define cgraph_create_edge_including_clones(caller, callee, \ 178 - old_call_stmt, call_stmt, count, freq, reason) \ 179 - (caller)->create_edge_including_clones((callee), \ 180 - (old_call_stmt), (call_stmt), (count), (freq), (reason)) 181 - #endif 182 192 183 193 typedef struct cgraph_node *cgraph_node_ptr; 184 194 typedef struct cgraph_edge *cgraph_edge_p; ··· 265 293 symtab->call_edge_duplication_hooks(cs1, cs2); 266 294 } 267 295 268 - #if BUILDING_GCC_VERSION >= 6000 269 296 typedef gimple *gimple_ptr; 270 297 typedef const gimple *const_gimple_ptr; 271 298 #define gimple gimple_ptr 272 299 #define const_gimple const_gimple_ptr 273 300 #undef CONST_CAST_GIMPLE 274 301 #define CONST_CAST_GIMPLE(X) CONST_CAST(gimple, (X)) 275 - #endif 276 302 277 303 /* gimple related */ 278 304 static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree lhs, tree op1, tree op2 MEM_STAT_DECL) ··· 370 400 referring_node->remove_stmt_references(stmt); 371 401 } 372 402 373 - #if BUILDING_GCC_VERSION < 6000 374 - #define get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep, keep_aligning) \ 375 - get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, pvolatilep, keep_aligning) 376 - #define gen_rtx_set(ARG0, ARG1) gen_rtx_SET(VOIDmode, (ARG0), (ARG1)) 377 - #endif 378 - 379 - #if BUILDING_GCC_VERSION >= 6000 380 403 #define gen_rtx_set(ARG0, ARG1) gen_rtx_SET((ARG0), (ARG1)) 381 - #endif 382 404 383 405 #ifdef __cplusplus 384 406 static inline void debug_tree(const_tree t) ··· 387 425 #define debug_gimple_stmt(s) debug_gimple_stmt(CONST_CAST_GIMPLE(s)) 388 426 #endif 389 427 390 - #if BUILDING_GCC_VERSION >= 7000 391 428 #define get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep, keep_aligning) \ 392 429 get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep) 393 - #endif 394 - 395 - #if BUILDING_GCC_VERSION < 7000 396 - #define SET_DECL_ALIGN(decl, align) DECL_ALIGN(decl) = (align) 397 - #define SET_DECL_MODE(decl, mode) DECL_MODE(decl) = (mode) 398 - #endif 399 430 400 431 #if BUILDING_GCC_VERSION >= 14000 401 432 #define last_stmt(x) last_nondebug_stmt(x)
+2 -4
scripts/min-tool-version.sh
··· 14 14 15 15 case "$1" in 16 16 binutils) 17 - echo 2.25.0 17 + echo 2.30.0 18 18 ;; 19 19 gcc) 20 20 if [ "$ARCH" = parisc64 ]; then 21 21 echo 12.0.0 22 - elif [ "$SRCARCH" = x86 ]; then 23 - echo 8.1.0 24 22 else 25 - echo 5.1.0 23 + echo 8.1.0 26 24 fi 27 25 ;; 28 26 llvm)