]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Dec 2021 13:06:06 +0000 (14:06 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 Dec 2021 13:06:06 +0000 (14:06 +0100)
added patches:
gcc-plugins-fix-gcc-11-indigestion-with-plugins.patch
gcc-plugins-simplify-gcc-plugin-dev-capability-test.patch

queue-5.10/gcc-plugins-fix-gcc-11-indigestion-with-plugins.patch [new file with mode: 0644]
queue-5.10/gcc-plugins-simplify-gcc-plugin-dev-capability-test.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/gcc-plugins-fix-gcc-11-indigestion-with-plugins.patch b/queue-5.10/gcc-plugins-fix-gcc-11-indigestion-with-plugins.patch
new file mode 100644 (file)
index 0000000..3545eb2
--- /dev/null
@@ -0,0 +1,49 @@
+From 67a5a68013056cbcf0a647e36cb6f4622fb6a470 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Valdis=20Kl=C4=93tnieks?= <valdis.kletnieks@vt.edu>
+Date: Sat, 26 Dec 2020 13:21:58 -0500
+Subject: gcc-plugins: fix gcc 11 indigestion with plugins...
+
+From: Valdis Kletnieks <valdis.kletnieks@vt.edu>
+
+commit 67a5a68013056cbcf0a647e36cb6f4622fb6a470 upstream.
+
+Fedora Rawhide has started including gcc 11,and the g++ compiler
+throws a wobbly when it hits scripts/gcc-plugins:
+
+  HOSTCXX scripts/gcc-plugins/latent_entropy_plugin.so
+In file included from /usr/include/c++/11/type_traits:35,
+                 from /usr/lib/gcc/x86_64-redhat-linux/11/plugin/include/system.h:244,
+                 from /usr/lib/gcc/x86_64-redhat-linux/11/plugin/include/gcc-plugin.h:28,
+                 from scripts/gcc-plugins/gcc-common.h:7,
+                 from scripts/gcc-plugins/latent_entropy_plugin.c:78:
+/usr/include/c++/11/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.
+   32 | #error This file requires compiler and library support \
+
+In fact, it works just fine with c++11, which has been in gcc since 4.8,
+and we now require 4.9 as a minimum.
+
+Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
+Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Link: https://lore.kernel.org/r/82487.1609006918@turing-police
+Cc: Thomas Lindroth <thomas.lindroth@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ scripts/gcc-plugins/Makefile |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/scripts/gcc-plugins/Makefile
++++ b/scripts/gcc-plugins/Makefile
+@@ -22,9 +22,9 @@ always-y += $(GCC_PLUGIN)
+ 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 --git a/queue-5.10/gcc-plugins-simplify-gcc-plugin-dev-capability-test.patch b/queue-5.10/gcc-plugins-simplify-gcc-plugin-dev-capability-test.patch
new file mode 100644 (file)
index 0000000..85b368f
--- /dev/null
@@ -0,0 +1,84 @@
+From 1e860048c53ee77ee9870dcce94847a28544b753 Mon Sep 17 00:00:00 2001
+From: Masahiro Yamada <masahiroy@kernel.org>
+Date: Thu, 3 Dec 2020 21:57:00 +0900
+Subject: gcc-plugins: simplify GCC plugin-dev capability test
+
+From: Masahiro Yamada <masahiroy@kernel.org>
+
+commit 1e860048c53ee77ee9870dcce94847a28544b753 upstream.
+
+Linus pointed out a third of the time in the Kconfig parse stage comes
+from the single invocation of cc1plus in scripts/gcc-plugin.sh [1],
+and directly testing plugin-version.h for existence cuts down the
+overhead a lot. [2]
+
+This commit takes one step further to kill the build test entirely.
+
+The small piece of code was probably intended to test the C++ designated
+initializer, which was not supported until C++20.
+
+In fact, with -pedantic option given, both GCC and Clang emit a warning.
+
+$ echo 'class test { public: int test; } test = { .test = 1 };' | g++ -x c++ -pedantic - -fsyntax-only
+<stdin>:1:43: warning: C++ designated initializers only available with '-std=c++2a' or '-std=gnu++2a' [-Wpedantic]
+$ echo 'class test { public: int test; } test = { .test = 1 };' | clang++ -x c++ -pedantic - -fsyntax-only
+<stdin>:1:43: warning: designated initializers are a C++20 extension [-Wc++20-designator]
+class test { public: int test; } test = { .test = 1 };
+                                          ^
+1 warning generated.
+
+Otherwise, modern C++ compilers should be able to build the code, and
+hopefully skipping this test should not make any practical problem.
+
+Checking the existence of plugin-version.h is still needed to ensure
+the plugin-dev package is installed. The test code is now small enough
+to be embedded in scripts/gcc-plugins/Kconfig.
+
+[1] https://lore.kernel.org/lkml/CAHk-=wjU4DCuwQ4pXshRbwDCUQB31ScaeuDo1tjoZ0_PjhLHzQ@mail.gmail.com/
+[2] https://lore.kernel.org/lkml/CAHk-=whK0aQxs6Q5ijJmYF1n2ch8cVFSUzU5yUM_HOjig=+vnw@mail.gmail.com/
+
+Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Link: https://lore.kernel.org/r/20201203125700.161354-1-masahiroy@kernel.org
+Cc: Thomas Lindroth <thomas.lindroth@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ scripts/gcc-plugin.sh       |   19 -------------------
+ scripts/gcc-plugins/Kconfig |    2 +-
+ 2 files changed, 1 insertion(+), 20 deletions(-)
+ delete mode 100755 scripts/gcc-plugin.sh
+
+--- a/scripts/gcc-plugin.sh
++++ /dev/null
+@@ -1,19 +0,0 @@
+-#!/bin/sh
+-# SPDX-License-Identifier: GPL-2.0
+-
+-set -e
+-
+-srctree=$(dirname "$0")
+-
+-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 <<EOF
+-#include "gcc-common.h"
+-class test {
+-public:
+-      int test;
+-} test = {
+-      .test = 1
+-};
+-EOF
+--- a/scripts/gcc-plugins/Kconfig
++++ b/scripts/gcc-plugins/Kconfig
+@@ -9,7 +9,7 @@ menuconfig GCC_PLUGINS
+       bool "GCC plugins"
+       depends on HAVE_GCC_PLUGINS
+       depends on CC_IS_GCC
+-      depends on $(success,$(srctree)/scripts/gcc-plugin.sh $(CC))
++      depends on $(success,test -e $(shell,$(CC) -print-file-name=plugin)/include/plugin-version.h)
+       default y
+       help
+         GCC plugins are loadable modules that provide extra features to the
index 6c381b9261066663dc9231f37882b7b2736507ed..2578d715c25321dab9fcfaffc80c112db392c667 100644 (file)
@@ -1 +1,3 @@
 usb-gadget-uvc-fix-multiple-opens.patch
+gcc-plugins-simplify-gcc-plugin-dev-capability-test.patch
+gcc-plugins-fix-gcc-11-indigestion-with-plugins.patch