From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id 9DFDF3857BA6; Wed, 28 Sep 2022 04:34:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9DFDF3857BA6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1664339697; bh=J113D35FSie/9h4VlqCqsQs6a54b4zZWKKKydd/7FSw=; h=From:To:Subject:Date:From; b=ZJtLDg+VhYvmMQtkjYMfF3FbmL/QX6otGwyH8QLEhghbZTxPQcQM3x5EpufJksP/v 21xRRPv1PheIc0wlQ29/1yUOBbOoFj+bgkLf1dDcfkckNwZ1TkIHTHO5cuH5Y++7tQ MaWB4QYtrHRQAG2GnfSj6oPWiHF0l9Jj8v0pxoPo= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Alan Modra To: bfd-cvs@sourceware.org, gdb-cvs@sourceware.org Subject: [binutils-gdb] egrep in binutils X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/master X-Git-Oldrev: f8a8e1b263752d558c79f33ca0730ca23fb4450b X-Git-Newrev: 67d1991b785bdfef1d70cddfa0202b99b43ccce9 Message-Id: <20220928043457.9DFDF3857BA6@sourceware.org> Date: Wed, 28 Sep 2022 04:34:57 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D67d1991b785b= dfef1d70cddfa0202b99b43ccce9 commit 67d1991b785bdfef1d70cddfa0202b99b43ccce9 Author: Alan Modra Date: Wed Sep 28 13:37:31 2022 +0930 egrep in binutils =20 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. =20 This patch fixes bare invocation of egrep within binutils, replacing it with the autoconf $EGREP or with grep. =20 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.chec= k): 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 g= rep. Diff: --- binutils/configure | 4 ++-- binutils/embedspu.sh | 8 +++++--- config/lib-ld.m4 | 8 +++++--- 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 +- intl/configure | 4 ++-- ld/testsuite/ld-elfvers/vers.exp | 4 +++- 21 files changed, 41 insertions(+), 35 deletions(-) diff --git a/binutils/configure b/binutils/configure index 0d6bde7b4a5..7a45037a82f 100755 --- a/binutils/configure +++ b/binutils/configure @@ -13851,7 +13851,7 @@ else # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. - if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > = /dev/null; then + if "$acl_cv_path_LD" -v 2>&1 < /dev/null | $EGREP '(GNU|with BFD)' >= /dev/null; then test "$with_gnu_ld" !=3D no && break else test "$with_gnu_ld" !=3D yes && break @@ -13879,7 +13879,7 @@ if ${acl_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU ld's only accep= t -v. -if $LD -v 2>&1 &5; then +if $LD -v 2>&1 &5; then acl_cv_prog_gnu_ld=3Dyes else acl_cv_prog_gnu_ld=3Dno diff --git a/binutils/embedspu.sh b/binutils/embedspu.sh index 42fcd063371..361206f7d88 100644 --- a/binutils/embedspu.sh +++ b/binutils/embedspu.sh @@ -108,9 +108,11 @@ main () READELF=3D"$prog" =20 # Sanity check the input file - if ! ${READELF} -h ${INFILE} | grep 'Class:.*ELF32' >/dev/null 2>/dev/nu= ll \ - || ! ${READELF} -h ${INFILE} | grep 'Type:.*EXEC' >/dev/null 2>/dev/n= ull \ - || ! ${READELF} -h ${INFILE} | egrep 'Machine:.*(SPU|17)' >/dev/null = 2>/dev/null + match=3D"Class:.*ELF32 +Type:.*EXEC +Machine:.*SPU +Machine:.*17" + if test `${READELF} -h ${INFILE} | grep "${match}" | wc -l` !=3D 3 then echo "${INFILE}: Does not appear to be an SPU executable" exit 1 diff --git a/config/lib-ld.m4 b/config/lib-ld.m4 index 11d0ce77342..73cf9571b57 100644 --- a/config/lib-ld.m4 +++ b/config/lib-ld.m4 @@ -12,9 +12,10 @@ dnl with libtool.m4. =20 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. AC_DEFUN([AC_LIB_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, [# I'd rather use --version here, but apparently some GNU ld's only accept= -v. -if $LD -v 2>&1 &5; then +if $LD -v 2>&1 &5; then acl_cv_prog_gnu_ld=3Dyes else acl_cv_prog_gnu_ld=3Dno @@ -29,6 +30,7 @@ AC_DEFUN([AC_LIB_PROG_LD], test "$withval" =3D no || with_gnu_ld=3Dyes, with_gnu_ld=3Dno) AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_PROG_EGREP])dnl # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" !=3D set; then @@ -88,7 +90,7 @@ AC_CACHE_VAL(acl_cv_path_LD, # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. - if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > = /dev/null; then + if "$acl_cv_path_LD" -v 2>&1 < /dev/null | $EGREP '(GNU|with BFD)' >= /dev/null; then test "$with_gnu_ld" !=3D no && break else test "$with_gnu_ld" !=3D yes && break diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index b15000ee7f3..843fd0d197c 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -1702,7 +1702,7 @@ flagstest_compress_debug_sections.stdout: flagstest_c= ompress_debug_sections =20 # 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 $@ =20 # Compare DWARF debug info. diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index 78bb0cc7a26..21804df6573 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -8732,7 +8732,7 @@ uninstall-am: =20 # Check there are compressed DWARF .debug_* sections. @GCC_TRUE@@NATIVE_LINKER_TRUE@flagstest_compress_debug_sections.check: fla= gstest_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 $@ =20 # Compare DWARF debug info. diff --git a/gold/testsuite/bnd_ifunc_1.sh b/gold/testsuite/bnd_ifunc_1.sh index 64245bee964..b70f2f7d7d9 100755 --- a/gold/testsuite/bnd_ifunc_1.sh +++ b/gold/testsuite/bnd_ifunc_1.sh @@ -24,13 +24,13 @@ =20 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 } =20 match '[0-9a-f]*:.*bnd jmp \*0x[0-9a-f]*\(%rip\) *# [0-9a-f]* <_GLOBAL_OFF= SET_TABLE_\+0x18>' bnd_ifunc_1.stdout -APLT_ADDR=3D$(egrep '[0-9a-f]*:.*bnd jmp \*0x[0-9a-f]*\(%rip\) *# [0-9a-f]= * <_GLOBAL_OFFSET_TABLE_\+0x18>' bnd_ifunc_1.stdout | +APLT_ADDR=3D$($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 d9f0e6dd463..b660553a2b9 100755 --- a/gold/testsuite/bnd_ifunc_2.sh +++ b/gold/testsuite/bnd_ifunc_2.sh @@ -24,7 +24,7 @@ =20 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 5fde21edcd8..b3489056039 100755 --- a/gold/testsuite/bnd_plt_1.sh +++ b/gold/testsuite/bnd_plt_1.sh @@ -24,7 +24,7 @@ =20 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 d89e3bd4d3e..2a0ab036897 100755 --- a/gold/testsuite/discard_locals_test.sh +++ b/gold/testsuite/discard_locals_test.sh @@ -32,7 +32,7 @@ check_discarded() file=3D$1 sym=3D$2 =20 - found=3D`egrep $sym $file` + found=3D`$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=3D$1 sym=3D$2 =20 - found=3D`egrep $sym $file` + found=3D`$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_prope= rty_test.sh index 1a3cae27eb6..406ad205dbe 100755 --- a/gold/testsuite/gnu_property_test.sh +++ b/gold/testsuite/gnu_property_test.sh @@ -55,16 +55,16 @@ check_count() =20 check_alignment () { - if egrep -q "Class:[ \t]+ELF64" "$1" + if $EGREP -q "Class:[ \t]+ELF64" "$1" then align=3D8 else align=3D4 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 05488a60ad0..7ac804b7706 100755 --- a/gold/testsuite/no_version_test.sh +++ b/gold/testsuite/no_version_test.sh @@ -32,7 +32,7 @@ check() { file=3D$1 =20 - found=3D`egrep "\.gnu\.version.*" $file` + found=3D`$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 d32fb383c1e..b73496bd423 100755 --- a/gold/testsuite/pr18689.sh +++ b/gold/testsuite/pr18689.sh @@ -23,6 +23,6 @@ =20 set -e =20 -egrep -q "..debug_mac[ro|info][ ]+*" pr18689.stdout +$EGREP -q "..debug_mac[ro|info][ ]+*" pr18689.stdout =20 exit 0 diff --git a/gold/testsuite/pr26936.sh b/gold/testsuite/pr26936.sh index 4c94f0f4212..2d52fc4e008 100755 --- a/gold/testsuite/pr26936.sh +++ b/gold/testsuite/pr26936.sh @@ -26,7 +26,7 @@ set -e =20 check() { - number_of_occurrence=3D`egrep "$2" ./$1 -o| wc -l` + number_of_occurrence=3D`$EGREP "$2" ./$1 -o| wc -l` if [ $number_of_occurrence !=3D $3 ] then echo "$1: \"$2\" $3: Failed" diff --git a/gold/testsuite/retain.sh b/gold/testsuite/retain.sh index 6e8a6f1ac7b..f981f77e418 100755 --- a/gold/testsuite/retain.sh +++ b/gold/testsuite/retain.sh @@ -25,7 +25,7 @@ set -e =20 check() { - number_of_occurrence=3D`egrep "$2" ./$1 -o | wc -l` + number_of_occurrence=3D`$EGREP "$2" ./$1 -o | wc -l` if [ $number_of_occurrence !=3D $3 ] then echo "$1: \"$2\" $3: Failed" diff --git a/gold/testsuite/split_i386.sh b/gold/testsuite/split_i386.sh index 058e15eed32..77d3bb7db8b 100755 --- a/gold/testsuite/split_i386.sh +++ b/gold/testsuite/split_i386.sh @@ -24,7 +24,7 @@ =20 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() =20 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 4b7ac3d4a76..3a5b07bd9ac 100755 --- a/gold/testsuite/split_s390.sh +++ b/gold/testsuite/split_s390.sh @@ -24,7 +24,7 @@ =20 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() =20 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 7b2968e63d5..399a34110f0 100755 --- a/gold/testsuite/split_x32.sh +++ b/gold/testsuite/split_x32.sh @@ -25,7 +25,7 @@ =20 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() =20 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 afaebc31bed..7f186e0851c 100755 --- a/gold/testsuite/split_x86_64.sh +++ b/gold/testsuite/split_x86_64.sh @@ -24,7 +24,7 @@ =20 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() =20 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_p= r16504.sh index a8c2bddc593..cb75d366ebe 100755 --- a/gold/testsuite/ver_test_pr16504.sh +++ b/gold/testsuite/ver_test_pr16504.sh @@ -24,7 +24,7 @@ =20 check() { - if ! egrep -q "$2" "$1" + if ! $EGREP -q "$2" "$1" then echo "Did not find expected symbol in $1:" echo " $2" diff --git a/intl/configure b/intl/configure index 24fd69a97e0..e75f072f8fa 100755 --- a/intl/configure +++ b/intl/configure @@ -5085,7 +5085,7 @@ else # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. - if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > = /dev/null; then + if "$acl_cv_path_LD" -v 2>&1 < /dev/null | $EGREP '(GNU|with BFD)' >= /dev/null; then test "$with_gnu_ld" !=3D no && break else test "$with_gnu_ld" !=3D yes && break @@ -5113,7 +5113,7 @@ if ${acl_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU ld's only accep= t -v. -if $LD -v 2>&1 &5; then +if $LD -v 2>&1 &5; then acl_cv_prog_gnu_ld=3Dyes else acl_cv_prog_gnu_ld=3Dno diff --git a/ld/testsuite/ld-elfvers/vers.exp b/ld/testsuite/ld-elfvers/ver= s.exp index f6d47262318..9af6bb9fd92 100644 --- a/ld/testsuite/ld-elfvers/vers.exp +++ b/ld/testsuite/ld-elfvers/vers.exp @@ -109,7 +109,9 @@ proc test_ar { test lib object expect } { return } =20 - set cmd "$nm --print-armap $tmpdir/$lib | grep \\\ in\\\ | egrep VERS= \\\|bar\\\|foo | grep -v ^\\\\. | sort > $tmpdir/nm.out" + set cmd "$nm --print-armap $tmpdir/$lib | grep \" in \" | grep \"VERS +bar +foo\" | grep -v ^\\\\. | sort > $tmpdir/nm.out" verbose -log $cmd catch "exec $cmd" exec_output if [string match "" $exec_output] then {