diff mbox series

[meta-oe,3/3] fwupd-efi: Use the cross linker instead of the host ld.bfd

Message ID 20261101153414.1370959-3-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-oe,1/3] uutils-coreutils: Only provide coreutils when selected | expand

Commit Message

Khem Raj Nov. 1, 2026, 3:34 p.m. UTC
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>
---
 meta-oe/recipes-bsp/fwupd/fwupd-efi_1.8.bb | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/meta-oe/recipes-bsp/fwupd/fwupd-efi_1.8.bb b/meta-oe/recipes-bsp/fwupd/fwupd-efi_1.8.bb
index 8682d97c06..44d1f1807b 100644
--- a/meta-oe/recipes-bsp/fwupd/fwupd-efi_1.8.bb
+++ b/meta-oe/recipes-bsp/fwupd/fwupd-efi_1.8.bb
@@ -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}"