[gcc r17-2791] libstdc++: Fix grep for linker warning about --gc-sections [PR126452]
Jonathan Wakely
redi@gcc.gnu.org
Wed Jul 29 16:22:55 GMT 2026
https://gcc.gnu.org/g:b7ce998a967639b955159eeeae940cb069c518d8
commit r17-2791-gb7ce998a967639b955159eeeae940cb069c518d8
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>
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 7942ce0ffa21..8c44e618cb84 100644
--- 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
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 96e3298a28b7..577640fcb758 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -23173,8 +23173,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
@@ -29102,8 +29102,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
@@ -32236,8 +32236,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
@@ -38361,8 +38361,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
@@ -38652,8 +38652,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
@@ -39119,8 +39119,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
@@ -42516,8 +42516,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
@@ -45866,8 +45866,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
@@ -46082,8 +46082,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