]> git.pld-linux.org Git - packages/kernel.git/blame - gcc13.patch
- 4.14.334
[packages/kernel.git] / gcc13.patch
CommitLineData
f886d7b1
JP
1From e6a71160cc145e18ab45195abf89884112e02dfb Mon Sep 17 00:00:00 2001
2From: Kees Cook <keescook@chromium.org>
3Date: Wed, 18 Jan 2023 12:21:35 -0800
4Subject: gcc-plugins: Reorganize gimple includes for GCC 13
5
6The gimple-iterator.h header must be included before gimple-fold.h
7starting with GCC 13. Reorganize gimple headers to work for all GCC
8versions.
9
10Reported-by: Palmer Dabbelt <palmer@rivosinc.com>
11Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
12Link: https://lore.kernel.org/all/20230113173033.4380-1-palmer@rivosinc.com/
13Cc: linux-hardening@vger.kernel.org
14Signed-off-by: Kees Cook <keescook@chromium.org>
15---
16 scripts/gcc-plugins/gcc-common.h | 4 ++--
17 1 file changed, 2 insertions(+), 2 deletions(-)
18
19diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h
20index 9a1895747b153..84c730da36dd3 100644
21--- a/scripts/gcc-plugins/gcc-common.h
22+++ b/scripts/gcc-plugins/gcc-common.h
23@@ -71,7 +71,9 @@
24 #include "varasm.h"
25 #include "stor-layout.h"
26 #include "internal-fn.h"
27+#include "gimple.h"
28 #include "gimple-expr.h"
29+#include "gimple-iterator.h"
30 #include "gimple-fold.h"
31 #include "context.h"
32 #include "tree-ssa-alias.h"
33@@ -124,13 +126,10 @@
34 #include "gimplify.h"
35 #endif
36
37-#include "gimple.h"
38-
39 #if BUILDING_GCC_VERSION >= 4009
40 #include "tree-ssa-operands.h"
41 #include "tree-phinodes.h"
42 #include "tree-cfg.h"
43-#include "gimple-iterator.h"
44 #include "gimple-ssa.h"
45 #include "ssa-iterators.h"
46 #endif
47--
48cgit
49
f886d7b1
JP
50From 5a6b64adc18d9adfb497a529ff004d59b6df151f Mon Sep 17 00:00:00 2001
51From: Sam James <sam@gentoo.org>
52Date: Wed, 1 Feb 2023 23:00:09 +0000
53Subject: gcc-plugins: drop -std=gnu++11 to fix GCC 13 build
54
55The latest GCC 13 snapshot (13.0.1 20230129) gives the following:
56```
57cc1: error: cannot load plugin ./scripts/gcc-plugins/randomize_layout_plugin.so
58 :./scripts/gcc-plugins/randomize_layout_plugin.so: undefined symbol: tree_code_type
59```
60
61This ends up being because of https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=b0241ce6e37031
62upstream in GCC which changes the visibility of some types used by the kernel's
63plugin infrastructure like tree_code_type.
64
65After discussion with the GCC folks, we found that the kernel needs to be building
66plugins with the same flags used to build GCC - and GCC defaults to gnu++17
67right now. The minimum GCC version needed to build the kernel is GCC 5.1
68and GCC 5.1 already defaults to gnu++14 anyway, so just drop the flag, as
69all GCCs that could be used to build GCC already default to an acceptable
70version which was >= the version we forced via flags until now.
71
72Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108634
73Signed-off-by: Sam James <sam@gentoo.org>
74Signed-off-by: Kees Cook <keescook@chromium.org>
75Link: https://lore.kernel.org/r/20230201230009.2252783-1-sam@gentoo.org
76---
77 scripts/gcc-plugins/Makefile | 2 +-
78 1 file changed, 1 insertion(+), 1 deletion(-)
79
80diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile
81index b34d11e226366..320afd3cf8e82 100644
82--- a/scripts/gcc-plugins/Makefile
83+++ b/scripts/gcc-plugins/Makefile
84@@ -7,7 +7,7 @@
85 export HOST_EXTRACFLAGS
86 else
87 HOSTLIBS := hostcxxlibs
88- HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti
89+ HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -fno-rtti
90 HOST_EXTRACXXFLAGS += -fno-exceptions -fasynchronous-unwind-tables -ggdb
91 HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable
92 HOST_EXTRACXXFLAGS += -Wno-format-diag
93--
94cgit
95
This page took 0.106606 seconds and 4 git commands to generate.