[gcc r14-12821] libstdc++: Fix grep for linker warning about --gc-sections [PR126452]
Jonathan Wakely
redi@gcc.gnu.org
Tue Aug 18 20:06:13 GMT 2026
https://gcc.gnu.org/g:5bd713d35f7af3954ea21ec3049ae126b50e99e6
commit r14-12821-g5bd713d35f7af3954ea21ec3049ae126b50e99e6
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed Jul 29 16:55:39 2026 +0100
libstdc++: Fix grep for linker warning about --gc-sections [PR126452]
Current versions of GNU ld print "warning" with a lowercase 'w' so
adjust the grep patter. Also use LC_ALL=C to ensure the warning isn't
translated.
Because m4 uses square brackets as quotes, we need to use double
brackets in the grep pattern to expand to "[Ww]" in the configure
script.
libstdc++-v3/ChangeLog:
PR libstdc++/126452
* acinclude.m4 (GLIBCXX_CHECK_LINKER_FEATURES): Use LC_ALL_C and
match both "Warning" and "warning" in ld output.
* configure: Regenerate.
Reviewed-by: Jakub Jelinek <jakub@redhat.com>
(cherry picked from commit b7ce998a967639b955159eeeae940cb069c518d8)
Diff:
---
libstdc++-v3/acinclude.m4 | 4 ++--
libstdc++-v3/configure | 36 ++++++++++++++++++------------------
2 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 51a08bcc8b1d..6ab5fa0c4527 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -253,8 +253,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
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 08d2a7a82591..af54b44a8eb4 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -23012,8 +23012,8 @@ rm -f core conftest.err conftest.$ac_objext \
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
@@ -28848,8 +28848,8 @@ rm -f core conftest.err conftest.$ac_objext \
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
@@ -32027,8 +32027,8 @@ rm -f core conftest.err conftest.$ac_objext \
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
@@ -38245,8 +38245,8 @@ rm -f core conftest.err conftest.$ac_objext \
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
@@ -38533,8 +38533,8 @@ rm -f core conftest.err conftest.$ac_objext \
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
@@ -38998,8 +38998,8 @@ rm -f core conftest.err conftest.$ac_objext \
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
@@ -42440,8 +42440,8 @@ rm -f core conftest.err conftest.$ac_objext \
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
@@ -45835,8 +45835,8 @@ rm -f core conftest.err conftest.$ac_objext \
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
@@ -46048,8 +46048,8 @@ rm -f core conftest.err conftest.$ac_objext \
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
More information about the Libstdc++-cvs
mailing list