aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils
diff options
context:
space:
mode:
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils')
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/R_ARM_COPY.patch29
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/default.nix73
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch (renamed from infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch)0
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch (renamed from infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch)0
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch (renamed from infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch)0
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/always-search-rpath.patch (renamed from infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/always-search-rpath.patch)0
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/build-components-separately.patch (renamed from infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/build-components-separately.patch)0
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/deterministic.patch (renamed from infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/deterministic.patch)0
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/disambiguate-arm-targets.patch (renamed from infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/disambiguate-arm-targets.patch)0
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/gold-symbol-visibility.patch (renamed from infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/gold-symbol-visibility.patch)0
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/no-plugins.patch (renamed from infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/no-plugins.patch)0
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.34/always-search-rpath.patch14
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.34/build-components-separately.patch164
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.34/deterministic.patch12
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.34/disambiguate-arm-targets.patch23
-rw-r--r--infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.34/no-plugins.patch21
16 files changed, 316 insertions, 20 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/R_ARM_COPY.patch b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/R_ARM_COPY.patch
new file mode 100644
index 000000000000..874809863523
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/R_ARM_COPY.patch
@@ -0,0 +1,29 @@
+@@ -, +, @@
+---
+ bfd/elf32-arm.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+--- a/bfd/elf32-arm.c
++++ a/bfd/elf32-arm.c
+@@ -15398,7 +15398,11 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info,
+ linker to copy the initial value out of the dynamic object and into
+ the runtime process image. We need to remember the offset into the
+ .rel(a).bss section we are going to use. */
+- if ((h->root.u.def.section->flags & SEC_READONLY) != 0)
++ if (info->nocopyreloc == 0
++ && (h->root.u.def.section->flags & SEC_ALLOC) != 0
++ /* PR 16177: A copy is only needed if the input section is readonly. */
++ && (h->root.u.def.section->flags & SEC_READONLY) != 0
++ && h->size != 0)
+ {
+ s = globals->root.sdynrelro;
+ srel = globals->root.sreldynrelro;
+@@ -15410,6 +15414,8 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info,
+ }
+ if (info->nocopyreloc == 0
+ && (h->root.u.def.section->flags & SEC_ALLOC) != 0
++ /* PR 16177: A copy is only needed if the input section is readonly. */
++ && (h->root.u.def.section->flags & SEC_READONLY) != 0
+ && h->size != 0)
+ {
+ elf32_arm_allocate_dynrelocs (info, srel, 1);
+
diff --git a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/default.nix b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/default.nix
index b352e63a27cc..978ec3f2f99f 100644
--- a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/default.nix
+++ b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/default.nix
@@ -8,6 +8,7 @@
, bison ? null
, flex
, texinfo
+, perl
}:
# Note: this package is used for bootstrapping fetchurl, and thus
@@ -21,7 +22,10 @@ let
# Remove gold-symbol-visibility patch when updating, the proper fix
# is now upstream.
# https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=330b90b5ffbbc20c5de6ae6c7f60c40fab2e7a4f;hp=99181ccac0fc7d82e7dabb05dc7466e91f1645d3
- version = "2.31.1";
+ version = "${minorVersion}${patchVersion}";
+ minorVersion = if stdenv.targetPlatform.isOr1k then "2.34" else "2.31";
+ patchVersion = if stdenv.targetPlatform.isOr1k then "" else ".1";
+
basename = "binutils";
# The targetPrefix prepended to binary names to allow multiple binuntils on the
# PATH to both be usable.
@@ -33,33 +37,49 @@ let
rev = "708acc851880dbeda1dd18aca4fd0a95b2573b36";
sha256 = "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63";
};
- # HACK to ensure that we preserve source from bootstrap binutils to not rebuild LLVM
- normal-src = stdenv.__bootPackages.binutils-unwrapped.src or (fetchurl {
+
+ # binutils sources not part of the bootstrap.
+ non-boot-src = (fetchurl {
url = "mirror://gnu/binutils/${basename}-${version}.tar.bz2";
- sha256 = "1l34hn1zkmhr1wcrgf0d4z7r3najxnw3cx2y2fk7v55zjlk3ik7z";
+ sha256 = {
+ "2.31.1" = "1l34hn1zkmhr1wcrgf0d4z7r3najxnw3cx2y2fk7v55zjlk3ik7z";
+ "2.34" = "1rin1f5c7wm4n3piky6xilcrpf2s0n3dd5vqq8irrxkcic3i1w49";
+ }.${version};
});
+
+ # HACK to ensure that we preserve source from bootstrap binutils to not rebuild LLVM
+ normal-src = stdenv.__bootPackages.binutils-unwrapped.src or non-boot-src;
+
+ # Platforms where we directly use the final source.
+ # Generally for cross-compiled platforms, where the boot source won't compile.
+ skipBootSrc = stdenv.targetPlatform.isOr1k;
+
+ # Select the specific source according to the platform in use.
+ src = if stdenv.targetPlatform.isVc4 then vc4-binutils-src
+ else if skipBootSrc then non-boot-src
+ else normal-src;
+
+ patchesDir = ./patches + "/${minorVersion}";
in
stdenv.mkDerivation {
pname = targetPrefix + basename;
- inherit version;
-
- src = if stdenv.targetPlatform.isVc4 then vc4-binutils-src else normal-src;
+ inherit src version;
patches = [
# Make binutils output deterministic by default.
- ./deterministic.patch
+ "${patchesDir}/deterministic.patch"
# Bfd looks in BINDIR/../lib for some plugins that don't
# exist. This is pointless (since users can't install plugins
# there) and causes a cycle between the lib and bin outputs, so
# get rid of it.
- ./no-plugins.patch
+ "${patchesDir}/no-plugins.patch"
# Help bfd choose between elf32-littlearm, elf32-littlearm-symbian, and
# elf32-littlearm-vxworks in favor of the first.
# https://github.com/NixOS/nixpkgs/pull/30484#issuecomment-345472766
- ./disambiguate-arm-targets.patch
+ "${patchesDir}/disambiguate-arm-targets.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
@@ -67,25 +87,38 @@ stdenv.mkDerivation {
# shared objects when cross-compiling. Consequently, we are forced to
# override this behavior, forcing ld to search DT_RPATH even when
# cross-compiling.
- ./always-search-rpath.patch
-
- ] ++ lib.optionals (!stdenv.targetPlatform.isVc4)
- [
+ "${patchesDir}/always-search-rpath.patch"
+ ]
+ # For version 2.31 exclusively
+ ++ lib.optionals (!stdenv.targetPlatform.isVc4 && minorVersion == "2.31") [
# https://sourceware.org/bugzilla/show_bug.cgi?id=22868
- ./gold-symbol-visibility.patch
+ ./patches/2.31/gold-symbol-visibility.patch
# https://sourceware.org/bugzilla/show_bug.cgi?id=23428
# un-break features so linking against musl doesn't produce crash-only binaries
- ./0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch
- ./0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch
- ./0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch
- ] ++ lib.optional stdenv.targetPlatform.isiOS ./support-ios.patch;
+ ./patches/2.31/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch
+ ./patches/2.31/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch
+ ./patches/2.31/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch
+ ]
+ ++ lib.optional stdenv.targetPlatform.isiOS ./support-ios.patch
+ ++ # This patch was suggested by Nick Clifton to fix
+ # https://sourceware.org/bugzilla/show_bug.cgi?id=16177
+ # It can be removed when that 7-year-old bug is closed.
+ # This binutils bug causes GHC to emit broken binaries on armv7, and
+ # indeed GHC will refuse to compile with a binutils suffering from it. See
+ # this comment for more information:
+ # https://gitlab.haskell.org/ghc/ghc/issues/4210#note_78333
+ lib.optional stdenv.targetPlatform.isAarch32 ./R_ARM_COPY.patch
+ ;
outputs = [ "out" "info" "man" ];
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [
bison
+ ] ++ lib.optionals (lib.versionAtLeast version "2.34") [
+ perl
+ texinfo
] ++ (lib.optionals stdenv.targetPlatform.isiOS [
autoreconfHook
]) ++ lib.optionals stdenv.targetPlatform.isVc4 [ texinfo flex ];
@@ -149,7 +182,7 @@ stdenv.mkDerivation {
enableParallelBuilding = true;
passthru = {
- inherit targetPrefix;
+ inherit targetPrefix patchesDir;
};
meta = with lib; {
diff --git a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch
index 5a047b0f0703..5a047b0f0703 100644
--- a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch
+++ b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Add-a-GNU_PROPERTY_X86_ISA_1_USED-note-if-needed.patch
diff --git a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch
index ca50d9a57cd1..ca50d9a57cd1 100644
--- a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch
+++ b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Properly-add-X86_ISA_1_NEEDED-property.patch
diff --git a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch
index 866d6db8ce24..866d6db8ce24 100644
--- a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch
+++ b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/0001-x86-Properly-merge-GNU_PROPERTY_X86_ISA_1_USED.patch
diff --git a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/always-search-rpath.patch b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/always-search-rpath.patch
index 2e9956e6b6e4..2e9956e6b6e4 100644
--- a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/always-search-rpath.patch
+++ b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/always-search-rpath.patch
diff --git a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/build-components-separately.patch b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/build-components-separately.patch
index d3cd0d2131cc..d3cd0d2131cc 100644
--- a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/build-components-separately.patch
+++ b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/build-components-separately.patch
diff --git a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/deterministic.patch b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/deterministic.patch
index 736e0aca6ce1..736e0aca6ce1 100644
--- a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/deterministic.patch
+++ b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/deterministic.patch
diff --git a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/disambiguate-arm-targets.patch b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/disambiguate-arm-targets.patch
index abbfa73da05d..abbfa73da05d 100644
--- a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/disambiguate-arm-targets.patch
+++ b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/disambiguate-arm-targets.patch
diff --git a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/gold-symbol-visibility.patch b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/gold-symbol-visibility.patch
index 0fb05a482d1c..0fb05a482d1c 100644
--- a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/gold-symbol-visibility.patch
+++ b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/gold-symbol-visibility.patch
diff --git a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/no-plugins.patch b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/no-plugins.patch
index 9624b7976b70..9624b7976b70 100644
--- a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/no-plugins.patch
+++ b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.31/no-plugins.patch
diff --git a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.34/always-search-rpath.patch b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.34/always-search-rpath.patch
new file mode 100644
index 000000000000..2e9956e6b6e4
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.34/always-search-rpath.patch
@@ -0,0 +1,14 @@
+diff --git a/ld/genscripts.sh b/ld/genscripts.sh
+index b6940d376d..0feb1adfd0 100755
+--- a/ld/genscripts.sh
++++ b/ld/genscripts.sh
+@@ -125,6 +125,9 @@ if test "x$NATIVE" = "xyes" ; then
+ USE_LIBPATH=yes
+ fi
+
++# TODO: why is this needed?
++USE_LIBPATH=yes
++
+ # Set the library search path, for libraries named by -lfoo.
+ # If LIB_PATH is defined (e.g., by Makefile) and non-empty, it is used.
+ # Otherwise, the default is set here.
diff --git a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.34/build-components-separately.patch b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.34/build-components-separately.patch
new file mode 100644
index 000000000000..38fa4934a28a
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.34/build-components-separately.patch
@@ -0,0 +1,164 @@
+diff --git a/bfd/configure.ac b/bfd/configure.ac
+index c5bfbd5d..45ad4c26 100644
+--- a/bfd/configure.ac
++++ b/bfd/configure.ac
+@@ -278,31 +278,19 @@ AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed,
+
+ LT_LIB_M
+
+-# When building a shared libbfd, link against the pic version of libiberty
+-# so that apps that use libbfd won't need libiberty just to satisfy any
+-# libbfd references.
+-# We can't do that if a pic libiberty is unavailable since including non-pic
+-# code would insert text relocations into libbfd.
+ SHARED_LIBADD=
+-SHARED_LDFLAGS=
++SHARED_LDFLAGS=-liberty
+ if test "$enable_shared" = "yes"; then
+-changequote(,)dnl
+- x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'`
+-changequote([,])dnl
+- if test -n "$x"; then
+- SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty"
+- fi
+-
+ case "${host}" in
+ # More hacks to build DLLs on Windows.
+ *-*-cygwin*)
+ SHARED_LDFLAGS="-no-undefined"
+- SHARED_LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin -lkernel32"
++ SHARED_LIBADD="-liberty -lintl -lcygwin -lkernel32"
+ ;;
+
+ # Use built-in libintl on macOS, since it is not provided by libc.
+ *-*-darwin*)
+- SHARED_LIBADD="-L`pwd`/../libiberty/pic -L`pwd`/../intl -liberty -lintl"
++ SHARED_LIBADD="-liberty -lintl"
+ ;;
+ esac
+
+diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am
+index 4f06074a..6836c589 100644
+--- a/opcodes/Makefile.am
++++ b/opcodes/Makefile.am
+@@ -51,7 +51,7 @@ libopcodes_la_LDFLAGS += -rpath $(rpath_bfdlibdir)
+ endif
+
+ # This is where bfd.h lives.
+-BFD_H = ../bfd/bfd.h
++BFD_H = $(BFDDIR)/bfd.h
+
+ BUILD_LIBS = @BUILD_LIBS@
+ BUILD_LIB_DEPS = @BUILD_LIB_DEPS@
+@@ -301,7 +301,7 @@ OFILES = @BFD_MACHINES@
+ # development.sh is used to determine -Werror default.
+ CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/development.sh
+
+-AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(INCDIR) -I$(BFDDIR) @HDEFINES@ @INCINTL@
++AM_CPPFLAGS = -I. -I$(srcdir) -I$(INCDIR) -I$(BFDDIR) @HDEFINES@ @INCINTL@
+
+ disassemble.lo: disassemble.c
+ if am__fastdepCC
+@@ -322,12 +322,21 @@ libopcodes_la_SOURCES = dis-buf.c disassemble.c dis-init.c
+ # old version of libbfd, or to pick up libbfd for the wrong architecture
+ # if host != build. So for building with shared libraries we use a
+ # hardcoded path to libbfd.so instead of relying on the entries in libbfd.la.
+-libopcodes_la_DEPENDENCIES = $(OFILES) @SHARED_DEPENDENCIES@
++libopcodes_la_DEPENDENCIES = $(OFILES) @SHARED_DEPENDENCIES@ libtool-soversion
+ libopcodes_la_LIBADD = $(OFILES) @SHARED_LIBADD@
+-libopcodes_la_LDFLAGS += -release `cat ../bfd/libtool-soversion` @SHARED_LDFLAGS@
++libopcodes_la_LDFLAGS += -release `cat libtool-soversion` @SHARED_LDFLAGS@
+ # Allow dependency tracking to work on all the source files.
+ EXTRA_libopcodes_la_SOURCES = $(LIBOPCODES_CFILES)
+
++libtool-soversion:
++ @echo "creating $@"
++ bfd_soversion="$(VERSION)" ;\
++ . $(BFDDIR)/development.sh ;\
++ if test "$$development" = true ; then \
++ bfd_soversion="$(VERSION).$${bfd_version_date}" ;\
++ fi ;\
++ echo "$${bfd_soversion}" > $@
++
+ # libtool will build .libs/libopcodes.a. We create libopcodes.a in
+ # the build directory so that we don't have to convert all the
+ # programs that use libopcodes.a simultaneously. This is a hack which
+diff --git a/opcodes/configure.ac b/opcodes/configure.ac
+index 00be9c88..6e589ae4 100644
+--- a/opcodes/configure.ac
++++ b/opcodes/configure.ac
+@@ -86,6 +86,7 @@ AC_PROG_INSTALL
+
+ AC_CHECK_HEADERS(string.h strings.h stdlib.h limits.h)
+ ACX_HEADER_STRING
++GCC_HEADER_STDINT(bfd_stdint.h)
+
+ AC_CHECK_DECLS([basename, stpcpy])
+
+@@ -137,61 +138,27 @@ AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed,
+
+ LT_LIB_M
+
+-#Libs for generator progs
+-if test "x$cross_compiling" = "xno"; then
+- BUILD_LIBS=../libiberty/libiberty.a
+- BUILD_LIB_DEPS=$BUILD_LIBS
+-else
+- # if cross-compiling, assume that the system provides -liberty
+- # and that the version is compatible with new headers.
+- BUILD_LIBS=-liberty
+- BUILD_LIB_DEPS=
+-fi
+-BUILD_LIBS="$BUILD_LIBS $LIBINTL"
+-BUILD_LIB_DEPS="$BUILD_LIB_DEPS $LIBINTL_DEP"
++BUILD_LIBS="-liberty $LIBINTL"
++BUILD_LIB_DEPS="$LIBINTL_DEP"
+
+ AC_SUBST(BUILD_LIBS)
+ AC_SUBST(BUILD_LIB_DEPS)
+
+ # Horrible hacks to build DLLs on Windows and a shared library elsewhere.
+ SHARED_LDFLAGS=
+-SHARED_LIBADD=
++SHARED_LIBADD=-liberty
+ SHARED_DEPENDENCIES=
+ if test "$enable_shared" = "yes"; then
+-# When building a shared libopcodes, link against the pic version of libiberty
+-# so that apps that use libopcodes won't need libiberty just to satisfy any
+-# libopcodes references.
+-# We can't do that if a pic libiberty is unavailable since including non-pic
+-# code would insert text relocations into libopcodes.
+ # Note that linking against libbfd as we do here, which is itself linked
+ # against libiberty, may not satisfy all the libopcodes libiberty references
+ # since libbfd may not pull in the entirety of libiberty.
+-changequote(,)dnl
+- x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'`
+-changequote([,])dnl
+- if test -n "$x"; then
+- SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty"
+- fi
+-
+ case "${host}" in
+ *-*-cygwin*)
+ SHARED_LDFLAGS="-no-undefined"
+- SHARED_LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin"
++ SHARED_LIBADD="-lbfd -liberty -lintl -lcygwin"
+ ;;
+- *-*-darwin*)
+- SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.dylib ${SHARED_LIBADD}"
+- SHARED_DEPENDENCIES="../bfd/libbfd.la"
+- ;;
+ *)
+- case "$host_vendor" in
+- hp)
+- SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.sl ${SHARED_LIBADD}"
+- ;;
+- *)
+- SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.so ${SHARED_LIBADD}"
+- ;;
+- esac
+- SHARED_DEPENDENCIES="../bfd/libbfd.la"
++ SHARED_LIBADD="-lbfd ${SHARED_LIBADD}"
+ ;;
+ esac
+
diff --git a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.34/deterministic.patch b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.34/deterministic.patch
new file mode 100644
index 000000000000..736e0aca6ce1
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.34/deterministic.patch
@@ -0,0 +1,12 @@
+diff -ur orig/binutils-2.23.1/ld/ldlang.c binutils-2.23.1/ld/ldlang.c
+--- orig/ld/ldlang.c
++++ new/ld/ldlang.c
+@@ -3095,6 +3095,8 @@
+ ldfile_output_machine))
+ einfo (_("%P%F:%s: can not set architecture: %E\n"), name);
+
++ link_info.output_bfd->flags |= BFD_DETERMINISTIC_OUTPUT;
++
+ link_info.hash = bfd_link_hash_table_create (link_info.output_bfd);
+ if (link_info.hash == NULL)
+ einfo (_("%P%F: can not create hash table: %E\n"));
diff --git a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.34/disambiguate-arm-targets.patch b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.34/disambiguate-arm-targets.patch
new file mode 100644
index 000000000000..abbfa73da05d
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.34/disambiguate-arm-targets.patch
@@ -0,0 +1,23 @@
+diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
+index 9f956d3..f5b61f1 100644
+--- a/bfd/elf32-arm.c
++++ b/bfd/elf32-arm.c
+@@ -19585,7 +19585,10 @@ elf32_arm_vxworks_final_write_processing (bfd *abfd, bfd_boolean linker)
+ #undef ELF_MAXPAGESIZE
+ #define ELF_MAXPAGESIZE 0x1000
+
++/* Prioritize elf32-*arm (priority 1) over elf32-*arm-vxworks (priority 2) */
++#define elf_match_priority 2
+ #include "elf32-target.h"
++#undef elf_match_priority
+
+
+ /* Merge backend specific data from an object file to the output
+@@ -19974,4 +19977,7 @@ elf32_arm_symbian_plt_sym_val (bfd_vma i, const asection *plt,
+ #undef ELF_MAXPAGESIZE
+ #define ELF_MAXPAGESIZE 0x8000
+
++/* Prioritize elf32-*arm (priority 1) over elf32-*arm-symbian (priority 2) */
++#define elf_match_priority 2
+ #include "elf32-target.h"
++#undef elf_match_priority
diff --git a/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.34/no-plugins.patch b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.34/no-plugins.patch
new file mode 100644
index 000000000000..68cf51b7dd3c
--- /dev/null
+++ b/infra/libkookie/nixpkgs/pkgs/development/tools/misc/binutils/patches/2.34/no-plugins.patch
@@ -0,0 +1,21 @@
+diff --git a/bfd/plugin.c b/bfd/plugin.c
+index 537ab60311..bfe7957f96 100644
+--- a/bfd/plugin.c
++++ b/bfd/plugin.c
+@@ -386,6 +386,7 @@ load_plugin (bfd *abfd)
+ if (plugin_program_name == NULL)
+ return found;
+
++#if 0
+ /* Try not to search the same dir twice, by looking at st_dev and
+ st_ino for the dir. If we are on a file system that always sets
+ st_ino to zero or the actual st_ino is zero we might waste some
+@@ -437,7 +438,7 @@ load_plugin (bfd *abfd)
+ if (found)
+ break;
+ }
+-
++#endif
+ return found;
+ }
+