Skip to content

Commit 5a6b64a

Browse files
thesamesamkees
authored andcommitted
gcc-plugins: drop -std=gnu++11 to fix GCC 13 build
The latest GCC 13 snapshot (13.0.1 20230129) gives the following: ``` cc1: error: cannot load plugin ./scripts/gcc-plugins/randomize_layout_plugin.so :./scripts/gcc-plugins/randomize_layout_plugin.so: undefined symbol: tree_code_type ``` This ends up being because of https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=b0241ce6e37031 upstream in GCC which changes the visibility of some types used by the kernel's plugin infrastructure like tree_code_type. After discussion with the GCC folks, we found that the kernel needs to be building plugins with the same flags used to build GCC - and GCC defaults to gnu++17 right now. The minimum GCC version needed to build the kernel is GCC 5.1 and GCC 5.1 already defaults to gnu++14 anyway, so just drop the flag, as all GCCs that could be used to build GCC already default to an acceptable version which was >= the version we forced via flags until now. Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108634 Signed-off-by: Sam James <[email protected]> Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a8c5540 commit 5a6b64a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/gcc-plugins/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ GCC_PLUGINS_DIR = $(shell $(CC) -print-file-name=plugin)
2929
plugin_cxxflags = -Wp,-MMD,$(depfile) $(KBUILD_HOSTCXXFLAGS) -fPIC \
3030
-include $(srctree)/include/linux/compiler-version.h \
3131
-DPLUGIN_VERSION=$(call stringify,$(KERNELVERSION)) \
32-
-I $(GCC_PLUGINS_DIR)/include -I $(obj) -std=gnu++11 \
32+
-I $(GCC_PLUGINS_DIR)/include -I $(obj) \
3333
-fno-rtti -fno-exceptions -fasynchronous-unwind-tables \
3434
-ggdb -Wno-narrowing -Wno-unused-variable \
3535
-Wno-format-diag

0 commit comments

Comments
 (0)