--- /dev/null
+From: Stephane Glondu <steph@glondu.net>
+Date: Fri, 4 Sep 2020 06:23:06 +0200
+Subject: Statically link lib{bfd,iberty}
+
+---
+ configure.ac | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index ab1e188..b3ebe74 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1680,6 +1680,10 @@ AS_IF([test x"$with_bfd" != "xno"],
+ 'ocamlobjinfo' will be unable to display info on .cmxs files.
+ ]))])
+
++## Statically link libbfd and libiberty to avoid a versioned dependency
++## too constrained on libbinutils
++bfd_ldlibs="$(echo $bfd_ldlibs | sed 's/-lbfd/-Wl,-Bstatic -lbfd -liberty -Wl,-Bdynamic -lz -ldl/')"
++
+ ## Does the assembler support debug prefix map and CFI directives
+ as_has_debug_prefix_map=false
+ asm_cfi_supported=false
0005-read_main_debug_info-do-not-die-in-custom-executable.patch
0006-Disable-DT_TEXTREL-warnings-on-Linux-i386.patch
0007-Trigger-output-complete-exe-on-custom-with-an-enviro.patch
+0008-Statically-link-lib-bfd-iberty.patch
--with-x \
-mandir $(DEB_TEST_BUILD_PREFIX)/usr/share/man \
-CONFIGURE_SED := \
- -e "/LIBBFD_LINK/s%-lbfd%-Wl,-Bstatic -lbfd -liberty -Wl,-Bdynamic -lz -ldl%"
-
# Upstream recommends dropping support on armel, see https://github.com/ocaml/ocaml/issues/7642
# Binaries generated by ocamlopt segfault on x32
# ld reports spurious messages on powerpc, see https://github.com/ocaml/ocaml/issues/8846
config-stamp: pre-config-stamp
./configure $(CONFIGURE_OPTS)
- sed -i $(CONFIGURE_SED) Makefile.config
touch $@
ocamlinit-stamp: $(TARBALL_TARGET) config-stamp