package/elf2flt: fix build with binutils >= 2.41 due to libbfd location

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@bootlin.com>
Tested-by: Waldemar Brodkorb <wbx@openadk.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Thomas Petazzoni 2023-08-06 12:25:53 +02:00
parent d79f9c9f41
commit d0349d5ba0

View File

@ -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