public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH REVIEW] libtool.m4: fix the NM="/nm/over/here -B/option/with/path" case
@ 2022-03-21 18:25 Nick Alcock
  2022-03-24 14:12 ` Nick Clifton
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Alcock @ 2022-03-21 18:25 UTC (permalink / raw)
  To: binutils

My previous nm patch handled all cases but one -- if the user set NM in
the environment to a path which contained an option, libtool's nm
detection tries to run nm against a copy of nm with the options in it:
e.g. if NM was set to "nm --blargle", and nm was found in /usr/bin, the
test would try to run "/usr/bin/nm --blargle /usr/bin/nm --blargle".
This is unlikely to be desirable: in this case we should run
"/usr/bin/nm --blargle /usr/bin/nm".

Furthermore, as part of this nm has to detect when the passed-in $NM
contains a path, and in that case avoid doing a path search itself.
This too was thrown off if an option contained something that looked
like a path, e.g. NM="nm -B../prev-gcc"; libtool then tries to run
"nm -B../prev-gcc nm" which rarely works well (and indeed it looks
to see whether that nm exists, finds it doesn't, and wrongly concludes
that nm -p or whatever does not work).

Fix all of these by clipping all options (defined as everything
including and after the first " -") before deciding whether nm
contains a path (but not using the clipped value for anything else),
and then removing all options from the path-modified nm before
looking to see whether that nm existed.

NM=my-nm now does a path search and runs e.g.
  /usr/bin/my-nm -B /usr/bin/my-nm

NM=/usr/bin/my-nm now avoids a path search and runs e.g.
  /usr/bin/my-nm -B /usr/bin/my-nm

NM="my-nm -p../wombat" now does a path search and runs e.g.
  /usr/bin/my-nm -p../wombat -B /usr/bin/my-nm

NM="../prev-binutils/new-nm -B../prev-gcc" now avoids a path search:
  ../prev-binutils/my-nm -B../prev-gcc -B ../prev-binutils/my-nm

This seems to be all combinations, including those used by GCC bootstrap
(which, before this commit, fails to bootstrap when configured
--with-build-config=bootstrap-lto, because the lto plugin is now using
--export-symbols-regex, which requires libtool to find a working nm,
while also using -B../prev-gcc to point at the lto plugin associated
with the GCC just built.)

Regenerate all affected configure scripts.

	* libtool.m4 (LT_PATH_NM): Handle user-specified NM with
	options, including options containing paths.
---
 bfd/configure          |  20 +++--
 binutils/configure     |  20 +++--
 gas/configure          |  20 +++--
 gprof/configure        |  20 +++--
 gprofng/configure      |  20 +++--
 ld/configure           |  20 +++--
 libbacktrace/configure | 175 ++++++++++++++++++++++++-----------------
 libctf/configure       |  20 +++--
 libtool.m4             |  16 ++--
 opcodes/configure      |  20 +++--
 sim/configure          |  20 +++--
 zlib/configure         |  20 +++--
 12 files changed, 244 insertions(+), 147 deletions(-)

The "previous patch" was some time ago, so, for reference, this is
commit bef9ef8ca0f941d743c77cc55b5fe7985990b2a7.  (I can't put that in
the commit message, because when this hits GCC -- which this is work
towards -- that commit ID will be different.)

diff --git a/bfd/configure b/bfd/configure
index 0ef4c206fb0..9ed314f5afd 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -5409,25 +5409,31 @@ else
      lt_nm_to_check="$lt_nm_to_check nm"
    fi
  fi
- for lt_tmp_nm in $lt_nm_to_check; do
+ for lt_tmp_nm in "$lt_nm_to_check"; do
    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
      IFS="$lt_save_ifs"
      test -z "$ac_dir" && ac_dir=.
-     case "$lt_tmp_nm" in
+     # Strip out any user-provided options from the nm to test twice,
+     # the first time to test to see if nm (rather than its options) has
+     # an explicit path, the second time to yield a file which can be
+     # nm'ed itself.
+     tmp_nm_path="`$ECHO "$lt_tmp_nm" | sed 's, -.*$,,'`"
+     case "$tmp_nm_path" in
      */*|*\\*) tmp_nm="$lt_tmp_nm";;
      *) tmp_nm="$ac_dir/$lt_tmp_nm";;
      esac
-     if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+     tmp_nm_to_nm="`$ECHO "$tmp_nm" | sed 's, -.*$,,'`"
+     if test -f "$tmp_nm_to_nm" || test -f "$tmp_nm_to_nm$ac_exeext" ; then
        # Check to see if the nm accepts a BSD-compat flag.
        # Adding the `sed 1q' prevents false positives on HP-UX, which says:
        #   nm: unknown option "B" ignored
-       case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+       case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
        *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
 	 break
 	 ;;
        *)
-	 case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+	 case `"$tmp_nm" -p "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
 	 *$tmp_nm*)
 	   lt_cv_path_NM="$tmp_nm -p"
 	   break
@@ -11086,7 +11092,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11089 "configure"
+#line 11095 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11192,7 +11198,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11195 "configure"
+#line 11201 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/binutils/configure b/binutils/configure
index f3ad831ad38..7afa9c471ce 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -5273,25 +5273,31 @@ else
      lt_nm_to_check="$lt_nm_to_check nm"
    fi
  fi
- for lt_tmp_nm in $lt_nm_to_check; do
+ for lt_tmp_nm in "$lt_nm_to_check"; do
    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
      IFS="$lt_save_ifs"
      test -z "$ac_dir" && ac_dir=.
-     case "$lt_tmp_nm" in
+     # Strip out any user-provided options from the nm to test twice,
+     # the first time to test to see if nm (rather than its options) has
+     # an explicit path, the second time to yield a file which can be
+     # nm'ed itself.
+     tmp_nm_path="`$ECHO "$lt_tmp_nm" | sed 's, -.*$,,'`"
+     case "$tmp_nm_path" in
      */*|*\\*) tmp_nm="$lt_tmp_nm";;
      *) tmp_nm="$ac_dir/$lt_tmp_nm";;
      esac
-     if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+     tmp_nm_to_nm="`$ECHO "$tmp_nm" | sed 's, -.*$,,'`"
+     if test -f "$tmp_nm_to_nm" || test -f "$tmp_nm_to_nm$ac_exeext" ; then
        # Check to see if the nm accepts a BSD-compat flag.
        # Adding the `sed 1q' prevents false positives on HP-UX, which says:
        #   nm: unknown option "B" ignored
-       case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+       case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
        *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
 	 break
 	 ;;
        *)
-	 case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+	 case `"$tmp_nm" -p "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
 	 *$tmp_nm*)
 	   lt_cv_path_NM="$tmp_nm -p"
 	   break
@@ -10981,7 +10987,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10984 "configure"
+#line 10990 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11087,7 +11093,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11090 "configure"
+#line 11096 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gas/configure b/gas/configure
index 94455667917..1fae77adea0 100755
--- a/gas/configure
+++ b/gas/configure
@@ -4988,25 +4988,31 @@ else
      lt_nm_to_check="$lt_nm_to_check nm"
    fi
  fi
- for lt_tmp_nm in $lt_nm_to_check; do
+ for lt_tmp_nm in "$lt_nm_to_check"; do
    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
      IFS="$lt_save_ifs"
      test -z "$ac_dir" && ac_dir=.
-     case "$lt_tmp_nm" in
+     # Strip out any user-provided options from the nm to test twice,
+     # the first time to test to see if nm (rather than its options) has
+     # an explicit path, the second time to yield a file which can be
+     # nm'ed itself.
+     tmp_nm_path="`$ECHO "$lt_tmp_nm" | sed 's, -.*$,,'`"
+     case "$tmp_nm_path" in
      */*|*\\*) tmp_nm="$lt_tmp_nm";;
      *) tmp_nm="$ac_dir/$lt_tmp_nm";;
      esac
-     if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+     tmp_nm_to_nm="`$ECHO "$tmp_nm" | sed 's, -.*$,,'`"
+     if test -f "$tmp_nm_to_nm" || test -f "$tmp_nm_to_nm$ac_exeext" ; then
        # Check to see if the nm accepts a BSD-compat flag.
        # Adding the `sed 1q' prevents false positives on HP-UX, which says:
        #   nm: unknown option "B" ignored
-       case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+       case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
        *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
 	 break
 	 ;;
        *)
-	 case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+	 case `"$tmp_nm" -p "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
 	 *$tmp_nm*)
 	   lt_cv_path_NM="$tmp_nm -p"
 	   break
@@ -10696,7 +10702,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10699 "configure"
+#line 10705 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10802,7 +10808,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10805 "configure"
+#line 10811 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gprof/configure b/gprof/configure
index 8cb3921c34f..41a26629653 100755
--- a/gprof/configure
+++ b/gprof/configure
@@ -4890,25 +4890,31 @@ else
      lt_nm_to_check="$lt_nm_to_check nm"
    fi
  fi
- for lt_tmp_nm in $lt_nm_to_check; do
+ for lt_tmp_nm in "$lt_nm_to_check"; do
    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
      IFS="$lt_save_ifs"
      test -z "$ac_dir" && ac_dir=.
-     case "$lt_tmp_nm" in
+     # Strip out any user-provided options from the nm to test twice,
+     # the first time to test to see if nm (rather than its options) has
+     # an explicit path, the second time to yield a file which can be
+     # nm'ed itself.
+     tmp_nm_path="`$ECHO "$lt_tmp_nm" | sed 's, -.*$,,'`"
+     case "$tmp_nm_path" in
      */*|*\\*) tmp_nm="$lt_tmp_nm";;
      *) tmp_nm="$ac_dir/$lt_tmp_nm";;
      esac
-     if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+     tmp_nm_to_nm="`$ECHO "$tmp_nm" | sed 's, -.*$,,'`"
+     if test -f "$tmp_nm_to_nm" || test -f "$tmp_nm_to_nm$ac_exeext" ; then
        # Check to see if the nm accepts a BSD-compat flag.
        # Adding the `sed 1q' prevents false positives on HP-UX, which says:
        #   nm: unknown option "B" ignored
-       case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+       case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
        *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
 	 break
 	 ;;
        *)
-	 case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+	 case `"$tmp_nm" -p "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
 	 *$tmp_nm*)
 	   lt_cv_path_NM="$tmp_nm -p"
 	   break
@@ -10598,7 +10604,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10601 "configure"
+#line 10607 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10704,7 +10710,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10707 "configure"
+#line 10713 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gprofng/configure b/gprofng/configure
index bd52fd940fd..747304be691 100755
--- a/gprofng/configure
+++ b/gprofng/configure
@@ -6458,25 +6458,31 @@ else
      lt_nm_to_check="$lt_nm_to_check nm"
    fi
  fi
- for lt_tmp_nm in $lt_nm_to_check; do
+ for lt_tmp_nm in "$lt_nm_to_check"; do
    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
      IFS="$lt_save_ifs"
      test -z "$ac_dir" && ac_dir=.
-     case "$lt_tmp_nm" in
+     # Strip out any user-provided options from the nm to test twice,
+     # the first time to test to see if nm (rather than its options) has
+     # an explicit path, the second time to yield a file which can be
+     # nm'ed itself.
+     tmp_nm_path="`$ECHO "$lt_tmp_nm" | sed 's, -.*$,,'`"
+     case "$tmp_nm_path" in
      */*|*\\*) tmp_nm="$lt_tmp_nm";;
      *) tmp_nm="$ac_dir/$lt_tmp_nm";;
      esac
-     if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+     tmp_nm_to_nm="`$ECHO "$tmp_nm" | sed 's, -.*$,,'`"
+     if test -f "$tmp_nm_to_nm" || test -f "$tmp_nm_to_nm$ac_exeext" ; then
        # Check to see if the nm accepts a BSD-compat flag.
        # Adding the `sed 1q' prevents false positives on HP-UX, which says:
        #   nm: unknown option "B" ignored
-       case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+       case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
        *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
 	 break
 	 ;;
        *)
-	 case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+	 case `"$tmp_nm" -p "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
 	 *$tmp_nm*)
 	   lt_cv_path_NM="$tmp_nm -p"
 	   break
@@ -12137,7 +12143,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12140 "configure"
+#line 12146 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12243,7 +12249,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12246 "configure"
+#line 12252 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/ld/configure b/ld/configure
index 034fe373106..bab2d083ca8 100755
--- a/ld/configure
+++ b/ld/configure
@@ -5745,25 +5745,31 @@ else
      lt_nm_to_check="$lt_nm_to_check nm"
    fi
  fi
- for lt_tmp_nm in $lt_nm_to_check; do
+ for lt_tmp_nm in "$lt_nm_to_check"; do
    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
      IFS="$lt_save_ifs"
      test -z "$ac_dir" && ac_dir=.
-     case "$lt_tmp_nm" in
+     # Strip out any user-provided options from the nm to test twice,
+     # the first time to test to see if nm (rather than its options) has
+     # an explicit path, the second time to yield a file which can be
+     # nm'ed itself.
+     tmp_nm_path="`$ECHO "$lt_tmp_nm" | sed 's, -.*$,,'`"
+     case "$tmp_nm_path" in
      */*|*\\*) tmp_nm="$lt_tmp_nm";;
      *) tmp_nm="$ac_dir/$lt_tmp_nm";;
      esac
-     if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+     tmp_nm_to_nm="`$ECHO "$tmp_nm" | sed 's, -.*$,,'`"
+     if test -f "$tmp_nm_to_nm" || test -f "$tmp_nm_to_nm$ac_exeext" ; then
        # Check to see if the nm accepts a BSD-compat flag.
        # Adding the `sed 1q' prevents false positives on HP-UX, which says:
        #   nm: unknown option "B" ignored
-       case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+       case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
        *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
 	 break
 	 ;;
        *)
-	 case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+	 case `"$tmp_nm" -p "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
 	 *$tmp_nm*)
 	   lt_cv_path_NM="$tmp_nm -p"
 	   break
@@ -11454,7 +11460,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11457 "configure"
+#line 11463 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11560,7 +11566,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11563 "configure"
+#line 11569 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libbacktrace/configure b/libbacktrace/configure
index a2f33c0f35d..406b67b8cbc 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -5818,48 +5818,55 @@ if ${lt_cv_path_NM+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$NM"; then
-  # Let the user override the test.
-  lt_cv_path_NM="$NM"
-else
-  lt_nm_to_check="${ac_tool_prefix}nm"
-  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
-    lt_nm_to_check="$lt_nm_to_check nm"
-  fi
-  for lt_tmp_nm in $lt_nm_to_check; do
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
-      IFS="$lt_save_ifs"
-      test -z "$ac_dir" && ac_dir=.
-      tmp_nm="$ac_dir/$lt_tmp_nm"
-      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
-	# Check to see if the nm accepts a BSD-compat flag.
-	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
-	#   nm: unknown option "B" ignored
-	# Tru64's nm complains that /dev/null is an invalid object file
-	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
-	*/dev/null* | *'Invalid file or object type'*)
-	  lt_cv_path_NM="$tmp_nm -B"
-	  break
-	  ;;
-	*)
-	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
-	  */dev/null*)
-	    lt_cv_path_NM="$tmp_nm -p"
-	    break
-	    ;;
-	  *)
-	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
-	    continue # so that we can try to find one that supports BSD flags
-	    ;;
-	  esac
-	  ;;
-	esac
-      fi
-    done
-    IFS="$lt_save_ifs"
-  done
-  : ${lt_cv_path_NM=no}
-fi
+   # Let the user override the nm to test.
+   lt_nm_to_check="$NM"
+ else
+   lt_nm_to_check="${ac_tool_prefix}nm"
+   if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+     lt_nm_to_check="$lt_nm_to_check nm"
+   fi
+ fi
+ for lt_tmp_nm in "$lt_nm_to_check"; do
+   lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+   for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+     IFS="$lt_save_ifs"
+     test -z "$ac_dir" && ac_dir=.
+     # Strip out any user-provided options from the nm to test twice,
+     # the first time to test to see if nm (rather than its options) has
+     # an explicit path, the second time to yield a file which can be
+     # nm'ed itself.
+     tmp_nm_path="`$ECHO "$lt_tmp_nm" | sed 's, -.*$,,'`"
+     case "$tmp_nm_path" in
+     */*|*\\*) tmp_nm="$lt_tmp_nm";;
+     *) tmp_nm="$ac_dir/$lt_tmp_nm";;
+     esac
+     tmp_nm_to_nm="`$ECHO "$tmp_nm" | sed 's, -.*$,,'`"
+     if test -f "$tmp_nm_to_nm" || test -f "$tmp_nm_to_nm$ac_exeext" ; then
+       # Check to see if the nm accepts a BSD-compat flag.
+       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+       #   nm: unknown option "B" ignored
+       case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+       *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
+	 break
+	 ;;
+       *)
+	 case `"$tmp_nm" -p "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+	 *$tmp_nm*)
+	   lt_cv_path_NM="$tmp_nm -p"
+	   break
+	   ;;
+	 *)
+	   lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	   continue # so that we can try to find one that supports BSD flags
+	   ;;
+	 esac
+	 ;;
+       esac
+     fi
+   done
+   IFS="$lt_save_ifs"
+ done
+ : ${lt_cv_path_NM=no}
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
 $as_echo "$lt_cv_path_NM" >&6; }
@@ -6480,7 +6487,7 @@ irix5* | irix6* | nonstopux*)
   ;;
 
 # This must be Linux ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu | uclinuxfdpiceabi)
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
@@ -6576,6 +6583,19 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
 
 
 
+plugin_option=
+plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll"
+for plugin in $plugin_names; do
+  plugin_so=`${CC} ${CFLAGS} --print-prog-name $plugin`
+  if test x$plugin_so = x$plugin; then
+    plugin_so=`${CC} ${CFLAGS} --print-file-name $plugin`
+  fi
+  if test x$plugin_so != x$plugin; then
+    plugin_option="--plugin $plugin_so"
+    break
+  fi
+done
+
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ar; ac_word=$2
@@ -6669,6 +6689,19 @@ else
 fi
 
 test -z "$AR" && AR=ar
+if test -n "$plugin_option"; then
+  if $AR --help 2>&1 | grep -q "\--plugin"; then
+    touch conftest.c
+    $AR $plugin_option rc conftest.a conftest.c
+    if test "$?" != 0; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Failed: $AR $plugin_option rc" >&5
+$as_echo "$as_me: WARNING: Failed: $AR $plugin_option rc" >&2;}
+    else
+      AR="$AR $plugin_option"
+    fi
+    rm -f conftest.*
+  fi
+fi
 test -z "$AR_FLAGS" && AR_FLAGS=cru
 
 
@@ -6873,6 +6906,11 @@ else
 fi
 
 test -z "$RANLIB" && RANLIB=:
+if test -n "$plugin_option" && test "$RANLIB" != ":"; then
+  if $RANLIB --help 2>&1 | grep -q "\--plugin"; then
+    RANLIB="$RANLIB $plugin_option"
+  fi
+fi
 
 
 
@@ -6987,7 +7025,7 @@ osf*)
   symcode='[BCDEGQRST]'
   ;;
 solaris*)
-  symcode='[BDRT]'
+  symcode='[BCDRT]'
   ;;
 sco3.2v5*)
   symcode='[DT]'
@@ -7986,25 +8024,23 @@ _LT_EOF
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
 $as_echo "$lt_cv_ld_force_load" >&6; }
-    # Allow for Darwin 4-7 (macOS 10.0-10.3) although these are not expect to
-    # build without first building modern cctools / linker.
-    case $host_cpu-$host_os in
-    *-rhapsody* | *-darwin1.[012])
+    case $host_os in
+    rhapsody* | darwin1.[012])
       _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
-    *-darwin1.*)
+    darwin1.*)
       _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-    *-darwin*)
-      # darwin 5.x (macOS 10.1) onwards we only need to adjust when the
-      # deployment target is forced to an earlier version.
-      case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
-	UNSET,*-darwin[89]*|UNSET,*-darwin[12][0123456789]*)
-	  ;;
+    darwin*) # darwin 5.x on
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+	10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
 	10.[012][,.]*)
-	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
-	  ;;
-	*)
-	  ;;
-     esac
+	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+	10.*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
     ;;
   esac
     if test "$lt_cv_apple_cc_single_mod" = "yes"; then
@@ -9294,7 +9330,7 @@ _LT_EOF
       archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
 
-    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu | uclinuxfdpiceabi)
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
       tmp_diet=no
       if test "$host_os" = linux-dietlibc; then
 	case $cc_basename in
@@ -9803,7 +9839,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       if test "$GCC" = yes && test "$with_gnu_ld" = no; then
 	case $host_cpu in
 	hppa*64*)
-	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	ia64*)
 	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
@@ -9815,7 +9851,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
       else
 	case $host_cpu in
 	hppa*64*)
-	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	ia64*)
 	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
@@ -10708,7 +10744,7 @@ haiku*)
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
 
@@ -10815,12 +10851,7 @@ linux*oldld* | linux*aout* | linux*coff*)
   ;;
 
 # This must be Linux ELF.
-
-# uclinux* changes (here and below) have been submitted to the libtool
-# project, but have not yet been accepted: they are GCC-local changes
-# for the time being.  (See
-# https://lists.gnu.org/archive/html/libtool-patches/2018-05/msg00000.html)
-linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu* | uclinuxfdpiceabi)
+linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -11509,7 +11540,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11512 "configure"
+#line 11543 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11615,7 +11646,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11618 "configure"
+#line 11649 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libctf/configure b/libctf/configure
index c56ac218213..8704bc215f4 100755
--- a/libctf/configure
+++ b/libctf/configure
@@ -5951,25 +5951,31 @@ else
      lt_nm_to_check="$lt_nm_to_check nm"
    fi
  fi
- for lt_tmp_nm in $lt_nm_to_check; do
+ for lt_tmp_nm in "$lt_nm_to_check"; do
    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
      IFS="$lt_save_ifs"
      test -z "$ac_dir" && ac_dir=.
-     case "$lt_tmp_nm" in
+     # Strip out any user-provided options from the nm to test twice,
+     # the first time to test to see if nm (rather than its options) has
+     # an explicit path, the second time to yield a file which can be
+     # nm'ed itself.
+     tmp_nm_path="`$ECHO "$lt_tmp_nm" | sed 's, -.*$,,'`"
+     case "$tmp_nm_path" in
      */*|*\\*) tmp_nm="$lt_tmp_nm";;
      *) tmp_nm="$ac_dir/$lt_tmp_nm";;
      esac
-     if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+     tmp_nm_to_nm="`$ECHO "$tmp_nm" | sed 's, -.*$,,'`"
+     if test -f "$tmp_nm_to_nm" || test -f "$tmp_nm_to_nm$ac_exeext" ; then
        # Check to see if the nm accepts a BSD-compat flag.
        # Adding the `sed 1q' prevents false positives on HP-UX, which says:
        #   nm: unknown option "B" ignored
-       case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+       case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
        *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
 	 break
 	 ;;
        *)
-	 case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+	 case `"$tmp_nm" -p "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
 	 *$tmp_nm*)
 	   lt_cv_path_NM="$tmp_nm -p"
 	   break
@@ -11629,7 +11635,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11632 "configure"
+#line 11638 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11735,7 +11741,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11738 "configure"
+#line 11744 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/libtool.m4 b/libtool.m4
index a216bb14e99..ad63ebbb385 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -3214,25 +3214,31 @@ AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
      lt_nm_to_check="$lt_nm_to_check nm"
    fi
  fi
- for lt_tmp_nm in $lt_nm_to_check; do
+ for lt_tmp_nm in "$lt_nm_to_check"; do
    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
      IFS="$lt_save_ifs"
      test -z "$ac_dir" && ac_dir=.
-     case "$lt_tmp_nm" in
+     # Strip out any user-provided options from the nm to test twice,
+     # the first time to test to see if nm (rather than its options) has
+     # an explicit path, the second time to yield a file which can be
+     # nm'ed itself.
+     tmp_nm_path="`$ECHO "$lt_tmp_nm" | sed 's, -.*$,,'`"
+     case "$tmp_nm_path" in
      */*|*\\*) tmp_nm="$lt_tmp_nm";;
      *) tmp_nm="$ac_dir/$lt_tmp_nm";;
      esac
-     if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+     tmp_nm_to_nm="`$ECHO "$tmp_nm" | sed 's, -.*$,,'`"
+     if test -f "$tmp_nm_to_nm" || test -f "$tmp_nm_to_nm$ac_exeext" ; then
        # Check to see if the nm accepts a BSD-compat flag.
        # Adding the `sed 1q' prevents false positives on HP-UX, which says:
        #   nm: unknown option "B" ignored
-       case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+       case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
        *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
 	 break
 	 ;;
        *)
-	 case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+	 case `"$tmp_nm" -p "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
 	 *$tmp_nm*)
 	   lt_cv_path_NM="$tmp_nm -p"
 	   break
diff --git a/opcodes/configure b/opcodes/configure
index c98c5bcd0d1..740d54153ca 100755
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -5357,25 +5357,31 @@ else
      lt_nm_to_check="$lt_nm_to_check nm"
    fi
  fi
- for lt_tmp_nm in $lt_nm_to_check; do
+ for lt_tmp_nm in "$lt_nm_to_check"; do
    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
      IFS="$lt_save_ifs"
      test -z "$ac_dir" && ac_dir=.
-     case "$lt_tmp_nm" in
+     # Strip out any user-provided options from the nm to test twice,
+     # the first time to test to see if nm (rather than its options) has
+     # an explicit path, the second time to yield a file which can be
+     # nm'ed itself.
+     tmp_nm_path="`$ECHO "$lt_tmp_nm" | sed 's, -.*$,,'`"
+     case "$tmp_nm_path" in
      */*|*\\*) tmp_nm="$lt_tmp_nm";;
      *) tmp_nm="$ac_dir/$lt_tmp_nm";;
      esac
-     if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+     tmp_nm_to_nm="`$ECHO "$tmp_nm" | sed 's, -.*$,,'`"
+     if test -f "$tmp_nm_to_nm" || test -f "$tmp_nm_to_nm$ac_exeext" ; then
        # Check to see if the nm accepts a BSD-compat flag.
        # Adding the `sed 1q' prevents false positives on HP-UX, which says:
        #   nm: unknown option "B" ignored
-       case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+       case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
        *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
 	 break
 	 ;;
        *)
-	 case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+	 case `"$tmp_nm" -p "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
 	 *$tmp_nm*)
 	   lt_cv_path_NM="$tmp_nm -p"
 	   break
@@ -11035,7 +11041,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11038 "configure"
+#line 11044 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11141,7 +11147,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11144 "configure"
+#line 11150 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/sim/configure b/sim/configure
index 02a3fa5bb3c..fae9facc887 100755
--- a/sim/configure
+++ b/sim/configure
@@ -6014,25 +6014,31 @@ else
      lt_nm_to_check="$lt_nm_to_check nm"
    fi
  fi
- for lt_tmp_nm in $lt_nm_to_check; do
+ for lt_tmp_nm in "$lt_nm_to_check"; do
    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
      IFS="$lt_save_ifs"
      test -z "$ac_dir" && ac_dir=.
-     case "$lt_tmp_nm" in
+     # Strip out any user-provided options from the nm to test twice,
+     # the first time to test to see if nm (rather than its options) has
+     # an explicit path, the second time to yield a file which can be
+     # nm'ed itself.
+     tmp_nm_path="`$ECHO "$lt_tmp_nm" | sed 's, -.*$,,'`"
+     case "$tmp_nm_path" in
      */*|*\\*) tmp_nm="$lt_tmp_nm";;
      *) tmp_nm="$ac_dir/$lt_tmp_nm";;
      esac
-     if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+     tmp_nm_to_nm="`$ECHO "$tmp_nm" | sed 's, -.*$,,'`"
+     if test -f "$tmp_nm_to_nm" || test -f "$tmp_nm_to_nm$ac_exeext" ; then
        # Check to see if the nm accepts a BSD-compat flag.
        # Adding the `sed 1q' prevents false positives on HP-UX, which says:
        #   nm: unknown option "B" ignored
-       case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+       case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
        *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
 	 break
 	 ;;
        *)
-	 case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+	 case `"$tmp_nm" -p "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
 	 *$tmp_nm*)
 	   lt_cv_path_NM="$tmp_nm -p"
 	   break
@@ -12635,7 +12641,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12638 "configure"
+#line 12644 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12741,7 +12747,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12744 "configure"
+#line 12750 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/zlib/configure b/zlib/configure
index db7845c5d42..e65ade3badd 100755
--- a/zlib/configure
+++ b/zlib/configure
@@ -4696,25 +4696,31 @@ else
      lt_nm_to_check="$lt_nm_to_check nm"
    fi
  fi
- for lt_tmp_nm in $lt_nm_to_check; do
+ for lt_tmp_nm in "$lt_nm_to_check"; do
    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
      IFS="$lt_save_ifs"
      test -z "$ac_dir" && ac_dir=.
-     case "$lt_tmp_nm" in
+     # Strip out any user-provided options from the nm to test twice,
+     # the first time to test to see if nm (rather than its options) has
+     # an explicit path, the second time to yield a file which can be
+     # nm'ed itself.
+     tmp_nm_path="`$ECHO "$lt_tmp_nm" | sed 's, -.*$,,'`"
+     case "$tmp_nm_path" in
      */*|*\\*) tmp_nm="$lt_tmp_nm";;
      *) tmp_nm="$ac_dir/$lt_tmp_nm";;
      esac
-     if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+     tmp_nm_to_nm="`$ECHO "$tmp_nm" | sed 's, -.*$,,'`"
+     if test -f "$tmp_nm_to_nm" || test -f "$tmp_nm_to_nm$ac_exeext" ; then
        # Check to see if the nm accepts a BSD-compat flag.
        # Adding the `sed 1q' prevents false positives on HP-UX, which says:
        #   nm: unknown option "B" ignored
-       case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+       case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
        *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
 	 break
 	 ;;
        *)
-	 case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+	 case `"$tmp_nm" -p "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
 	 *$tmp_nm*)
 	   lt_cv_path_NM="$tmp_nm -p"
 	   break
@@ -10705,7 +10711,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10708 "configure"
+#line 10714 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10811,7 +10817,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10814 "configure"
+#line 10820 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H

base-commit: bb368aad297fe3ad40cf397e6fc85aa471429a28
prerequisite-patch-id: 92872e00ca2b73dacdf3560166e14946e5c8c9e8
prerequisite-patch-id: a56ae1e4c6217f978cfab173162d19c5bec6b66e
prerequisite-patch-id: 98681ad6dfb609b75fb99faa6a4607b4dbaa9ff4
prerequisite-patch-id: fb4fb6c34271b9c1109234f05b948b8165a68270
prerequisite-patch-id: ea5af70db40bbb20e8588cf89fec3164dc3ba1d3
prerequisite-patch-id: 4a7283db1d6c4ac508cf624411945fe6276a42f2
prerequisite-patch-id: 9024b50dd0e396370f91b6a1e07c9b39e09a8871
prerequisite-patch-id: e114d6610e5a5e96766ffc47909040715e63ec4b
prerequisite-patch-id: 58f5630d18a1e32e8b7dd0ccc734d0046c9ebdb5
prerequisite-patch-id: 74a9849f23d902f5cb6d99ec7041dac407499534
prerequisite-patch-id: 0edd30d8a73394dd8bf17eaba84390be8c49cdc5
prerequisite-patch-id: ee024384bddb95ccbed56c4e877c477b90aecd09
prerequisite-patch-id: bb2b236d705a047c77111434e808b951c17e07a4
prerequisite-patch-id: bc798478702505d71177ad369f60ed0d2f6690a1
prerequisite-patch-id: 380d4bb4907763fff91d79f0410298436b8d57d0
prerequisite-patch-id: f36a3a087a64d3a65d95952c5c4f45adab672c07
prerequisite-patch-id: 779750a965e8163d6a989edf2c09fe06a49d5f08
prerequisite-patch-id: b6bdba26b904756e0481c55ad719687dd5022fbe
prerequisite-patch-id: 4e03d099a59d6e67632e1dbbb5c971746096d932
prerequisite-patch-id: 0c9657495a39a5560fe8eb87464de59f56ab73d7
prerequisite-patch-id: 0b6a82625015ae62f622c5e89966c8213088a260
prerequisite-patch-id: 25c94c705bef9d15eace9ac3bcb57e126c03b6f0
prerequisite-patch-id: cd4fcf984a99b38332d9917990170835d95a027f
prerequisite-patch-id: 0352b9de77fac90515c24377ad63d8204e8245bb
prerequisite-patch-id: abf93ac65c0621c1557c5376780a8b0b43d26e50
prerequisite-patch-id: f353a2ab037d28b0fcc3d4f3d9bd139317140960
prerequisite-patch-id: 0984334f5518e857340283f6b9cfe728b9baa563
prerequisite-patch-id: e943518b884c6754a669a963d7018030b1f420d9
prerequisite-patch-id: c974dd4ed0d8bff8a1e41d58f4387bb294b527a2
prerequisite-patch-id: b2cfa9d031946885120abc524cf55af589e7db73
prerequisite-patch-id: 0e34ae632b44ad51ee60b78e2477c59b88f04aa8
prerequisite-patch-id: 6cc12f5d3f57b3152c88f07b0bfed5a5c25ba452
prerequisite-patch-id: e5738774c19fc68690ac626d505b16bc83ffe64f
prerequisite-patch-id: fda4d965c64c1cf299a94417d868f3e77e35dddd
prerequisite-patch-id: 45a7b39f33d104a8cbbc205db2ea003ca5d713a1
prerequisite-patch-id: 0b47ea7b3c5cf4c555ee07ce208b99fa8505fd8e
prerequisite-patch-id: 1fa6f3a5a49712edfc038eb8e28e95cf728a27c4
prerequisite-patch-id: c911f20a9746210e8b30154caf1c1fe92a54724c
prerequisite-patch-id: 63c745dfbdcefd66cbd9991a4ca2d87134648eb0
prerequisite-patch-id: 7e1a61b3c0d3330e088552efc63ef19955915988
prerequisite-patch-id: 9c0d06f03b6ef7689d1521fd01b7ac62f457b6b1
prerequisite-patch-id: 9e9149136bcd2bc7ccb4b53bdc7ef26a66535248
prerequisite-patch-id: 0f343b78e27bc603a4b7068ad4c9ba17e009c5cd
prerequisite-patch-id: 652590e84ac8f37cad254fbc9165a2c8d2701c5c
prerequisite-patch-id: 369637be97ec85415c7be56c11e9981019f716cd
prerequisite-patch-id: 6af72bee97fa1d951dcb86be035651e1d3ef5ad9
prerequisite-patch-id: 9b20bb7c36f34a3cff34697e121ece43b65755b4
prerequisite-patch-id: 48d7be5f19a7d0816ff92368a4891a54f381192a
prerequisite-patch-id: e88357ba3286fd2cebc83f861bfb5cf75e1bffda
prerequisite-patch-id: 652f20da5066dba06e1ae770d64f45779a043920
prerequisite-patch-id: 9d34ff1ccde498d83742619536a395a336f94e89
prerequisite-patch-id: 55c02e7e1bf507d0adc6ced3c971b4f00f13348e
prerequisite-patch-id: 14e043d4be0f54d52f788ea1fdd21a23d9b253d0
prerequisite-patch-id: 1650e28c78426cbd97c274c88dfe1431913377b7
prerequisite-patch-id: c43eaf3aad2ac41d012825b8916d57232eab7232
prerequisite-patch-id: 2a4a55cd53678430c2af9b429781e4ec218504ba
prerequisite-patch-id: 8e4398615f6259a537c7f9298f4e01dfda7593a2
prerequisite-patch-id: b3723d267e4daa1740e1293df5252987834ff7e1
prerequisite-patch-id: 65cc62cf39694ffe1ac0563d0519e06cb6e78f1a
prerequisite-patch-id: 56fcceb5d42c944a3a664377b24d05fa731167a7
prerequisite-patch-id: fb5dd8c6b522b5d20d2ad229dc087d6845591780
prerequisite-patch-id: 0e5820182e5a6e9e28f3682127b918d29163ae77
prerequisite-patch-id: 003bfa2c471907a17cf76b49c9091bed4f58f8e7
prerequisite-patch-id: 835b0169ce56786d6cee5f94406cefc71aa069ae
prerequisite-patch-id: af0835d26d01b36a9f790b0ca070fb3d10e75bcc
prerequisite-patch-id: 889402116125c2bc015b1feabb0be9bfcafe14ec
prerequisite-patch-id: 48eed66dad8aca1b97c4db23bbe89407f9bfdedc
prerequisite-patch-id: b9dd63ecc574bf20ac291de4b7bc9cc46d36b423
prerequisite-patch-id: c0eb76d4b7655cd2d5428b6082f70ca83e857035
prerequisite-patch-id: 33f5411515ad446100aaa7aa656aa693212062a3
prerequisite-patch-id: 9dc39bf1d18d0b0432e4e147dc3b8be49cdbd2ec
prerequisite-patch-id: 61375e5c1c300661b4fdc342a6833aafad4a2d34
prerequisite-patch-id: d258ad649f84f0bd733863c6e404eafc78740478
prerequisite-patch-id: c2304490c25672fae029f45b51a2fa3feba5e19a
prerequisite-patch-id: 5dba7e2868b7bcf9c7d8ad58c722ea085cf1f192
prerequisite-patch-id: 5f45f7de52744a4c918a0c30ee0bf1daa3a54ba8
prerequisite-patch-id: 94d23412c629f1d1fabe7e85c889628b8a089102
prerequisite-patch-id: 5cc5aaf9d9c9abd7d0fb0d17d5b9f30739e15b16
prerequisite-patch-id: 450d3fd2ae5d061f4d5123c620f141b6f1a953d8
prerequisite-patch-id: fff88d650c15d19c858121e6609bf9ffa17acfc7
prerequisite-patch-id: 24328f427d4397fccbc609cb0d0774d27c2f8d3d
prerequisite-patch-id: 5157356b7b54bf5a8f81f1b023c4964d2dedc347
prerequisite-patch-id: e637ac80e1bac8b61e76ac6cf884caee261d8a6a
prerequisite-patch-id: 12ce086e97061c8038c4489a4aa6fb99bae23c33
prerequisite-patch-id: 997a5a0cdc0a0cc1932279d48986fc394b2bc5b3
prerequisite-patch-id: f4940a9cdc2056757d730ada67daca46e3826017
prerequisite-patch-id: 46a35bee86e0f927cfe2ad7b8bd609beb17cc845
prerequisite-patch-id: a35a1df053b9fdc1e682d92aea745e88b36ca715
prerequisite-patch-id: 3c1011003b9de4bac7b795b39ad024c2af28a0a2
prerequisite-patch-id: eb675a41c3307438c394d9dcd8cd54c2e08f4059
prerequisite-patch-id: a97a216272895695a196bdbf875f99c5754e0f6a
prerequisite-patch-id: 01916daf641d0d55bed0630565091ecb43dc4088
prerequisite-patch-id: d2eda91b9a27df188c6a7e80408af3db73756b4c
prerequisite-patch-id: dd113253f08e6774e9c05ffc867bf3f70749a0ad
prerequisite-patch-id: 90b7a55e6d24734a909af3c0247274d480bc83a1
prerequisite-patch-id: 484d7a8e6d1a6e1ab8ca31a73fac6111261565cb
prerequisite-patch-id: 56311938d6f15bde8a503cc3772c13a517d92457
prerequisite-patch-id: 734a8a92a263c227ec40314a4baa7475d9edcb78
prerequisite-patch-id: 12eaabdc6dd9b1228fe63e9cda7058d118ad5d35
prerequisite-patch-id: 6aedc79fd7d9fe6b0f62be7a4d7060a884224c73
prerequisite-patch-id: 4200cb21291d376fec7ac572b7595dee9973415e
prerequisite-patch-id: e0b0e4f0891c47a1f8e46a142613488693792092
prerequisite-patch-id: 419703854e64bfdb9d60f0163b845fcaccd176f4
prerequisite-patch-id: 64f232b25afc10a98fa50a5546e2ee4063fbde9e
prerequisite-patch-id: f7f229f7b763a47ee79d7811753041b4e263d00a
-- 
2.35.1.261.g8402f930ba.dirty


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH REVIEW] libtool.m4: fix the NM="/nm/over/here -B/option/with/path" case
  2022-03-21 18:25 [PATCH REVIEW] libtool.m4: fix the NM="/nm/over/here -B/option/with/path" case Nick Alcock
@ 2022-03-24 14:12 ` Nick Clifton
  2022-03-25 18:08   ` Nick Alcock
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Clifton @ 2022-03-24 14:12 UTC (permalink / raw)
  To: Nick Alcock, binutils

Hi Nick,

> This seems to be all combinations, including those used by GCC bootstrap
> (which, before this commit, fails to bootstrap when configured
> --with-build-config=bootstrap-lto, because the lto plugin is now using
> --export-symbols-regex, which requires libtool to find a working nm,
> while also using -B../prev-gcc to point at the lto plugin associated
> with the GCC just built.)
> 
> Regenerate all affected configure scripts.
> 
> 	* libtool.m4 (LT_PATH_NM): Handle user-specified NM with
> 	options, including options containing paths.

Patch approved - please apply.

Cheers
   Nick


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH REVIEW] libtool.m4: fix the NM="/nm/over/here -B/option/with/path" case
  2022-03-24 14:12 ` Nick Clifton
@ 2022-03-25 18:08   ` Nick Alcock
  0 siblings, 0 replies; 3+ messages in thread
From: Nick Alcock @ 2022-03-25 18:08 UTC (permalink / raw)
  To: binutils

On 24 Mar 2022, Nick Clifton via Binutils uttered the following:

> Hi Nick,
>
>> This seems to be all combinations, including those used by GCC bootstrap
>> (which, before this commit, fails to bootstrap when configured
>> --with-build-config=bootstrap-lto, because the lto plugin is now using
>> --export-symbols-regex, which requires libtool to find a working nm,
>> while also using -B../prev-gcc to point at the lto plugin associated
>> with the GCC just built.)
>> Regenerate all affected configure scripts.
>> 	* libtool.m4 (LT_PATH_NM): Handle user-specified NM with
>> 	options, including options containing paths.
>
> Patch approved - please apply.

Thanks! (Pushed.)

With a little luck I'll get this (and the patch it follows up on) into
libtool next. I hear libtool may have, whisper it, a *maintainer* again.

-- 
NULL && (void)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-25 18:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21 18:25 [PATCH REVIEW] libtool.m4: fix the NM="/nm/over/here -B/option/with/path" case Nick Alcock
2022-03-24 14:12 ` Nick Clifton
2022-03-25 18:08   ` Nick Alcock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).