Skip to contentSkip to conversation

gcc-plugins: fix gcc 11 indigestion with plugins...

PATCH Applied Valdis Klētnieks 4 participants 10 messages Dec 26, 2020 – Jan 11, 2021 Gcc plugins

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gcc-plugins: fix gcc 11 indigestion with plugins...

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.

scripts/gcc-plugins/Makefile +2 -2
index d66949bfeba4..b5487cce69e8 100644
@@ -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
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Valdis Klētnieks

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:
Quoted 8 lines

/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.

I'm also needing this.

Signature · 1 line
Josh
Applied
#2 lore raw
In reply to Valdis Klētnieks
Quoted 9 lines · Valdis Klētnieks

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:
Quoted 5 lines

/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 \

[...]

Applied to for-linus/gcc-plugins, thanks!

[1/1] gcc-plugins: fix gcc 11 indigestion with plugins...

      https://git.kernel.org/kees/c/67a5a6801305
Signature · 1 line
Kees Cook
#3 lore raw

Hi Kees, Valdis,

Quoted 14 lines · Kees Cook
Quoted 13 lines · Valdis Klētnieks

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 \

Quoted 6 lines
Quoted 1 line

[...]

Applied to for-linus/gcc-plugins, thanks!

[1/1] gcc-plugins: fix gcc 11 indigestion with plugins...

      https://git.kernel.org/kees/c/67a5a6801305

I guess this is the cause of the new "warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]" with gcc 4.9 or 5.4?

https://lore.kernel.org/lkml/[email protected]

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#4 lore raw
Quoted 3 lines · Geert Uytterhoeven

I guess this is the cause of the new "warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]" with gcc 4.9 or 5.4?

Well, we fixed a #error, and picked up a warning. That's progress. ;)

It's probably related. I'm just having a hard time understanding why 4.9 and 5.4 whine about the lack of a space, while 8.3 and 11 didn't complain...

I'll see if I can cook up a patch that newer gcc are still happy with. You able to easily test with 4.9 or 5.4?

#5 lore raw

Hi Valdis,

Quoted 5 lines · Valdis Klētnieks
Quoted 3 lines · Geert Uytterhoeven

I guess this is the cause of the new "warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]" with gcc 4.9 or 5.4?

Quoted 7 lines

Well, we fixed a #error, and picked up a warning. That's progress. ;)

It's probably related. I'm just having a hard time understanding why 4.9 and 5.4 whine about the lack of a space, while 8.3 and 11 didn't complain...

I'll see if I can cook up a patch that newer gcc are still happy with. You able to easily test with 4.9 or 5.4?

No, I don't have 4.9 or 5.4 cross-compilers anymore.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#6 lore raw
Quoted 2 lines · On Mon, 11 Jan 2021 05:56:59 -0500, I said:
Quoted 2 lines

It's probably related. I'm just having a hard time understanding why 4.9 and 5.4 whine about the lack of a space, while 8.3 and 11 didn't complain...

So after more digging, at least some clarity has surfaced.

It looks like it's not a kernel source tree issue, it's a g++ issue fixed in g++ 6 and later.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69959

And it looks like there was an intent to backport it to 4.9 and 5.4:
https://gcc.gnu.org/legacy-ml/gcc-patches/2016-02/msg01409.html

The bugtracker doesn't show an equivalent for 69959 being closed against 4.9.x or 5.[56],

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63254 has a patch for one of the gcc-supplied files that tosses the warning, but that way lies madness...

Not sure what we want to do here - the main alternatives I see are:

Tell people still using 4.9/5.4 to either live with the warning or upgrade to 6 or later

Make the flag a variable and pass either -std=gnu++98 or -std=gnu++11 depending on the output of 'g++ --version'

What say the peanut gallery?

#7 lore raw
Quoted 19 lines · Valdis Klētnieks
Quoted 2 lines · On Mon, 11 Jan 2021 05:56:59 -0500, I said:
Quoted 2 lines

It's probably related. I'm just having a hard time understanding why 4.9 and 5.4 whine about the lack of a space, while 8.3 and 11 didn't complain...

So after more digging, at least some clarity has surfaced.

It looks like it's not a kernel source tree issue, it's a g++ issue fixed in g++ 6 and later.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69959

And it looks like there was an intent to backport it to 4.9 and 5.4:
https://gcc.gnu.org/legacy-ml/gcc-patches/2016-02/msg01409.html

The bugtracker doesn't show an equivalent for 69959 being closed against 4.9.x or 5.[56],

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63254 has a patch for one of the gcc-supplied files that tosses the warning, but that way lies madness...

Quoted 8 lines

Not sure what we want to do here - the main alternatives I see are:

Tell people still using 4.9/5.4 to either live with the warning or upgrade to 6 or later

Make the flag a variable and pass either -std=gnu++98 or -std=gnu++11 depending on the output of 'g++ --version'

What say the peanut gallery?

I think putting the flag in a variable (based on call cc-ifversion) should be easy enough, then we can put this little saga behind us and pretend it never happened :-)

Signature · 1 line
Josh
#8 lore raw
Quoted 24 lines · Josh Poimboeuf
Quoted 23 lines · Valdis Klētnieks
Quoted 2 lines · On Mon, 11 Jan 2021 05:56:59 -0500, I said:
Quoted 2 lines

It's probably related. I'm just having a hard time understanding why 4.9 and 5.4 whine about the lack of a space, while 8.3 and 11 didn't complain...

So after more digging, at least some clarity has surfaced.

It looks like it's not a kernel source tree issue, it's a g++ issue fixed in g++ 6 and later.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69959

And it looks like there was an intent to backport it to 4.9 and 5.4:
https://gcc.gnu.org/legacy-ml/gcc-patches/2016-02/msg01409.html

The bugtracker doesn't show an equivalent for 69959 being closed against 4.9.x or 5.[56],

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63254 has a patch for one of the gcc-supplied files that tosses the warning, but that way lies madness...

Not sure what we want to do here - the main alternatives I see are:

Tell people still using 4.9/5.4 to either live with the warning or upgrade to 6 or later

Quoted 8 lines
Quoted 4 lines

Make the flag a variable and pass either -std=gnu++98 or -std=gnu++11 depending on the output of 'g++ --version'

What say the peanut gallery?

I think putting the flag in a variable (based on call cc-ifversion) should be easy enough, then we can put this little saga behind us and pretend it never happened :-)

Yeah, that seems best. Valdis, can you send a patch for this?

Signature · 1 line
Kees Cook
#9 lore raw
Quoted 7 lines · Kees Cook
Quoted 3 lines · Josh Poimboeuf

I think putting the flag in a variable (based on call cc-ifversion) should be easy enough, then we can put this little saga behind us and pretend it never happened :-)

Yeah, that seems best. Valdis, can you send a patch for this?

Yep, I'll send one shortly...