Skip to content
/ linux Public

Commit 118c40b

Browse files
committedMay 1, 2025
kbuild: require gcc-8 and binutils-2.30
Commit a3e8fe8 ("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>
·
v6.17v6.16-rc1
1 parent b443265 commit 118c40b

File tree

12 files changed

+14
-72
lines changed

12 files changed

+14
-72
lines changed
 

‎Documentation/admin-guide/README.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ Configuring the kernel
259259
Compiling the kernel
260260
--------------------
261261

262-
- Make sure you have at least gcc 5.1 available.
262+
- Make sure you have at least gcc 8.1 available.
263263
For more information, refer to :ref:`Documentation/process/changes.rst <changes>`.
264264

265265
- Do a ``make`` to create a compressed kernel image. It is also possible to do

‎Documentation/kbuild/makefiles.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,10 +625,10 @@ gcc-min-version
625625

626626
Example::
627627

628-
cflags-$(call gcc-min-version, 70100) := -foo
628+
cflags-$(call gcc-min-version, 110100) := -foo
629629

630630
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.
632632

633633
clang-min-version
634634
clang-min-version tests if the value of $(CONFIG_CLANG_VERSION) is greater

‎Documentation/process/changes.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ you probably needn't concern yourself with pcmciautils.
2929
====================== =============== ========================================
3030
Program Minimal version Command to check the version
3131
====================== =============== ========================================
32-
GNU C 5.1 gcc --version
32+
GNU C 8.1 gcc --version
3333
Clang/LLVM (optional) 13.0.1 clang --version
3434
Rust (optional) 1.78.0 rustc --version
3535
bindgen (optional) 0.65.1 bindgen --version
3636
GNU make 4.0 make --version
3737
bash 4.2 bash --version
38-
binutils 2.25 ld -v
38+
binutils 2.30 ld -v
3939
flex 2.5.35 flex --version
4040
bison 2.0 bison --version
4141
pahole 1.16 pahole --version

‎Documentation/translations/it_IT/process/changes.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ PC Card, per esempio, probabilmente non dovreste preoccuparvi di pcmciautils.
3232
====================== ================= ========================================
3333
Programma Versione minima Comando per verificare la versione
3434
====================== ================= ========================================
35-
GNU C 5.1 gcc --version
35+
GNU C 8.1 gcc --version
3636
Clang/LLVM (optional) 13.0.0 clang --version
3737
Rust (opzionale) 1.78.0 rustc --version
3838
bindgen (opzionale) 0.65.1 bindgen --version
3939
GNU make 4.0 make --version
4040
bash 4.2 bash --version
41-
binutils 2.25 ld -v
41+
binutils 2.30 ld -v
4242
flex 2.5.35 flex --version
4343
bison 2.0 bison --version
4444
pahole 1.16 pahole --version

‎Documentation/translations/zh_CN/admin-guide/README.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ Linux内核6.x版本 <http://kernel.org/>
224224
编译内核
225225
---------
226226

227-
- 确保您至少有gcc 5.1可用。
227+
- 确保您至少有gcc 8.1可用。
228228
有关更多信息,请参阅 :ref:`Documentation/process/changes.rst <changes>` 。
229229

230230
- 执行 ``make`` 来创建压缩内核映像。如果您安装了lilo以适配内核makefile,

‎arch/um/Makefile‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,7 @@ archprepare:
118118
$(Q)$(MAKE) $(build)=$(HOST_DIR)/um include/generated/user_constants.h
119119

120120
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
124122
LINK-$(CONFIG_LD_SCRIPT_DYN_RPATH) += -Wl,-rpath,/lib
125123

126124
CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,) \

‎include/linux/unroll.h‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@
1111

1212
#ifdef CONFIG_CC_IS_CLANG
1313
#define __pick_unrolled(x, y) _Pragma(#x)
14-
#elif CONFIG_GCC_VERSION >= 80000
15-
#define __pick_unrolled(x, y) _Pragma(#y)
1614
#else
17-
#define __pick_unrolled(x, y) /* not supported */
15+
#define __pick_unrolled(x, y) _Pragma(#y)
1816
#endif
1917

2018
/**

‎kernel/gcov/gcc_4_7.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222
#define GCOV_COUNTERS 9
2323
#elif (__GNUC__ >= 10)
2424
#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
2925
#else
3026
#define GCOV_COUNTERS 9
3127
#endif

‎lib/test_fortify/Makefile‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ quiet_cmd_gen_fortify_log = CAT $@
1818
$(obj)/test_fortify.log: $(addprefix $(obj)/, $(logs)) FORCE
1919
$(call if_changed,gen_fortify_log)
2020

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
2522

2623
# Some architectures define __NO_FORTIFY if __SANITIZE_ADDRESS__ is undefined.
2724
# Pass CFLAGS_KASAN to avoid warnings.

‎scripts/Makefile.compiler‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ cc-option-yn = $(if $(call cc-option,$1),y,n)
6060
cc-disable-warning = $(if $(call cc-option,-W$(strip $1)),-Wno-$(strip $1))
6161

6262
# gcc-min-version
63-
# Usage: cflags-$(call gcc-min-version, 70100) += -foo
63+
# Usage: cflags-$(call gcc-min-version, 110100) += -foo
6464
gcc-min-version = $(call test-ge, $(CONFIG_GCC_VERSION), $1)
6565

6666
# clang-min-version

‎scripts/gcc-plugins/gcc-common.h‎

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
#define GCC_COMMON_H_INCLUDED
44

55
#include "bversion.h"
6-
#if BUILDING_GCC_VERSION >= 6000
76
#include "gcc-plugin.h"
8-
#else
9-
#include "plugin.h"
10-
#endif
117
#include "plugin-version.h"
128
#include "config.h"
139
#include "system.h"
@@ -39,9 +35,7 @@
3935

4036
#include "hash-map.h"
4137

42-
#if BUILDING_GCC_VERSION >= 7000
4338
#include "memmodel.h"
44-
#endif
4539
#include "emit-rtl.h"
4640
#include "debug.h"
4741
#include "target.h"
@@ -74,9 +68,7 @@
7468
#include "context.h"
7569
#include "tree-ssa-alias.h"
7670
#include "tree-ssa.h"
77-
#if BUILDING_GCC_VERSION >= 7000
7871
#include "tree-vrp.h"
79-
#endif
8072
#include "tree-ssanames.h"
8173
#include "print-tree.h"
8274
#include "tree-eh.h"
@@ -149,16 +141,6 @@ static inline opt_pass *get_pass_for_id(int id)
149141
return g->get_passes()->get_pass_for_id(id);
150142
}
151143

152-
#if BUILDING_GCC_VERSION < 6000
153-
/* gimple related */
154-
template <>
155-
template <>
156-
inline bool is_a_helper<const gassign *>::test(const_gimple gs)
157-
{
158-
return gs->code == GIMPLE_ASSIGN;
159-
}
160-
#endif
161-
162144
#define TODO_verify_ssa TODO_verify_il
163145
#define TODO_verify_flow TODO_verify_il
164146
#define TODO_verify_stmts TODO_verify_il
@@ -181,23 +163,13 @@ static inline const char *get_decl_section_name(const_tree decl)
181163
#define varpool_get_node(decl) varpool_node::get(decl)
182164
#define dump_varpool_node(file, node) (node)->dump(file)
183165

184-
#if BUILDING_GCC_VERSION >= 8000
185166
#define cgraph_create_edge(caller, callee, call_stmt, count, freq) \
186167
(caller)->create_edge((callee), (call_stmt), (count))
187168

188169
#define cgraph_create_edge_including_clones(caller, callee, \
189170
old_call_stmt, call_stmt, count, freq, reason) \
190171
(caller)->create_edge_including_clones((callee), \
191172
(old_call_stmt), (call_stmt), (count), (reason))
192-
#else
193-
#define cgraph_create_edge(caller, callee, call_stmt, count, freq) \
194-
(caller)->create_edge((callee), (call_stmt), (count), (freq))
195-
196-
#define cgraph_create_edge_including_clones(caller, callee, \
197-
old_call_stmt, call_stmt, count, freq, reason) \
198-
(caller)->create_edge_including_clones((callee), \
199-
(old_call_stmt), (call_stmt), (count), (freq), (reason))
200-
#endif
201173

202174
typedef struct cgraph_node *cgraph_node_ptr;
203175
typedef struct cgraph_edge *cgraph_edge_p;
@@ -293,14 +265,12 @@ static inline void cgraph_call_edge_duplication_hooks(cgraph_edge *cs1, cgraph_e
293265
symtab->call_edge_duplication_hooks(cs1, cs2);
294266
}
295267

296-
#if BUILDING_GCC_VERSION >= 6000
297268
typedef gimple *gimple_ptr;
298269
typedef const gimple *const_gimple_ptr;
299270
#define gimple gimple_ptr
300271
#define const_gimple const_gimple_ptr
301272
#undef CONST_CAST_GIMPLE
302273
#define CONST_CAST_GIMPLE(X) CONST_CAST(gimple, (X))
303-
#endif
304274

305275
/* gimple related */
306276
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
400370
referring_node->remove_stmt_references(stmt);
401371
}
402372

403-
#if BUILDING_GCC_VERSION < 6000
404-
#define get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep, keep_aligning) \
405-
get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, pvolatilep, keep_aligning)
406-
#define gen_rtx_set(ARG0, ARG1) gen_rtx_SET(VOIDmode, (ARG0), (ARG1))
407-
#endif
408-
409-
#if BUILDING_GCC_VERSION >= 6000
410373
#define gen_rtx_set(ARG0, ARG1) gen_rtx_SET((ARG0), (ARG1))
411-
#endif
412374

413375
#ifdef __cplusplus
414376
static inline void debug_tree(const_tree t)
@@ -425,15 +387,8 @@ static inline void debug_gimple_stmt(const_gimple s)
425387
#define debug_gimple_stmt(s) debug_gimple_stmt(CONST_CAST_GIMPLE(s))
426388
#endif
427389

428-
#if BUILDING_GCC_VERSION >= 7000
429390
#define get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep, keep_aligning) \
430391
get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep)
431-
#endif
432-
433-
#if BUILDING_GCC_VERSION < 7000
434-
#define SET_DECL_ALIGN(decl, align) DECL_ALIGN(decl) = (align)
435-
#define SET_DECL_MODE(decl, mode) DECL_MODE(decl) = (mode)
436-
#endif
437392

438393
#if BUILDING_GCC_VERSION >= 14000
439394
#define last_stmt(x) last_nondebug_stmt(x)

‎scripts/min-tool-version.sh‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@ fi
1414

1515
case "$1" in
1616
binutils)
17-
echo 2.25.0
17+
echo 2.30.0
1818
;;
1919
gcc)
2020
if [ "$ARCH" = parisc64 ]; then
2121
echo 12.0.0
22-
elif [ "$SRCARCH" = x86 ]; then
23-
echo 8.1.0
2422
else
25-
echo 5.1.0
23+
echo 8.1.0
2624
fi
2725
;;
2826
llvm)

0 commit comments

Comments
 (0)
Please sign in to comment.