From 4ff8a225668ebbe901a333ea1d25ac6e5ccdd34e Mon Sep 17 00:00:00 2001 From: Arne Fitzenreiter Date: Wed, 30 Jun 2021 08:36:10 +0200 Subject: [PATCH] kernel: fix gcc plugin build with gcc-11 Signed-off-by: Arne Fitzenreiter --- lfs/linux | 3 +++ ...x-5.10.45-fix_gcc_plugins_with_gcc11.patch | 27 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 src/patches/linux/linux-5.10.45-fix_gcc_plugins_with_gcc11.patch diff --git a/lfs/linux b/lfs/linux index 303de77149..114936ad47 100644 --- a/lfs/linux +++ b/lfs/linux @@ -138,6 +138,9 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) # fix Boot with enabled usercopy hardening cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-5.9-crypto_testmgr_allocate_buffers_with____GFP_COMP.patch + # fix gcc plugins with gcc11 + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-5.10.45-fix_gcc_plugins_with_gcc11.patch + ifeq "$(BUILD_ARCH)" "armv6l" # Apply Arm-multiarch kernel patches. cd $(DIR_APP) && xzcat $(DIR_DL)/arm-multi-patches-$(ARM_PATCHES).patch.xz | patch -Np1 diff --git a/src/patches/linux/linux-5.10.45-fix_gcc_plugins_with_gcc11.patch b/src/patches/linux/linux-5.10.45-fix_gcc_plugins_with_gcc11.patch new file mode 100644 index 0000000000..f48239c6e6 --- /dev/null +++ b/src/patches/linux/linux-5.10.45-fix_gcc_plugins_with_gcc11.patch @@ -0,0 +1,27 @@ +diff -Naur linux-5.10.45.org/scripts/gcc-plugins/Makefile linux-5.10.45/scripts/gcc-plugins/Makefile +--- linux-5.10.45.org/scripts/gcc-plugins/Makefile 2021-06-18 10:00:06.000000000 +0200 ++++ linux-5.10.45/scripts/gcc-plugins/Makefile 2021-06-22 13:36:30.108527243 +0200 +@@ -22,9 +22,9 @@ + GCC_PLUGINS_DIR = $(shell $(CC) -print-file-name=plugin) + + plugin_cxxflags = -Wp,-MMD,$(depfile) $(KBUILD_HOSTCXXFLAGS) -fPIC \ +- -I $(GCC_PLUGINS_DIR)/include -I $(obj) -std=gnu++98 \ ++ -I $(GCC_PLUGINS_DIR)/include -I $(obj) -std=gnu++11 \ + -fno-rtti -fno-exceptions -fasynchronous-unwind-tables \ +- -ggdb -Wno-narrowing -Wno-unused-variable -Wno-c++11-compat \ ++ -ggdb -Wno-narrowing -Wno-unused-variable \ + -Wno-format-diag + + plugin_ldflags = -shared +diff -Naur linux-5.10.45.org/scripts/gcc-plugin.sh linux-5.10.45/scripts/gcc-plugin.sh +--- linux-5.10.45.org/scripts/gcc-plugin.sh 2021-06-18 10:00:06.000000000 +0200 ++++ linux-5.10.45/scripts/gcc-plugin.sh 2021-06-22 17:24:20.138602697 +0200 +@@ -8,7 +8,7 @@ + gccplugins_dir=$($* -print-file-name=plugin) + + # we need a c++ compiler that supports the designated initializer GNU extension +-$HOSTCC -c -x c++ -std=gnu++98 - -fsyntax-only -I $srctree/gcc-plugins -I $gccplugins_dir/include 2>/dev/null </dev/null <