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. --- binutils/configure | 4 ++-- binutils/embedspu.sh | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'binutils') diff --git a/binutils/configure b/binutils/configure index 0d6bde7..7a45037 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" != no && break else test "$with_gnu_ld" != 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 accept -v. -if $LD -v 2>&1 &5; then +if $LD -v 2>&1 &5; then acl_cv_prog_gnu_ld=yes else acl_cv_prog_gnu_ld=no diff --git a/binutils/embedspu.sh b/binutils/embedspu.sh index 42fcd06..361206f 100644 --- a/binutils/embedspu.sh +++ b/binutils/embedspu.sh @@ -108,9 +108,11 @@ main () READELF="$prog" # Sanity check the input file - if ! ${READELF} -h ${INFILE} | grep 'Class:.*ELF32' >/dev/null 2>/dev/null \ - || ! ${READELF} -h ${INFILE} | grep 'Type:.*EXEC' >/dev/null 2>/dev/null \ - || ! ${READELF} -h ${INFILE} | egrep 'Machine:.*(SPU|17)' >/dev/null 2>/dev/null + match="Class:.*ELF32 +Type:.*EXEC +Machine:.*SPU +Machine:.*17" + if test `${READELF} -h ${INFILE} | grep "${match}" | wc -l` != 3 then echo "${INFILE}: Does not appear to be an SPU executable" exit 1 -- cgit v1.1