[Buildroot] [git commit] package/elf2flt: fix build with binutils >= 2.41 due to libbfd location

Thomas Petazzoni thomas.petazzoni at bootlin.com
Sun Aug 6 13:44:32 UTC 2023


commit: https://git.buildroot.net/buildroot/commit/?id=d0349d5ba02df26c9f3d98b1e34ebd2c5c34192c
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

elf2flt needs to link against libbfd.a and libiberty.a which are
provided by host-binutils, but not installed, so we poke directly
into the host-binutils build directory. While not very nice, it has
already been like this for a long time. We could build host-binutils
with --enable-install-libbfd and --enable-install-libiberty so that
those libraries are installed, but we prefer to do this separately,
and there is a serious potential for perturbations to other packages
by having libbfd/libiberty installed in $(HOST_DIR).

In the mean time, an issue of poking directly into the host-binutils
build directory is that the location of libbfd.a has changed in
binutils >= 2.41, so we special case binutils 2.39 and 2.40, which are
the two remaining versions still using the "old" path".

Note: the ARC-special binutils version is not considered because
Buildroot only supports ARC CPUs with a MMU and therefore host-elf2flt
is never used on ARC.

Fixes:

gcc: error: /builds/buildroot.org/toolchains-builder/build/output/build/host-binutils-2.41/bfd/libbfd.a: No such file or directory

When build host-elf2flt against host-binutils 2.41.

This issue is not visible in the autobuilders as it is hidden by the
BFD_VMA_FMT issue fixed in the previous commit.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
Tested-by: Waldemar Brodkorb <wbx at openadk.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
---
 package/elf2flt/elf2flt.mk | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/package/elf2flt/elf2flt.mk b/package/elf2flt/elf2flt.mk
index 6cd0786c3d..b970de48f2 100644
--- a/package/elf2flt/elf2flt.mk
+++ b/package/elf2flt/elf2flt.mk
@@ -14,12 +14,27 @@ HOST_ELF2FLT_DEPENDENCIES = host-binutils host-zlib
 # 0001-elf2flt-handle-binutils-2.34.patch
 HOST_ELF2FLT_AUTORECONF = YES
 
+# elf2flt needs to link against libbfd.a and libiberty.a which are
+# provided by host-binutils, but not installed, so we poke directly
+# into the host-binutils build directory. Turns out that the location
+# of libbfd.a has changed in binutils >= 2.41, so we special case
+# binutils 2.39 and 2.40, which are the two remaining versions still
+# using the "old" path". Note: the ARC-special binutils version is not
+# considered because Buildroot only supports ARC CPUs with a MMU and
+# therefore host-elf2flt is never used on ARC. libiberty.a has
+# remained at the same location.
+ifeq ($(BR2_BINUTILS_VERSION_2_39_X)$(BR2_BINUTILS_VERSION_2_40_X),y)
+HOST_ELF2FLT_LIBBFD_PATH = $(HOST_BINUTILS_DIR)/bfd/libbfd.a
+else
+HOST_ELF2FLT_LIBBFD_PATH = $(HOST_BINUTILS_DIR)/bfd/.libs/libbfd.a
+endif
+
 # It is not exactly a host variant, but more a cross variant, which is
 # why we pass a special --target option.
 HOST_ELF2FLT_CONF_OPTS = \
 	--with-bfd-include-dir=$(HOST_BINUTILS_DIR)/bfd/ \
 	--with-binutils-include-dir=$(HOST_BINUTILS_DIR)/include/ \
-	--with-libbfd=$(HOST_BINUTILS_DIR)/bfd/libbfd.a \
+	--with-libbfd=$(HOST_ELF2FLT_LIBBFD_PATH) \
 	--with-libiberty=$(HOST_BINUTILS_DIR)/libiberty/libiberty.a \
 	--target=$(GNU_TARGET_NAME) \
 	--disable-werror



More information about the buildroot mailing list