On 2/10/26 12:04 AM, Mohamed Mediouni wrote:


On 10. Feb 2026, at 07:39, Pierrick Bouvier <[email protected]> wrote:

On 2/9/26 8:07 PM, Mohamed Mediouni wrote:
llvm-dlltool assumes that it's by default targeting the host architecture
it's running on. That assumption doesn't hold true when cross-compiling.
Signed-off-by: Mohamed Mediouni <[email protected]>
---
 plugins/meson.build | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/plugins/meson.build b/plugins/meson.build
index 34643e2cea..9899f166ee 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -41,9 +41,16 @@ if host_os == 'windows'
   # to find missing symbols in current program.
   win32_qemu_plugin_api_link_flags = ['-Lplugins', '-lqemu_plugin_api']
   if meson.get_compiler('c').get_id() == 'clang'
+    if host_machine.cpu() == 'x86_64'
+      dlltool_target = 'i386:x86-64'
+    elif host_machine.cpu() == 'aarch64'
+      dlltool_target = 'arm64'
+    else
+      error('Unknown machine')
+    endif
     # With LLVM/lld, delaylib is specified at link time (-delayload)
     dlltool = find_program('llvm-dlltool', required: true)
-    dlltool_cmd = [dlltool, '-d', '@INPUT@', '-l', '@OUTPUT@', '-D', 'qemu.exe'] +    dlltool_cmd = [dlltool, '-m', dlltool_target,'-d', '@INPUT@', '- l', '@OUTPUT@', '-D', 'qemu.exe']
     win32_qemu_plugin_api_link_flags += ['-Wl,-delayload=qemu.exe']
   else
     # With gcc/ld, delay lib is built with a specific delay parameter.

Interesting, on which setup did you find this?

Regards,
Pierrick
Hello,

Was found on my macOS arm64 laptop w/ using llvm-mingw and an MXE fork to build all the libs QEMU needed. Cross-compiled for arm64 Windows initially from there, and came across this when targeting x86_64 from that setup.



Ok thanks.
When I cross compiled windows-arm64 -> windows-x86_64, I don't remember having to set it. That said, it does not hurt anyway, and everything still builds fine natively with it.

Reviewed-by: Pierrick Bouvier <[email protected]>
Tested-by: Pierrick Bouvier <[email protected]>

Regards,
Pierrick

Reply via email to