FS#71212 - (linux-lts] gcc plugins compilation error with GCC 11

Attached to Project: Arch Linux
Opened by singe infini (singeinfini) - Thursday, 10 June 2021, 18:39 GMT
Last edited by Andreas Radke (AndyRTR) - Monday, 21 June 2021, 19:16 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Andreas Radke (AndyRTR)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No



When compiling a custom LTS kernel with CONFIG_GCC_PLUGINS and the latest version of gcc, the following check in "scripts/gcc-plugins/Kconfig" will fail:

depends on $(success,$(srctree)/scripts/gcc-plugin.sh $(CC))

causing the selected plugins not to be compiled.
This is due to the use of the C++98 standard which leads to incompatibility issues at compile time with GCC 11:

/usr/include/c++/11.1.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

Thus this is necessary to patch the "scripts/gcc-plugin.sh" file and the "scripts/gcc-plugins/Makefile" in order to be able to compile the plugins.

--- scripts/gcc-plugin.sh
+++ scripts/gcc-plugin.sh
@@ -11 +11 @@
-$HOSTCC -c -x c++ -std=gnu++98 - -fsyntax-only -I $srctree/gcc-plugins -I $gccplugins_dir/include 2>/dev/null <<EOF
+$HOSTCC -c -x c++ -std=gnu++11 - -fsyntax-only -I $srctree/gcc-plugins -I $gccplugins_dir/include 2>/dev/null <<EOF

--- scripts/gcc-plugins/Makefile
+++ scripts/gcc-plugins/Makefile
@@ -25 +25 @@
- -I $(GCC_PLUGINS_DIR)/include -I $(obj) -std=gnu++98 \
+ -I $(GCC_PLUGINS_DIR)/include -I $(obj) -std=gnu++11 \
@@ -27 +27 @@
- -ggdb -Wno-narrowing -Wno-unused-variable -Wno-c++11-compat \
+ -ggdb -Wno-narrowing -Wno-unused-variable \

Additional info:
This task depends upon

Closed by  Andreas Radke (AndyRTR)
Monday, 21 June 2021, 19:16 GMT
Reason for closing:  Upstream
Additional comments about closing:  and no response.
Comment by loqs (loqs) - Thursday, 10 June 2021, 21:46 GMT
Could you ask on the linux-stable mailing list for [1] to be applied to 5.10.Y?

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=67a5a68013056cbcf0a647e36cb6f4622fb6a470