fwupd-efi: Use the cross linker instead of the host ld.bfd

fwupd-efi finds the linker with find_program(cc.get_linker_id()),
which looks for a program named ld.bfd. meson.cross only sets ld, so
meson falls back to PATH and picks up ld.bfd from HOSTTOOLS. That breaks
cross builds on an x86-64 host:

  hosttools/ld.bfd: cannot represent machine `aarch64'

and on x86-64 targets it silently links with the host linker.

Set ld.bfd in an additional cross file

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Khem Raj committed 2026-11-01 16:27:04 -08:00
1 parent 6f950c5c50
commit cfecdc92b3
1 file changed
+10
@@ -12,6 +12,16 @@ COMPATIBLE_HOST = "(x86_64.*|i.86.*|aarch64.*|arm.*)-linux"
inherit meson pkgconfig python3native
# without this meson finds the build host linker in HOSTTOOLS.
do_write_config:append() {
cat >${WORKDIR}/meson-${PN}.cross <<EOF
[binaries]
ld.bfd = '${HOST_PREFIX}ld.bfd'
EOF
}
MESON_CROSS_FILE:append = " --cross-file ${WORKDIR}/meson-${PN}.cross"
# These should be configured as needed
SBAT_DISTRO_ID ?= "${DISTRO}"
SBAT_DISTRO_SUMMARY ?= "${DISTRO_NAME}"