Merge pull request #189894 from trofi/binutils-restore-nm-detection

binutils: restore `nm` autodetection on darwin

authored by Sergei Trofimovich and committed by GitHub f3e09e3e 69e9be10

+185
+137
pkgs/development/tools/misc/binutils/0001-Revert-libtool.m4-fix-nm-BSD-flag-detection.patch
··· 1 + From beca4a2c25ee86e4020f8b8bddc4d8e0ed3430b3 Mon Sep 17 00:00:00 2001 2 + From: Andrew Childs <andrew.childs@bibo.com.ph> 3 + Date: Tue, 22 Feb 2022 11:28:04 +0900 4 + Subject: [PATCH] Revert "libtool.m4: fix nm BSD flag detection" 5 + 6 + This reverts commit bef9ef8ca0f941d743c77cc55b5fe7985990b2a7. 7 + --- 8 + ChangeLog | 9 ------ 9 + libtool.m4 | 88 ++++++++++++++++++++++++++---------------------------- 10 + 2 files changed, 43 insertions(+), 54 deletions(-) 11 + 12 + diff --git a/ChangeLog b/ChangeLog 13 + index 18e8b6835da..c12f07403c3 100644 14 + --- a/ChangeLog 15 + +++ b/ChangeLog 16 + @@ -375,15 +375,6 @@ 17 + 18 + * src-release.sh (GDB_SUPPPORT_DIRS): Add libbacktrace. 19 + 20 + -2021-09-27 Nick Alcock <nick.alcock@oracle.com> 21 + - 22 + - PR libctf/27967 23 + - * libtool.m4 (LT_PATH_NM): Try BSDization flags with a user-provided 24 + - NM, if there is one. Run nm on itself, not on /dev/null, to avoid 25 + - errors from nms that refuse to work on non-regular files. Remove 26 + - other workarounds for this problem. Strip out blank lines from the 27 + - nm output. 28 + - 29 + 2021-09-27 Nick Alcock <nick.alcock@oracle.com> 30 + 31 + PR libctf/27967 32 + diff --git a/libtool.m4 b/libtool.m4 33 + index a216bb14e99..7a711249304 100644 34 + --- a/libtool.m4 35 + +++ b/libtool.m4 36 + @@ -3200,55 +3200,53 @@ _LT_DECL([], [file_magic_cmd], [1], 37 + 38 + # LT_PATH_NM 39 + # ---------- 40 + -# find the pathname to a BSD- or MS-compatible name lister, and any flags 41 + -# needed to make it compatible 42 + +# find the pathname to a BSD- or MS-compatible name lister 43 + AC_DEFUN([LT_PATH_NM], 44 + [AC_REQUIRE([AC_PROG_CC])dnl 45 + AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, 46 + [if test -n "$NM"; then 47 + - # Let the user override the nm to test. 48 + - lt_nm_to_check="$NM" 49 + - else 50 + - lt_nm_to_check="${ac_tool_prefix}nm" 51 + - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then 52 + - lt_nm_to_check="$lt_nm_to_check nm" 53 + - fi 54 + - fi 55 + - for lt_tmp_nm in $lt_nm_to_check; do 56 + - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR 57 + - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do 58 + - IFS="$lt_save_ifs" 59 + - test -z "$ac_dir" && ac_dir=. 60 + - case "$lt_tmp_nm" in 61 + - */*|*\\*) tmp_nm="$lt_tmp_nm";; 62 + - *) tmp_nm="$ac_dir/$lt_tmp_nm";; 63 + - esac 64 + - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then 65 + - # Check to see if the nm accepts a BSD-compat flag. 66 + - # Adding the `sed 1q' prevents false positives on HP-UX, which says: 67 + - # nm: unknown option "B" ignored 68 + - case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in 69 + - *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B" 70 + - break 71 + - ;; 72 + - *) 73 + - case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in 74 + - *$tmp_nm*) 75 + - lt_cv_path_NM="$tmp_nm -p" 76 + - break 77 + - ;; 78 + - *) 79 + - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but 80 + - continue # so that we can try to find one that supports BSD flags 81 + - ;; 82 + - esac 83 + - ;; 84 + - esac 85 + - fi 86 + - done 87 + - IFS="$lt_save_ifs" 88 + - done 89 + - : ${lt_cv_path_NM=no}]) 90 + + # Let the user override the test. 91 + + lt_cv_path_NM="$NM" 92 + +else 93 + + lt_nm_to_check="${ac_tool_prefix}nm" 94 + + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then 95 + + lt_nm_to_check="$lt_nm_to_check nm" 96 + + fi 97 + + for lt_tmp_nm in $lt_nm_to_check; do 98 + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR 99 + + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do 100 + + IFS="$lt_save_ifs" 101 + + test -z "$ac_dir" && ac_dir=. 102 + + tmp_nm="$ac_dir/$lt_tmp_nm" 103 + + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then 104 + + # Check to see if the nm accepts a BSD-compat flag. 105 + + # Adding the `sed 1q' prevents false positives on HP-UX, which says: 106 + + # nm: unknown option "B" ignored 107 + + # Tru64's nm complains that /dev/null is an invalid object file 108 + + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in 109 + + */dev/null* | *'Invalid file or object type'*) 110 + + lt_cv_path_NM="$tmp_nm -B" 111 + + break 112 + + ;; 113 + + *) 114 + + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in 115 + + */dev/null*) 116 + + lt_cv_path_NM="$tmp_nm -p" 117 + + break 118 + + ;; 119 + + *) 120 + + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but 121 + + continue # so that we can try to find one that supports BSD flags 122 + + ;; 123 + + esac 124 + + ;; 125 + + esac 126 + + fi 127 + + done 128 + + IFS="$lt_save_ifs" 129 + + done 130 + + : ${lt_cv_path_NM=no} 131 + +fi]) 132 + if test "$lt_cv_path_NM" != "no"; then 133 + NM="$lt_cv_path_NM" 134 + else 135 + -- 136 + 2.34.1 137 +
+42
pkgs/development/tools/misc/binutils/0001-Revert-libtool.m4-fix-the-NM-nm-over-here-B-option-w.patch
··· 1 + This reverts upstream commit caf606c90d55305967b9253447dda93d2f1835ab 2 + until https://sourceware.org/PR29547 is fixed. 3 + 4 + --- a/libtool.m4 5 + +++ b/libtool.m4 6 + @@ -3214,31 +3214,25 @@ AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, 7 + lt_nm_to_check="$lt_nm_to_check nm" 8 + fi 9 + fi 10 + - for lt_tmp_nm in "$lt_nm_to_check"; do 11 + + for lt_tmp_nm in $lt_nm_to_check; do 12 + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR 13 + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do 14 + IFS="$lt_save_ifs" 15 + test -z "$ac_dir" && ac_dir=. 16 + - # Strip out any user-provided options from the nm to test twice, 17 + - # the first time to test to see if nm (rather than its options) has 18 + - # an explicit path, the second time to yield a file which can be 19 + - # nm'ed itself. 20 + - tmp_nm_path="`$ECHO "$lt_tmp_nm" | sed 's, -.*$,,'`" 21 + - case "$tmp_nm_path" in 22 + + case "$lt_tmp_nm" in 23 + */*|*\\*) tmp_nm="$lt_tmp_nm";; 24 + *) tmp_nm="$ac_dir/$lt_tmp_nm";; 25 + esac 26 + - tmp_nm_to_nm="`$ECHO "$tmp_nm" | sed 's, -.*$,,'`" 27 + - if test -f "$tmp_nm_to_nm" || test -f "$tmp_nm_to_nm$ac_exeext" ; then 28 + + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then 29 + # Check to see if the nm accepts a BSD-compat flag. 30 + # Adding the `sed 1q' prevents false positives on HP-UX, which says: 31 + # nm: unknown option "B" ignored 32 + - case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in 33 + + case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in 34 + *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B" 35 + break 36 + ;; 37 + *) 38 + - case `"$tmp_nm" -p "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in 39 + + case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in 40 + *$tmp_nm*) 41 + lt_cv_path_NM="$tmp_nm -p" 42 + break
+6
pkgs/development/tools/misc/binutils/default.nix
··· 68 68 # Make binutils output deterministic by default. 69 69 ./deterministic.patch 70 70 71 + 72 + # Breaks nm BSD flag detection, heeds an upstream fix: 73 + # https://sourceware.org/PR29547 74 + ./0001-Revert-libtool.m4-fix-the-NM-nm-over-here-B-option-w.patch 75 + ./0001-Revert-libtool.m4-fix-nm-BSD-flag-detection.patch 76 + 71 77 # Required for newer macos versions 72 78 ./0001-libtool.m4-update-macos-version-detection-block.patch 73 79