https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126452
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Ah so the warning we're checking for isn't just that the option is
unrecognized.
So then maybe:
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -262,8 +262,8 @@ AC_DEFUN([GLIBCXX_CHECK_LINKER_FEATURES], [
rm -f conftest.c
touch conftest.c
if $CC -c conftest.c; then
- if $LD --gc-sections -o conftest conftest.o 2>&1 | \
- grep "Warning: gc-sections option ignored" > /dev/null; then
+ if LC_ALL=C $LD --gc-sections -o conftest conftest.o 2>&1 | \
+ grep "[Ww]arning: gc-sections option ignored" > /dev/null; then
ac_gcsections=no
fi
fi