binutils: revert libtool changes that break darwin

main
Andrew Childs 2 years ago committed by Bernardo Meurer
parent aa9448db2a
commit 022e81d7f1
No known key found for this signature in database
GPG Key ID: F4C0D53B8D14C246
  1. 137
      pkgs/development/tools/misc/binutils/0001-Revert-libtool.m4-fix-nm-BSD-flag-detection.patch
  2. 47
      pkgs/development/tools/misc/binutils/0001-libtool.m4-update-macos-version-detection-block.patch
  3. 18
      pkgs/development/tools/misc/binutils/default.nix
  4. 2
      pkgs/top-level/all-packages.nix

@ -0,0 +1,137 @@
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

@ -0,0 +1,47 @@
From 33a8dc728eb5da3e1d3439c96810d1f6b2660b89 Mon Sep 17 00:00:00 2001
From: Andrew Childs <andrew.childs@bibo.com.ph>
Date: Tue, 22 Feb 2022 12:24:46 +0900
Subject: [PATCH] libtool.m4: update macos version detection block
Includes upstream change
9e8c882517082fe5755f2524d23efb02f1522490
---
libtool.m4 | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/libtool.m4 b/libtool.m4
index 7a711249304..f452efb4300 100644
--- a/libtool.m4
+++ b/libtool.m4
@@ -996,20 +996,15 @@ _LT_EOF
])
case $host_os in
rhapsody* | darwin1.[[012]])
- _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+ _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
darwin1.*)
- _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
- 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' ;;
- 10.*)
- _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
+ darwin*)
+ case $MACOSX_DEPLOYMENT_TARGET,$host in
+ 10.[[012]],*|,*powerpc*-darwin[[5-8]]*)
+ _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
+ *)
+ _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
esac
;;
esac
--
2.34.1

@ -4,6 +4,7 @@ in
{ stdenv
, autoreconfHook
, autoconf269, automake, libtool
, bison
, buildPackages
, fetchFromGitHub
@ -66,6 +67,13 @@ stdenv.mkDerivation {
# Make binutils output deterministic by default.
./deterministic.patch
# Breaks nm BSD flag detection
./0001-Revert-libtool.m4-fix-nm-BSD-flag-detection.patch
# Required for newer macos versions
./0001-libtool.m4-update-macos-version-detection-block.patch
# For some reason bfd ld doesn't search DT_RPATH when cross-compiling. It's
# not clear why this behavior was decided upon but it has the unfortunate
# consequence that the linker will fail to find transitive dependencies of
@ -94,6 +102,7 @@ stdenv.mkDerivation {
texinfo
]
++ lib.optionals targetPlatform.isiOS [ autoreconfHook ]
++ lib.optionals targetPlatform.isDarwin [ autoconf269 automake gettext libtool ]
++ lib.optionals targetPlatform.isVc4 [ flex ]
;
@ -102,6 +111,15 @@ stdenv.mkDerivation {
inherit noSysDirs;
preConfigure = ''
for i in */configure.ac; do
pushd "$(dirname "$i")"
echo "Running autoreconf in $PWD"
# autoreconf doesn't work, don't know why
# autoreconf ''${autoreconfFlags:---install --force --verbose}
autoconf
popd
done
# Clear the default library search path.
if test "$noSysDirs" = "1"; then
echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt

@ -14635,7 +14635,7 @@ with pkgs;
bingrep = callPackage ../development/tools/analysis/bingrep { };
binutils-unwrapped = callPackage ../development/tools/misc/binutils {
autoreconfHook = if targetPlatform.isiOS then autoreconfHook269 else autoreconfHook;
autoreconfHook = autoreconfHook269;
# FHS sys dirs presumably only have stuff for the build platform
noSysDirs = (stdenv.targetPlatform != stdenv.hostPlatform) || noSysDirs;
};

Loading…
Cancel
Save