depot/third_party/nixpkgs/pkgs/development/tools/misc/binutils/0001-Revert-libtool.m4-fix-nm-BSD-flag-detection.patch
Default email 22017988c6 Project import generated by Copybara.
GitOrigin-RevId: c777cdf5c564015d5f63b09cc93bef4178b19b01
2022-04-27 11:35:20 +02:00

137 lines
4.2 KiB
Diff

From beca4a2c25ee86e4020f8b8bddc4d8e0ed3430b3 Mon Sep 17 00:00:00 2001
From: Andrew Childs <andrew.childs@bibo.com.ph>
Date: Tue, 22 Feb 2022 11:28:04 +0900
Subject: [PATCH] Revert "libtool.m4: fix nm BSD flag detection"
This reverts commit bef9ef8ca0f941d743c77cc55b5fe7985990b2a7.
---
ChangeLog | 9 ------
libtool.m4 | 88 ++++++++++++++++++++++++++----------------------------
2 files changed, 43 insertions(+), 54 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 18e8b6835da..c12f07403c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -375,15 +375,6 @@
* src-release.sh (GDB_SUPPPORT_DIRS): Add libbacktrace.
-2021-09-27 Nick Alcock <nick.alcock@oracle.com>
-
- PR libctf/27967
- * libtool.m4 (LT_PATH_NM): Try BSDization flags with a user-provided
- NM, if there is one. Run nm on itself, not on /dev/null, to avoid
- errors from nms that refuse to work on non-regular files. Remove
- other workarounds for this problem. Strip out blank lines from the
- nm output.
-
2021-09-27 Nick Alcock <nick.alcock@oracle.com>
PR libctf/27967
diff --git a/libtool.m4 b/libtool.m4
index a216bb14e99..7a711249304 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -3200,55 +3200,53 @@ _LT_DECL([], [file_magic_cmd], [1],
# LT_PATH_NM
# ----------
-# find the pathname to a BSD- or MS-compatible name lister, and any flags
-# needed to make it compatible
+# find the pathname to a BSD- or MS-compatible name lister
AC_DEFUN([LT_PATH_NM],
[AC_REQUIRE([AC_PROG_CC])dnl
AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
[if test -n "$NM"; then
- # 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=.
- case "$lt_tmp_nm" 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
- # 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
- *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
- break
- ;;
- *)
- case `"$tmp_nm" -p "$tmp_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}])
+ # 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])
if test "$lt_cv_path_NM" != "no"; then
NM="$lt_cv_path_NM"
else
--
2.34.1