From 67d1991b785bdfef1d70cddfa0202b99b43ccce9 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 28 Sep 2022 13:37:31 +0930 Subject: egrep in binutils Apparently some distros have a nagging egrep that helpfully tells you egrep is deprecated and to use "grep -E". The nag message causes a ld testsuite failure. What's more the advice isn't that good. The "-E" flag may not be available with older versions of grep. This patch fixes bare invocation of egrep within binutils, replacing it with the autoconf $EGREP or with grep. config/ * lib-ld.m4 (AC_LIB_PROG_LD_GNU): Require AC_PROG_EGREP and invoke $EGREP. (AC_LIB_PROG_LD): Likewise. binutils/ * configure: Regenerate. * embedspu.sh: Replace egrep with grep. gold/ * testsuite/Makefile.am (flagstest_compress_debug_sections.check): Replace egrep with grep. * testsuite/Makefile.in: Regenerate. * testsuite/bnd_ifunc_1.sh: Replace egrep with $EGREP. * testsuite/bnd_ifunc_2.sh: Likewise. * testsuite/bnd_plt_1.sh: Likewise. * testsuite/discard_locals_test.sh: Likewise. * testsuite/gnu_property_test.sh: Likewise. * testsuite/no_version_test.sh: Likewise. * testsuite/pr18689.sh: Likewise. * testsuite/pr26936.sh: Likewise. * testsuite/retain.sh: Likewise. * testsuite/split_i386.sh: Likewise. * testsuite/split_s390.sh: Likewise. * testsuite/split_x32.sh: Likewise. * testsuite/split_x86_64.sh: Likewise. * testsuite/ver_test_pr16504.sh: Likewise. intl/ * configure: Regenerate. ld/ * testsuite/ld-elfvers/vers.exp (test_ar): Replace egrep with grep. --- gold/testsuite/Makefile.am | 2 +- gold/testsuite/Makefile.in | 2 +- gold/testsuite/bnd_ifunc_1.sh | 4 ++-- gold/testsuite/bnd_ifunc_2.sh | 2 +- gold/testsuite/bnd_plt_1.sh | 2 +- gold/testsuite/discard_locals_test.sh | 4 ++-- gold/testsuite/gnu_property_test.sh | 6 +++--- gold/testsuite/no_version_test.sh | 2 +- gold/testsuite/pr18689.sh | 2 +- gold/testsuite/pr26936.sh | 2 +- gold/testsuite/retain.sh | 2 +- gold/testsuite/split_i386.sh | 4 ++-- gold/testsuite/split_s390.sh | 4 ++-- gold/testsuite/split_x32.sh | 4 ++-- gold/testsuite/split_x86_64.sh | 4 ++-- gold/testsuite/ver_test_pr16504.sh | 2 +- 16 files changed, 24 insertions(+), 24 deletions(-) (limited to 'gold/testsuite') diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index b15000e..843fd0d 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -1702,7 +1702,7 @@ flagstest_compress_debug_sections.stdout: flagstest_compress_debug_sections # Check there are compressed DWARF .debug_* sections. flagstest_compress_debug_sections.check: flagstest_compress_debug_sections - $(TEST_READELF) -SW $< | egrep ".debug_.* C *" > $@.tmp + $(TEST_READELF) -SW $< | grep "\.debug_.* C" > $@.tmp mv -f $@.tmp $@ # Compare DWARF debug info. diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index 78bb0cc..21804df 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -8732,7 +8732,7 @@ uninstall-am: # Check there are compressed DWARF .debug_* sections. @GCC_TRUE@@NATIVE_LINKER_TRUE@flagstest_compress_debug_sections.check: flagstest_compress_debug_sections -@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -SW $< | egrep ".debug_.* C *" > $@.tmp +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -SW $< | grep "\.debug_.* C" > $@.tmp @GCC_TRUE@@NATIVE_LINKER_TRUE@ mv -f $@.tmp $@ # Compare DWARF debug info. diff --git a/gold/testsuite/bnd_ifunc_1.sh b/gold/testsuite/bnd_ifunc_1.sh index 64245be..b70f2f7 100755 --- a/gold/testsuite/bnd_ifunc_1.sh +++ b/gold/testsuite/bnd_ifunc_1.sh @@ -24,13 +24,13 @@ match() { - if ! egrep "$1" "$2" >/dev/null 2>&1; then + if ! $EGREP "$1" "$2" >/dev/null 2>&1; then echo 1>&2 "could not find '$1' in $2" exit 1 fi } match '[0-9a-f]*:.*bnd jmp \*0x[0-9a-f]*\(%rip\) *# [0-9a-f]* <_GLOBAL_OFFSET_TABLE_\+0x18>' bnd_ifunc_1.stdout -APLT_ADDR=$(egrep '[0-9a-f]*:.*bnd jmp \*0x[0-9a-f]*\(%rip\) *# [0-9a-f]* <_GLOBAL_OFFSET_TABLE_\+0x18>' bnd_ifunc_1.stdout | +APLT_ADDR=$($EGREP '[0-9a-f]*:.*bnd jmp \*0x[0-9a-f]*\(%rip\) *# [0-9a-f]* <_GLOBAL_OFFSET_TABLE_\+0x18>' bnd_ifunc_1.stdout | sed -e 's/ *\([0-9a-f]*\):.*/\1/') match "bnd call $APLT_ADDR" bnd_ifunc_1.stdout diff --git a/gold/testsuite/bnd_ifunc_2.sh b/gold/testsuite/bnd_ifunc_2.sh index d9f0e6d..b660553 100755 --- a/gold/testsuite/bnd_ifunc_2.sh +++ b/gold/testsuite/bnd_ifunc_2.sh @@ -24,7 +24,7 @@ match() { - if ! egrep "$1" "$2" >/dev/null 2>&1; then + if ! $EGREP "$1" "$2" >/dev/null 2>&1; then echo 1>&2 "could not find '$1' in $2" exit 1 fi diff --git a/gold/testsuite/bnd_plt_1.sh b/gold/testsuite/bnd_plt_1.sh index 5fde21e..b348905 100755 --- a/gold/testsuite/bnd_plt_1.sh +++ b/gold/testsuite/bnd_plt_1.sh @@ -24,7 +24,7 @@ match() { - if ! egrep "$1" "$2" >/dev/null 2>&1; then + if ! $EGREP "$1" "$2" >/dev/null 2>&1; then echo 1>&2 "could not find '$1' in $2" exit 1 fi diff --git a/gold/testsuite/discard_locals_test.sh b/gold/testsuite/discard_locals_test.sh index d89e3bd..2a0ab03 100755 --- a/gold/testsuite/discard_locals_test.sh +++ b/gold/testsuite/discard_locals_test.sh @@ -32,7 +32,7 @@ check_discarded() file=$1 sym=$2 - found=`egrep $sym $file` + found=`$EGREP $sym $file` if test -n "$found"; then echo "These local symbols are not discarded in $file:" echo "$found" @@ -45,7 +45,7 @@ check_non_discarded() file=$1 sym=$2 - found=`egrep $sym $file` + found=`$EGREP $sym $file` if test -z "$found"; then echo "This local symbol is discarded in $file:" echo "$2" diff --git a/gold/testsuite/gnu_property_test.sh b/gold/testsuite/gnu_property_test.sh index 1a3cae2..406ad20 100755 --- a/gold/testsuite/gnu_property_test.sh +++ b/gold/testsuite/gnu_property_test.sh @@ -55,16 +55,16 @@ check_count() check_alignment () { - if egrep -q "Class:[ \t]+ELF64" "$1" + if $EGREP -q "Class:[ \t]+ELF64" "$1" then align=8 else align=4 fi - if ! egrep -q ".note.gnu.property[ \t]+NOTE.*$align$" "$1" + if ! $EGREP -q ".note.gnu.property[ \t]+NOTE.*$align$" "$1" then echo "Wrong .note.gnu.property alignment in $1:" - egrep ".note.gnu.property[ \t]+NOTE.*$align" "$1" + $EGREP ".note.gnu.property[ \t]+NOTE.*$align" "$1" exit 1 fi } diff --git a/gold/testsuite/no_version_test.sh b/gold/testsuite/no_version_test.sh index 05488a6..7ac804b 100755 --- a/gold/testsuite/no_version_test.sh +++ b/gold/testsuite/no_version_test.sh @@ -32,7 +32,7 @@ check() { file=$1 - found=`egrep "\.gnu\.version.*" $file` + found=`$EGREP "\.gnu\.version.*" $file` if test -n "$found"; then echo "These section should not be in $file:" echo "$found" diff --git a/gold/testsuite/pr18689.sh b/gold/testsuite/pr18689.sh index d32fb38..b73496b 100755 --- a/gold/testsuite/pr18689.sh +++ b/gold/testsuite/pr18689.sh @@ -23,6 +23,6 @@ set -e -egrep -q "..debug_mac[ro|info][ ]+*" pr18689.stdout +$EGREP -q "..debug_mac[ro|info][ ]+*" pr18689.stdout exit 0 diff --git a/gold/testsuite/pr26936.sh b/gold/testsuite/pr26936.sh index 4c94f0f..2d52fc4 100755 --- a/gold/testsuite/pr26936.sh +++ b/gold/testsuite/pr26936.sh @@ -26,7 +26,7 @@ set -e check() { - number_of_occurrence=`egrep "$2" ./$1 -o| wc -l` + number_of_occurrence=`$EGREP "$2" ./$1 -o| wc -l` if [ $number_of_occurrence != $3 ] then echo "$1: \"$2\" $3: Failed" diff --git a/gold/testsuite/retain.sh b/gold/testsuite/retain.sh index 6e8a6f1..f981f77 100755 --- a/gold/testsuite/retain.sh +++ b/gold/testsuite/retain.sh @@ -25,7 +25,7 @@ set -e check() { - number_of_occurrence=`egrep "$2" ./$1 -o | wc -l` + number_of_occurrence=`$EGREP "$2" ./$1 -o | wc -l` if [ $number_of_occurrence != $3 ] then echo "$1: \"$2\" $3: Failed" diff --git a/gold/testsuite/split_i386.sh b/gold/testsuite/split_i386.sh index 058e15e..77d3bb7 100755 --- a/gold/testsuite/split_i386.sh +++ b/gold/testsuite/split_i386.sh @@ -24,7 +24,7 @@ match() { - if ! egrep "$1" "$2" >/dev/null 2>&1; then + if ! $EGREP "$1" "$2" >/dev/null 2>&1; then echo 1>&2 "could not find '$1' in $2" exit 1 fi @@ -32,7 +32,7 @@ match() nomatch() { - if egrep "$1" "$2" >/dev/null 2>&1; then + if $EGREP "$1" "$2" >/dev/null 2>&1; then echo 1>&2 "found unexpected '$1' in $2" exit 1 fi diff --git a/gold/testsuite/split_s390.sh b/gold/testsuite/split_s390.sh index 4b7ac3d..3a5b07b 100755 --- a/gold/testsuite/split_s390.sh +++ b/gold/testsuite/split_s390.sh @@ -24,7 +24,7 @@ match() { - if ! egrep "$1" "$2" >/dev/null 2>&1; then + if ! $EGREP "$1" "$2" >/dev/null 2>&1; then echo 1>&2 "could not find '$1' in $2" exit 1 fi @@ -32,7 +32,7 @@ match() nomatch() { - if egrep "$1" "$2" >/dev/null 2>&1; then + if $EGREP "$1" "$2" >/dev/null 2>&1; then echo 1>&2 "found unexpected '$1' in $2" exit 1 fi diff --git a/gold/testsuite/split_x32.sh b/gold/testsuite/split_x32.sh index 7b2968e..399a341 100755 --- a/gold/testsuite/split_x32.sh +++ b/gold/testsuite/split_x32.sh @@ -25,7 +25,7 @@ match() { - if ! egrep "$1" "$2" >/dev/null 2>&1; then + if ! $EGREP "$1" "$2" >/dev/null 2>&1; then echo 1>&2 "could not find '$1' in $2" exit 1 fi @@ -33,7 +33,7 @@ match() nomatch() { - if egrep "$1" "$2" >/dev/null 2>&1; then + if $EGREP "$1" "$2" >/dev/null 2>&1; then echo 1>&2 "found unexpected '$1' in $2" exit 1 fi diff --git a/gold/testsuite/split_x86_64.sh b/gold/testsuite/split_x86_64.sh index afaebc3..7f186e0 100755 --- a/gold/testsuite/split_x86_64.sh +++ b/gold/testsuite/split_x86_64.sh @@ -24,7 +24,7 @@ match() { - if ! egrep "$1" "$2" >/dev/null 2>&1; then + if ! $EGREP "$1" "$2" >/dev/null 2>&1; then echo 1>&2 "could not find '$1' in $2" exit 1 fi @@ -32,7 +32,7 @@ match() nomatch() { - if egrep "$1" "$2" >/dev/null 2>&1; then + if $EGREP "$1" "$2" >/dev/null 2>&1; then echo 1>&2 "found unexpected '$1' in $2" exit 1 fi diff --git a/gold/testsuite/ver_test_pr16504.sh b/gold/testsuite/ver_test_pr16504.sh index a8c2bdd..cb75d36 100755 --- a/gold/testsuite/ver_test_pr16504.sh +++ b/gold/testsuite/ver_test_pr16504.sh @@ -24,7 +24,7 @@ check() { - if ! egrep -q "$2" "$1" + if ! $EGREP -q "$2" "$1" then echo "Did not find expected symbol in $1:" echo " $2" -- cgit v1.1