linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] gcc-plugins: avoid errors with -std=gnu++11 on old gcc
@ 2021-03-08  8:40 Valdis Klētnieks
  2021-03-18  5:52 ` Kees Cook
  0 siblings, 1 reply; 9+ messages in thread
From: Valdis Klētnieks @ 2021-03-08  8:40 UTC (permalink / raw)
  To: Kees Cook, Josh Poimboeuf, Geert Uytterhoeven
  Cc: linux-hardening, Linux Kernel Mailing List

It turns out that older gcc (4.9 and 5.4) have gnu++11 support, but
due to a gcc bug fixed in gcc6, throw errors during the build.
The relevant gcc bug is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69959

Version the option based on what gcc we're using.

Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Fixes: 27c287b41659 ("gcc-plugins: fix gcc 11 indigestion with plugins...")
---
diff --git a/scripts/gcc-plugins/Makefile b/scripts/gcc-plugins/Makefile
index b5487cce69e8..cc779973724a 100644
--- a/scripts/gcc-plugins/Makefile
+++ b/scripts/gcc-plugins/Makefile
@@ -21,8 +21,11 @@ always-y += $(GCC_PLUGIN)
 
 GCC_PLUGINS_DIR = $(shell $(CC) -print-file-name=plugin)
 
+# need gnu++11 for gcc 11, but 4.9 and 5.4 need gnu++98
+GCC_FLAVOR = $(call cc-ifversion, -ge, 1100, 11, 98)
+
 plugin_cxxflags	= -Wp,-MMD,$(depfile) $(KBUILD_HOSTCXXFLAGS) -fPIC \
-		   -I $(GCC_PLUGINS_DIR)/include -I $(obj) -std=gnu++11 \
+		   -I $(GCC_PLUGINS_DIR)/include -I $(obj) -std=gnu++$(GCC_FLAVOR) \
 		   -fno-rtti -fno-exceptions -fasynchronous-unwind-tables \
 		   -ggdb -Wno-narrowing -Wno-unused-variable \
 		   -Wno-format-diag



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-03-18 13:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08  8:40 [PATCH RESEND] gcc-plugins: avoid errors with -std=gnu++11 on old gcc Valdis Klētnieks
2021-03-18  5:52 ` Kees Cook
2021-03-18  6:02   ` Valdis Klētnieks
2021-03-18  6:26     ` Miguel Ojeda
2021-03-18  9:07       ` Masahiro Yamada
2021-03-18 11:47         ` Valdis Klētnieks
2021-03-18 11:41     ` David Laight
2021-03-18 11:55       ` Valdis Klētnieks
2021-03-18 13:38         ` David Laight

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).