kbuild: require gcc-8 and binutils-2.30

Commit a3e8fe814a ("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>
This commit is contained in:
Arnd Bergmann 2025-03-28 18:21:44 +01:00
parent b4432656b3
commit 118c40b7b5
12 changed files with 14 additions and 72 deletions

View file

@ -259,7 +259,7 @@ Configuring the kernel
Compiling the kernel Compiling the kernel
-------------------- --------------------
- Make sure you have at least gcc 5.1 available. - Make sure you have at least gcc 8.1 available.
For more information, refer to :ref:`Documentation/process/changes.rst <changes>`. For more information, refer to :ref:`Documentation/process/changes.rst <changes>`.
- Do a ``make`` to create a compressed kernel image. It is also possible to do - Do a ``make`` to create a compressed kernel image. It is also possible to do

View file

@ -625,10 +625,10 @@ gcc-min-version
Example:: Example::
cflags-$(call gcc-min-version, 70100) := -foo cflags-$(call gcc-min-version, 110100) := -foo
In this example, cflags-y will be assigned the value -foo if $(CC) is gcc and In this example, cflags-y will be assigned the value -foo if $(CC) is gcc and
$(CONFIG_GCC_VERSION) is >= 7.1. $(CONFIG_GCC_VERSION) is >= 11.1.
clang-min-version clang-min-version
clang-min-version tests if the value of $(CONFIG_CLANG_VERSION) is greater clang-min-version tests if the value of $(CONFIG_CLANG_VERSION) is greater

View file

@ -29,13 +29,13 @@ you probably needn't concern yourself with pcmciautils.
====================== =============== ======================================== ====================== =============== ========================================
Program Minimal version Command to check the version Program Minimal version Command to check the version
====================== =============== ======================================== ====================== =============== ========================================
GNU C 5.1 gcc --version GNU C 8.1 gcc --version
Clang/LLVM (optional) 13.0.1 clang --version Clang/LLVM (optional) 13.0.1 clang --version
Rust (optional) 1.78.0 rustc --version Rust (optional) 1.78.0 rustc --version
bindgen (optional) 0.65.1 bindgen --version bindgen (optional) 0.65.1 bindgen --version
GNU make 4.0 make --version GNU make 4.0 make --version
bash 4.2 bash --version bash 4.2 bash --version
binutils 2.25 ld -v binutils 2.30 ld -v
flex 2.5.35 flex --version flex 2.5.35 flex --version
bison 2.0 bison --version bison 2.0 bison --version
pahole 1.16 pahole --version pahole 1.16 pahole --version

View file

@ -32,13 +32,13 @@ PC Card, per esempio, probabilmente non dovreste preoccuparvi di pcmciautils.
====================== ================= ======================================== ====================== ================= ========================================
Programma Versione minima Comando per verificare la versione Programma Versione minima Comando per verificare la versione
====================== ================= ======================================== ====================== ================= ========================================
GNU C 5.1 gcc --version GNU C 8.1 gcc --version
Clang/LLVM (optional) 13.0.0 clang --version Clang/LLVM (optional) 13.0.0 clang --version
Rust (opzionale) 1.78.0 rustc --version Rust (opzionale) 1.78.0 rustc --version
bindgen (opzionale) 0.65.1 bindgen --version bindgen (opzionale) 0.65.1 bindgen --version
GNU make 4.0 make --version GNU make 4.0 make --version
bash 4.2 bash --version bash 4.2 bash --version
binutils 2.25 ld -v binutils 2.30 ld -v
flex 2.5.35 flex --version flex 2.5.35 flex --version
bison 2.0 bison --version bison 2.0 bison --version
pahole 1.16 pahole --version pahole 1.16 pahole --version

View file

@ -224,7 +224,7 @@ Linux内核6.x版本 <http://kernel.org/>
编译内核 编译内核
--------- ---------
- 确保您至少有gcc 5.1可用。 - 确保您至少有gcc 8.1可用。
有关更多信息,请参阅 :ref:`Documentation/process/changes.rst <changes>` 有关更多信息,请参阅 :ref:`Documentation/process/changes.rst <changes>`
- 执行 ``make`` 来创建压缩内核映像。如果您安装了lilo以适配内核makefile - 执行 ``make`` 来创建压缩内核映像。如果您安装了lilo以适配内核makefile

View file

@ -118,9 +118,7 @@ archprepare:
$(Q)$(MAKE) $(build)=$(HOST_DIR)/um include/generated/user_constants.h $(Q)$(MAKE) $(build)=$(HOST_DIR)/um include/generated/user_constants.h
LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
ifdef CONFIG_LD_SCRIPT_DYN LINK-$(CONFIG_LD_SCRIPT_DYN) += -no-pie
LINK-$(call gcc-min-version, 60100)$(CONFIG_CC_IS_CLANG) += -no-pie
endif
LINK-$(CONFIG_LD_SCRIPT_DYN_RPATH) += -Wl,-rpath,/lib LINK-$(CONFIG_LD_SCRIPT_DYN_RPATH) += -Wl,-rpath,/lib
CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,) \ CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,) \

View file

@ -11,10 +11,8 @@
#ifdef CONFIG_CC_IS_CLANG #ifdef CONFIG_CC_IS_CLANG
#define __pick_unrolled(x, y) _Pragma(#x) #define __pick_unrolled(x, y) _Pragma(#x)
#elif CONFIG_GCC_VERSION >= 80000
#define __pick_unrolled(x, y) _Pragma(#y)
#else #else
#define __pick_unrolled(x, y) /* not supported */ #define __pick_unrolled(x, y) _Pragma(#y)
#endif #endif
/** /**

View file

@ -22,10 +22,6 @@
#define GCOV_COUNTERS 9 #define GCOV_COUNTERS 9
#elif (__GNUC__ >= 10) #elif (__GNUC__ >= 10)
#define GCOV_COUNTERS 8 #define GCOV_COUNTERS 8
#elif (__GNUC__ >= 7)
#define GCOV_COUNTERS 9
#elif (__GNUC__ > 5) || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
#define GCOV_COUNTERS 10
#else #else
#define GCOV_COUNTERS 9 #define GCOV_COUNTERS 9
#endif #endif

View file

@ -18,10 +18,7 @@ quiet_cmd_gen_fortify_log = CAT $@
$(obj)/test_fortify.log: $(addprefix $(obj)/, $(logs)) FORCE $(obj)/test_fortify.log: $(addprefix $(obj)/, $(logs)) FORCE
$(call if_changed,gen_fortify_log) $(call if_changed,gen_fortify_log)
# GCC<=7 does not always produce *.d files. always-y += test_fortify.log
# Run the tests only for GCC>=8 or Clang.
always-$(call gcc-min-version, 80000) += test_fortify.log
always-$(CONFIG_CC_IS_CLANG) += test_fortify.log
# Some architectures define __NO_FORTIFY if __SANITIZE_ADDRESS__ is undefined. # Some architectures define __NO_FORTIFY if __SANITIZE_ADDRESS__ is undefined.
# Pass CFLAGS_KASAN to avoid warnings. # Pass CFLAGS_KASAN to avoid warnings.

View file

@ -60,7 +60,7 @@ cc-option-yn = $(if $(call cc-option,$1),y,n)
cc-disable-warning = $(if $(call cc-option,-W$(strip $1)),-Wno-$(strip $1)) cc-disable-warning = $(if $(call cc-option,-W$(strip $1)),-Wno-$(strip $1))
# gcc-min-version # gcc-min-version
# Usage: cflags-$(call gcc-min-version, 70100) += -foo # Usage: cflags-$(call gcc-min-version, 110100) += -foo
gcc-min-version = $(call test-ge, $(CONFIG_GCC_VERSION), $1) gcc-min-version = $(call test-ge, $(CONFIG_GCC_VERSION), $1)
# clang-min-version # clang-min-version

View file

@ -3,11 +3,7 @@
#define GCC_COMMON_H_INCLUDED #define GCC_COMMON_H_INCLUDED
#include "bversion.h" #include "bversion.h"
#if BUILDING_GCC_VERSION >= 6000
#include "gcc-plugin.h" #include "gcc-plugin.h"
#else
#include "plugin.h"
#endif
#include "plugin-version.h" #include "plugin-version.h"
#include "config.h" #include "config.h"
#include "system.h" #include "system.h"
@ -39,9 +35,7 @@
#include "hash-map.h" #include "hash-map.h"
#if BUILDING_GCC_VERSION >= 7000
#include "memmodel.h" #include "memmodel.h"
#endif
#include "emit-rtl.h" #include "emit-rtl.h"
#include "debug.h" #include "debug.h"
#include "target.h" #include "target.h"
@ -74,9 +68,7 @@
#include "context.h" #include "context.h"
#include "tree-ssa-alias.h" #include "tree-ssa-alias.h"
#include "tree-ssa.h" #include "tree-ssa.h"
#if BUILDING_GCC_VERSION >= 7000
#include "tree-vrp.h" #include "tree-vrp.h"
#endif
#include "tree-ssanames.h" #include "tree-ssanames.h"
#include "print-tree.h" #include "print-tree.h"
#include "tree-eh.h" #include "tree-eh.h"
@ -149,16 +141,6 @@ static inline opt_pass *get_pass_for_id(int id)
return g->get_passes()->get_pass_for_id(id); return g->get_passes()->get_pass_for_id(id);
} }
#if BUILDING_GCC_VERSION < 6000
/* gimple related */
template <>
template <>
inline bool is_a_helper<const gassign *>::test(const_gimple gs)
{
return gs->code == GIMPLE_ASSIGN;
}
#endif
#define TODO_verify_ssa TODO_verify_il #define TODO_verify_ssa TODO_verify_il
#define TODO_verify_flow TODO_verify_il #define TODO_verify_flow TODO_verify_il
#define TODO_verify_stmts TODO_verify_il #define TODO_verify_stmts TODO_verify_il
@ -181,7 +163,6 @@ static inline const char *get_decl_section_name(const_tree decl)
#define varpool_get_node(decl) varpool_node::get(decl) #define varpool_get_node(decl) varpool_node::get(decl)
#define dump_varpool_node(file, node) (node)->dump(file) #define dump_varpool_node(file, node) (node)->dump(file)
#if BUILDING_GCC_VERSION >= 8000
#define cgraph_create_edge(caller, callee, call_stmt, count, freq) \ #define cgraph_create_edge(caller, callee, call_stmt, count, freq) \
(caller)->create_edge((callee), (call_stmt), (count)) (caller)->create_edge((callee), (call_stmt), (count))
@ -189,15 +170,6 @@ static inline const char *get_decl_section_name(const_tree decl)
old_call_stmt, call_stmt, count, freq, reason) \ old_call_stmt, call_stmt, count, freq, reason) \
(caller)->create_edge_including_clones((callee), \ (caller)->create_edge_including_clones((callee), \
(old_call_stmt), (call_stmt), (count), (reason)) (old_call_stmt), (call_stmt), (count), (reason))
#else
#define cgraph_create_edge(caller, callee, call_stmt, count, freq) \
(caller)->create_edge((callee), (call_stmt), (count), (freq))
#define cgraph_create_edge_including_clones(caller, callee, \
old_call_stmt, call_stmt, count, freq, reason) \
(caller)->create_edge_including_clones((callee), \
(old_call_stmt), (call_stmt), (count), (freq), (reason))
#endif
typedef struct cgraph_node *cgraph_node_ptr; typedef struct cgraph_node *cgraph_node_ptr;
typedef struct cgraph_edge *cgraph_edge_p; typedef struct cgraph_edge *cgraph_edge_p;
@ -293,14 +265,12 @@ static inline void cgraph_call_edge_duplication_hooks(cgraph_edge *cs1, cgraph_e
symtab->call_edge_duplication_hooks(cs1, cs2); symtab->call_edge_duplication_hooks(cs1, cs2);
} }
#if BUILDING_GCC_VERSION >= 6000
typedef gimple *gimple_ptr; typedef gimple *gimple_ptr;
typedef const gimple *const_gimple_ptr; typedef const gimple *const_gimple_ptr;
#define gimple gimple_ptr #define gimple gimple_ptr
#define const_gimple const_gimple_ptr #define const_gimple const_gimple_ptr
#undef CONST_CAST_GIMPLE #undef CONST_CAST_GIMPLE
#define CONST_CAST_GIMPLE(X) CONST_CAST(gimple, (X)) #define CONST_CAST_GIMPLE(X) CONST_CAST(gimple, (X))
#endif
/* gimple related */ /* gimple related */
static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree lhs, tree op1, tree op2 MEM_STAT_DECL) static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree lhs, tree op1, tree op2 MEM_STAT_DECL)
@ -400,15 +370,7 @@ static inline void ipa_remove_stmt_references(symtab_node *referring_node, gimpl
referring_node->remove_stmt_references(stmt); referring_node->remove_stmt_references(stmt);
} }
#if BUILDING_GCC_VERSION < 6000
#define get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep, keep_aligning) \
get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, pvolatilep, keep_aligning)
#define gen_rtx_set(ARG0, ARG1) gen_rtx_SET(VOIDmode, (ARG0), (ARG1))
#endif
#if BUILDING_GCC_VERSION >= 6000
#define gen_rtx_set(ARG0, ARG1) gen_rtx_SET((ARG0), (ARG1)) #define gen_rtx_set(ARG0, ARG1) gen_rtx_SET((ARG0), (ARG1))
#endif
#ifdef __cplusplus #ifdef __cplusplus
static inline void debug_tree(const_tree t) static inline void debug_tree(const_tree t)
@ -425,15 +387,8 @@ static inline void debug_gimple_stmt(const_gimple s)
#define debug_gimple_stmt(s) debug_gimple_stmt(CONST_CAST_GIMPLE(s)) #define debug_gimple_stmt(s) debug_gimple_stmt(CONST_CAST_GIMPLE(s))
#endif #endif
#if BUILDING_GCC_VERSION >= 7000
#define get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep, keep_aligning) \ #define get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep, keep_aligning) \
get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep) get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep)
#endif
#if BUILDING_GCC_VERSION < 7000
#define SET_DECL_ALIGN(decl, align) DECL_ALIGN(decl) = (align)
#define SET_DECL_MODE(decl, mode) DECL_MODE(decl) = (mode)
#endif
#if BUILDING_GCC_VERSION >= 14000 #if BUILDING_GCC_VERSION >= 14000
#define last_stmt(x) last_nondebug_stmt(x) #define last_stmt(x) last_nondebug_stmt(x)

View file

@ -14,15 +14,13 @@ fi
case "$1" in case "$1" in
binutils) binutils)
echo 2.25.0 echo 2.30.0
;; ;;
gcc) gcc)
if [ "$ARCH" = parisc64 ]; then if [ "$ARCH" = parisc64 ]; then
echo 12.0.0 echo 12.0.0
elif [ "$SRCARCH" = x86 ]; then
echo 8.1.0
else else
echo 5.1.0 echo 8.1.0
fi fi
;; ;;
llvm) llvm)