Message ID | 20250110203401.178532-1-pierrick.bouvier@linaro.org |
---|---|
Headers | show |
Series | Enable clang build on Windows | expand |
On 1/10/25 12:33, Pierrick Bouvier wrote: > For now, it was only possible to build plugins using GCC on Windows. However, > windows-aarch64 only supports Clang. > This biggest roadblock was to get rid of gcc_struct attribute, which is not > supported by Clang. After investigation, we proved it was safe to drop it. > > Built and tested on Windows (all msys env)/Linux/MacOS for x86_64 and aarch64 > hosts. > > v1 contained warning fixes and various bits that have been upstreamed already. > The only bits left in this series are the gcc_struct removal, and fixing the > plugins build with clang. > > This series is for 10.0, as we decided to not include the gcc_struct removal is > 9.2 release. > > All patches are now reviewed, so this series can be pulled. I'll report that to > MSYS2 too, so we can enable clang environments for QEMU. > > v1: https://patchew.org/QEMU/20241031040426.772604-1-pierrick.bouvier@linaro.org/ > > v2: > - drop attribute gcc_struct instead of using -mno-ms-bitfields option > - add a section about bitfields in documentation > > v3: > - explain why gcc_struct attribute matters in packed structs in commit message > - reword the bitfields documentation with suggestions given > > v4: > - edit for bitfields doc requested by Philippe > > Pierrick Bouvier (3): > win32: remove usage of attribute gcc_struct > docs/devel/style: add a section about bitfield, and disallow them for > packed structures > plugins: enable linking with clang/lld > > docs/devel/style.rst | 20 +++++++++++++++++++ > meson.build | 6 +++--- > include/qemu/compiler.h | 7 +------ > scripts/cocci-macro-file.h | 6 +----- > subprojects/libvhost-user/libvhost-user.h | 6 +----- > contrib/plugins/meson.build | 2 +- > plugins/meson.build | 24 +++++++++++++++++++---- > tests/tcg/plugins/meson.build | 3 +-- > 8 files changed, 48 insertions(+), 26 deletions(-) > It would be nice if a maintainer could pull this, so we can get this merged upstream. Thanks, Pierrick
On 10/1/25 21:37, Pierrick Bouvier wrote: > On 1/10/25 12:33, Pierrick Bouvier wrote: >> For now, it was only possible to build plugins using GCC on Windows. >> However, >> windows-aarch64 only supports Clang. >> This biggest roadblock was to get rid of gcc_struct attribute, which >> is not >> supported by Clang. After investigation, we proved it was safe to drop >> it. >> >> Built and tested on Windows (all msys env)/Linux/MacOS for x86_64 and >> aarch64 >> hosts. >> >> v1 contained warning fixes and various bits that have been upstreamed >> already. >> The only bits left in this series are the gcc_struct removal, and >> fixing the >> plugins build with clang. >> >> This series is for 10.0, as we decided to not include the gcc_struct >> removal is >> 9.2 release. >> >> All patches are now reviewed, so this series can be pulled. I'll >> report that to >> MSYS2 too, so we can enable clang environments for QEMU. >> >> v1: https://patchew.org/QEMU/20241031040426.772604-1- >> pierrick.bouvier@linaro.org/ >> >> v2: >> - drop attribute gcc_struct instead of using -mno-ms-bitfields option >> - add a section about bitfields in documentation >> >> v3: >> - explain why gcc_struct attribute matters in packed structs in commit >> message >> - reword the bitfields documentation with suggestions given >> >> v4: >> - edit for bitfields doc requested by Philippe >> >> Pierrick Bouvier (3): >> win32: remove usage of attribute gcc_struct >> docs/devel/style: add a section about bitfield, and disallow them for >> packed structures >> plugins: enable linking with clang/lld >> >> docs/devel/style.rst | 20 +++++++++++++++++++ >> meson.build | 6 +++--- >> include/qemu/compiler.h | 7 +------ >> scripts/cocci-macro-file.h | 6 +----- >> subprojects/libvhost-user/libvhost-user.h | 6 +----- >> contrib/plugins/meson.build | 2 +- >> plugins/meson.build | 24 +++++++++++++++++++---- >> tests/tcg/plugins/meson.build | 3 +-- >> 8 files changed, 48 insertions(+), 26 deletions(-) >> > > It would be nice if a maintainer could pull this, so we can get this > merged upstream. That'd be Thomas or Alex I suppose.
Am 10.01.25 um 21:33 schrieb Pierrick Bouvier: > For now, it was only possible to build plugins using GCC on Windows. However, > windows-aarch64 only supports Clang. > This biggest roadblock was to get rid of gcc_struct attribute, which is not > supported by Clang. After investigation, we proved it was safe to drop it. > > Built and tested on Windows (all msys env)/Linux/MacOS for x86_64 and aarch64 > hosts. > > v1 contained warning fixes and various bits that have been upstreamed already. > The only bits left in this series are the gcc_struct removal, and fixing the > plugins build with clang. > > This series is for 10.0, as we decided to not include the gcc_struct removal is > 9.2 release. > > All patches are now reviewed, so this series can be pulled. I'll report that to > MSYS2 too, so we can enable clang environments for QEMU. > > v1: https://patchew.org/QEMU/20241031040426.772604-1-pierrick.bouvier@linaro.org/ > > v2: > - drop attribute gcc_struct instead of using -mno-ms-bitfields option > - add a section about bitfields in documentation > > v3: > - explain why gcc_struct attribute matters in packed structs in commit message > - reword the bitfields documentation with suggestions given > > v4: > - edit for bitfields doc requested by Philippe > > Pierrick Bouvier (3): > win32: remove usage of attribute gcc_struct > docs/devel/style: add a section about bitfield, and disallow them for > packed structures > plugins: enable linking with clang/lld > > docs/devel/style.rst | 20 +++++++++++++++++++ > meson.build | 6 +++--- > include/qemu/compiler.h | 7 +------ > scripts/cocci-macro-file.h | 6 +----- > subprojects/libvhost-user/libvhost-user.h | 6 +----- > contrib/plugins/meson.build | 2 +- > plugins/meson.build | 24 +++++++++++++++++++---- > tests/tcg/plugins/meson.build | 3 +-- > 8 files changed, 48 insertions(+), 26 deletions(-) This nice series allows building QEMU for Windows with the LLVM cross compiler on my ARM64 machine, so you can add Tested-by: Stefan Weil <sw@weilnetz.de> I only needed a trivial additional fix in scripts/nsis.py for `make installer` because the usual GNU objdump and the LLVM objdump (or the cross x86_64-w64-mingw32-objdump in my test) produce slightly different output (indentation with \t, indentation with four spaces). I'll prepare a patch which eliminates the need for objdump, so no intermediate fix is needed for this. Stefan W.
On 1/11/25 14:08, Stefan Weil wrote: > Am 10.01.25 um 21:33 schrieb Pierrick Bouvier: >> For now, it was only possible to build plugins using GCC on Windows. However, >> windows-aarch64 only supports Clang. >> This biggest roadblock was to get rid of gcc_struct attribute, which is not >> supported by Clang. After investigation, we proved it was safe to drop it. >> >> Built and tested on Windows (all msys env)/Linux/MacOS for x86_64 and aarch64 >> hosts. >> >> v1 contained warning fixes and various bits that have been upstreamed already. >> The only bits left in this series are the gcc_struct removal, and fixing the >> plugins build with clang. >> >> This series is for 10.0, as we decided to not include the gcc_struct removal is >> 9.2 release. >> >> All patches are now reviewed, so this series can be pulled. I'll report that to >> MSYS2 too, so we can enable clang environments for QEMU. >> >> v1: https://patchew.org/QEMU/20241031040426.772604-1-pierrick.bouvier@linaro.org/ >> >> v2: >> - drop attribute gcc_struct instead of using -mno-ms-bitfields option >> - add a section about bitfields in documentation >> >> v3: >> - explain why gcc_struct attribute matters in packed structs in commit message >> - reword the bitfields documentation with suggestions given >> >> v4: >> - edit for bitfields doc requested by Philippe >> >> Pierrick Bouvier (3): >> win32: remove usage of attribute gcc_struct >> docs/devel/style: add a section about bitfield, and disallow them for >> packed structures >> plugins: enable linking with clang/lld >> >> docs/devel/style.rst | 20 +++++++++++++++++++ >> meson.build | 6 +++--- >> include/qemu/compiler.h | 7 +------ >> scripts/cocci-macro-file.h | 6 +----- >> subprojects/libvhost-user/libvhost-user.h | 6 +----- >> contrib/plugins/meson.build | 2 +- >> plugins/meson.build | 24 +++++++++++++++++++---- >> tests/tcg/plugins/meson.build | 3 +-- >> 8 files changed, 48 insertions(+), 26 deletions(-) > > This nice series allows building QEMU for Windows with the LLVM cross > compiler on my ARM64 machine, so you can add > > Tested-by: Stefan Weil <sw@weilnetz.de> > > I only needed a trivial additional fix in scripts/nsis.py for `make > installer` because the usual GNU objdump and the LLVM objdump (or the > cross x86_64-w64-mingw32-objdump in my test) produce slightly different > output (indentation with \t, indentation with four spaces). I'll prepare > a patch which eliminates the need for objdump, so no intermediate fix is > needed for this. > > Stefan W. > Thanks for testing it Stefan. Once merged, I'll share this with MSYS2 folks, so they can backport this series to 9.2, and enable clang based environments (including for windows-arm64). Regards, Pierrick
On 11/1/25 16:47, Philippe Mathieu-Daudé wrote: > On 10/1/25 21:37, Pierrick Bouvier wrote: >> On 1/10/25 12:33, Pierrick Bouvier wrote: >>> For now, it was only possible to build plugins using GCC on Windows. >>> However, >>> windows-aarch64 only supports Clang. >>> This biggest roadblock was to get rid of gcc_struct attribute, which >>> is not >>> supported by Clang. After investigation, we proved it was safe to >>> drop it. >>> >>> Built and tested on Windows (all msys env)/Linux/MacOS for x86_64 and >>> aarch64 >>> hosts. >>> >>> v1 contained warning fixes and various bits that have been upstreamed >>> already. >>> The only bits left in this series are the gcc_struct removal, and >>> fixing the >>> plugins build with clang. >>> >>> This series is for 10.0, as we decided to not include the gcc_struct >>> removal is >>> 9.2 release. >>> >>> All patches are now reviewed, so this series can be pulled. I'll >>> report that to >>> MSYS2 too, so we can enable clang environments for QEMU. >>> >>> v1: https://patchew.org/QEMU/20241031040426.772604-1- >>> pierrick.bouvier@linaro.org/ >>> >>> v2: >>> - drop attribute gcc_struct instead of using -mno-ms-bitfields option >>> - add a section about bitfields in documentation >>> >>> v3: >>> - explain why gcc_struct attribute matters in packed structs in >>> commit message >>> - reword the bitfields documentation with suggestions given >>> >>> v4: >>> - edit for bitfields doc requested by Philippe >>> >>> Pierrick Bouvier (3): >>> win32: remove usage of attribute gcc_struct >>> docs/devel/style: add a section about bitfield, and disallow them for >>> packed structures >>> plugins: enable linking with clang/lld >>> >>> docs/devel/style.rst | 20 +++++++++++++++++++ >>> meson.build | 6 +++--- >>> include/qemu/compiler.h | 7 +------ >>> scripts/cocci-macro-file.h | 6 +----- >>> subprojects/libvhost-user/libvhost-user.h | 6 +----- >>> contrib/plugins/meson.build | 2 +- >>> plugins/meson.build | 24 +++++++++++++++++++---- >>> tests/tcg/plugins/meson.build | 3 +-- >>> 8 files changed, 48 insertions(+), 26 deletions(-) >>> >> >> It would be nice if a maintainer could pull this, so we can get this >> merged upstream. > > That'd be Thomas or Alex I suppose. (That said, I don't mind to merge if they are busy). Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
On 11/01/2025 16.47, Philippe Mathieu-Daudé wrote: > On 10/1/25 21:37, Pierrick Bouvier wrote: >> On 1/10/25 12:33, Pierrick Bouvier wrote: >>> For now, it was only possible to build plugins using GCC on Windows. >>> However, >>> windows-aarch64 only supports Clang. >>> This biggest roadblock was to get rid of gcc_struct attribute, which is not >>> supported by Clang. After investigation, we proved it was safe to drop it. >>> >>> Built and tested on Windows (all msys env)/Linux/MacOS for x86_64 and >>> aarch64 >>> hosts. >>> >>> v1 contained warning fixes and various bits that have been upstreamed >>> already. >>> The only bits left in this series are the gcc_struct removal, and fixing the >>> plugins build with clang. >>> >>> This series is for 10.0, as we decided to not include the gcc_struct >>> removal is >>> 9.2 release. >>> >>> All patches are now reviewed, so this series can be pulled. I'll report >>> that to >>> MSYS2 too, so we can enable clang environments for QEMU. >>> >>> v1: https://patchew.org/QEMU/20241031040426.772604-1- >>> pierrick.bouvier@linaro.org/ >>> >>> v2: >>> - drop attribute gcc_struct instead of using -mno-ms-bitfields option >>> - add a section about bitfields in documentation >>> >>> v3: >>> - explain why gcc_struct attribute matters in packed structs in commit >>> message >>> - reword the bitfields documentation with suggestions given >>> >>> v4: >>> - edit for bitfields doc requested by Philippe >>> >>> Pierrick Bouvier (3): >>> win32: remove usage of attribute gcc_struct >>> docs/devel/style: add a section about bitfield, and disallow them for >>> packed structures >>> plugins: enable linking with clang/lld >>> >>> docs/devel/style.rst | 20 +++++++++++++++++++ >>> meson.build | 6 +++--- >>> include/qemu/compiler.h | 7 +------ >>> scripts/cocci-macro-file.h | 6 +----- >>> subprojects/libvhost-user/libvhost-user.h | 6 +----- >>> contrib/plugins/meson.build | 2 +- >>> plugins/meson.build | 24 +++++++++++++++++++---- >>> tests/tcg/plugins/meson.build | 3 +-- >>> 8 files changed, 48 insertions(+), 26 deletions(-) >>> >> >> It would be nice if a maintainer could pull this, so we can get this >> merged upstream. > > That'd be Thomas or Alex I suppose. This touches plugins, so I think it should go through Alex' tree? Thomas
On 1/12/25 22:26, Thomas Huth wrote: > On 11/01/2025 16.47, Philippe Mathieu-Daudé wrote: >> On 10/1/25 21:37, Pierrick Bouvier wrote: >>> On 1/10/25 12:33, Pierrick Bouvier wrote: >>>> For now, it was only possible to build plugins using GCC on Windows. >>>> However, >>>> windows-aarch64 only supports Clang. >>>> This biggest roadblock was to get rid of gcc_struct attribute, which is not >>>> supported by Clang. After investigation, we proved it was safe to drop it. >>>> >>>> Built and tested on Windows (all msys env)/Linux/MacOS for x86_64 and >>>> aarch64 >>>> hosts. >>>> >>>> v1 contained warning fixes and various bits that have been upstreamed >>>> already. >>>> The only bits left in this series are the gcc_struct removal, and fixing the >>>> plugins build with clang. >>>> >>>> This series is for 10.0, as we decided to not include the gcc_struct >>>> removal is >>>> 9.2 release. >>>> >>>> All patches are now reviewed, so this series can be pulled. I'll report >>>> that to >>>> MSYS2 too, so we can enable clang environments for QEMU. >>>> >>>> v1: https://patchew.org/QEMU/20241031040426.772604-1- >>>> pierrick.bouvier@linaro.org/ >>>> >>>> v2: >>>> - drop attribute gcc_struct instead of using -mno-ms-bitfields option >>>> - add a section about bitfields in documentation >>>> >>>> v3: >>>> - explain why gcc_struct attribute matters in packed structs in commit >>>> message >>>> - reword the bitfields documentation with suggestions given >>>> >>>> v4: >>>> - edit for bitfields doc requested by Philippe >>>> >>>> Pierrick Bouvier (3): >>>> win32: remove usage of attribute gcc_struct >>>> docs/devel/style: add a section about bitfield, and disallow them for >>>> packed structures >>>> plugins: enable linking with clang/lld >>>> >>>> docs/devel/style.rst | 20 +++++++++++++++++++ >>>> meson.build | 6 +++--- >>>> include/qemu/compiler.h | 7 +------ >>>> scripts/cocci-macro-file.h | 6 +----- >>>> subprojects/libvhost-user/libvhost-user.h | 6 +----- >>>> contrib/plugins/meson.build | 2 +- >>>> plugins/meson.build | 24 +++++++++++++++++++---- >>>> tests/tcg/plugins/meson.build | 3 +-- >>>> 8 files changed, 48 insertions(+), 26 deletions(-) >>>> >>> >>> It would be nice if a maintainer could pull this, so we can get this >>> merged upstream. >> >> That'd be Thomas or Alex I suppose. > > This touches plugins, so I think it should go through Alex' tree? > > Thomas > > It's touching plugins, but it does a system wide change as well (which is the most important part). It's not really important who merges this, but it would be better if the series could be pulled as a whole, instead of breaking it into multiple subsystems. Thanks, Pierrick
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes: > On 1/12/25 22:26, Thomas Huth wrote: >> On 11/01/2025 16.47, Philippe Mathieu-Daudé wrote: >>> On 10/1/25 21:37, Pierrick Bouvier wrote: >>>> On 1/10/25 12:33, Pierrick Bouvier wrote: >>>>> For now, it was only possible to build plugins using GCC on Windows. >>>>> However, >>>>> windows-aarch64 only supports Clang. >>>>> This biggest roadblock was to get rid of gcc_struct attribute, which is not >>>>> supported by Clang. After investigation, we proved it was safe to drop it. >>>>> >>>>> Built and tested on Windows (all msys env)/Linux/MacOS for x86_64 and >>>>> aarch64 >>>>> hosts. >>>>> >>>>> v1 contained warning fixes and various bits that have been upstreamed >>>>> already. >>>>> The only bits left in this series are the gcc_struct removal, and fixing the >>>>> plugins build with clang. >>>>> >>>>> This series is for 10.0, as we decided to not include the gcc_struct >>>>> removal is >>>>> 9.2 release. >>>>> >>>>> All patches are now reviewed, so this series can be pulled. I'll report >>>>> that to >>>>> MSYS2 too, so we can enable clang environments for QEMU. >>>>> >>>>> v1: https://patchew.org/QEMU/20241031040426.772604-1- >>>>> pierrick.bouvier@linaro.org/ >>>>> >>>>> v2: >>>>> - drop attribute gcc_struct instead of using -mno-ms-bitfields option >>>>> - add a section about bitfields in documentation >>>>> >>>>> v3: >>>>> - explain why gcc_struct attribute matters in packed structs in commit >>>>> message >>>>> - reword the bitfields documentation with suggestions given >>>>> >>>>> v4: >>>>> - edit for bitfields doc requested by Philippe >>>>> >>>>> Pierrick Bouvier (3): >>>>> win32: remove usage of attribute gcc_struct >>>>> docs/devel/style: add a section about bitfield, and disallow them for >>>>> packed structures >>>>> plugins: enable linking with clang/lld >>>>> >>>>> docs/devel/style.rst | 20 +++++++++++++++++++ >>>>> meson.build | 6 +++--- >>>>> include/qemu/compiler.h | 7 +------ >>>>> scripts/cocci-macro-file.h | 6 +----- >>>>> subprojects/libvhost-user/libvhost-user.h | 6 +----- >>>>> contrib/plugins/meson.build | 2 +- >>>>> plugins/meson.build | 24 +++++++++++++++++++---- >>>>> tests/tcg/plugins/meson.build | 3 +-- >>>>> 8 files changed, 48 insertions(+), 26 deletions(-) >>>>> >>>> >>>> It would be nice if a maintainer could pull this, so we can get this >>>> merged upstream. >>> >>> That'd be Thomas or Alex I suppose. >> This touches plugins, so I think it should go through Alex' tree? >> Thomas >> > > It's touching plugins, but it does a system wide change as well (which > is the most important part). > > It's not really important who merges this, but it would be better if > the series could be pulled as a whole, instead of breaking it into > multiple subsystems. I'll look at it tomorrow when going through my maintainer queue. > > Thanks, > Pierrick
On 1/13/25 13:19, Alex Bennée wrote: > Pierrick Bouvier <pierrick.bouvier@linaro.org> writes: > >> On 1/12/25 22:26, Thomas Huth wrote: >>> On 11/01/2025 16.47, Philippe Mathieu-Daudé wrote: >>>> On 10/1/25 21:37, Pierrick Bouvier wrote: >>>>> On 1/10/25 12:33, Pierrick Bouvier wrote: >>>>>> For now, it was only possible to build plugins using GCC on Windows. >>>>>> However, >>>>>> windows-aarch64 only supports Clang. >>>>>> This biggest roadblock was to get rid of gcc_struct attribute, which is not >>>>>> supported by Clang. After investigation, we proved it was safe to drop it. >>>>>> >>>>>> Built and tested on Windows (all msys env)/Linux/MacOS for x86_64 and >>>>>> aarch64 >>>>>> hosts. >>>>>> >>>>>> v1 contained warning fixes and various bits that have been upstreamed >>>>>> already. >>>>>> The only bits left in this series are the gcc_struct removal, and fixing the >>>>>> plugins build with clang. >>>>>> >>>>>> This series is for 10.0, as we decided to not include the gcc_struct >>>>>> removal is >>>>>> 9.2 release. >>>>>> >>>>>> All patches are now reviewed, so this series can be pulled. I'll report >>>>>> that to >>>>>> MSYS2 too, so we can enable clang environments for QEMU. >>>>>> >>>>>> v1: https://patchew.org/QEMU/20241031040426.772604-1- >>>>>> pierrick.bouvier@linaro.org/ >>>>>> >>>>>> v2: >>>>>> - drop attribute gcc_struct instead of using -mno-ms-bitfields option >>>>>> - add a section about bitfields in documentation >>>>>> >>>>>> v3: >>>>>> - explain why gcc_struct attribute matters in packed structs in commit >>>>>> message >>>>>> - reword the bitfields documentation with suggestions given >>>>>> >>>>>> v4: >>>>>> - edit for bitfields doc requested by Philippe >>>>>> >>>>>> Pierrick Bouvier (3): >>>>>> win32: remove usage of attribute gcc_struct >>>>>> docs/devel/style: add a section about bitfield, and disallow them for >>>>>> packed structures >>>>>> plugins: enable linking with clang/lld >>>>>> >>>>>> docs/devel/style.rst | 20 +++++++++++++++++++ >>>>>> meson.build | 6 +++--- >>>>>> include/qemu/compiler.h | 7 +------ >>>>>> scripts/cocci-macro-file.h | 6 +----- >>>>>> subprojects/libvhost-user/libvhost-user.h | 6 +----- >>>>>> contrib/plugins/meson.build | 2 +- >>>>>> plugins/meson.build | 24 +++++++++++++++++++---- >>>>>> tests/tcg/plugins/meson.build | 3 +-- >>>>>> 8 files changed, 48 insertions(+), 26 deletions(-) >>>>>> >>>>> >>>>> It would be nice if a maintainer could pull this, so we can get this >>>>> merged upstream. >>>> >>>> That'd be Thomas or Alex I suppose. >>> This touches plugins, so I think it should go through Alex' tree? >>> Thomas >>> >> >> It's touching plugins, but it does a system wide change as well (which >> is the most important part). >> >> It's not really important who merges this, but it would be better if >> the series could be pulled as a whole, instead of breaking it into >> multiple subsystems. > > I'll look at it tomorrow when going through my maintainer queue. > Thanks Alex :). >> >> Thanks, >> Pierrick >
Pierrick Bouvier <pierrick.bouvier@linaro.org> writes: > For now, it was only possible to build plugins using GCC on Windows. However, > windows-aarch64 only supports Clang. > This biggest roadblock was to get rid of gcc_struct attribute, which is not > supported by Clang. After investigation, we proved it was safe to drop it. > > Built and tested on Windows (all msys env)/Linux/MacOS for x86_64 and aarch64 > hosts. <snip> Queued to maintainer/jan-2025 and testing/next, thanks.
On 14/1/25 09:20, Alex Bennée wrote: > Pierrick Bouvier <pierrick.bouvier@linaro.org> writes: > >> For now, it was only possible to build plugins using GCC on Windows. However, >> windows-aarch64 only supports Clang. >> This biggest roadblock was to get rid of gcc_struct attribute, which is not >> supported by Clang. After investigation, we proved it was safe to drop it. >> >> Built and tested on Windows (all msys env)/Linux/MacOS for x86_64 and aarch64 >> hosts. > <snip> > > Queued to maintainer/jan-2025 and testing/next, thanks. Please also take this one on top: https://lore.kernel.org/qemu-devel/20250111215244.1680931-1-sw@weilnetz.de/ Thanks!
On 1/11/2025 4:08 PM, Stefan Weil via wrote: > Am 10.01.25 um 21:33 schrieb Pierrick Bouvier: >> For now, it was only possible to build plugins using GCC on Windows. >> However, >> windows-aarch64 only supports Clang. >> This biggest roadblock was to get rid of gcc_struct attribute, which >> is not >> supported by Clang. After investigation, we proved it was safe to >> drop it. >> >> Built and tested on Windows (all msys env)/Linux/MacOS for x86_64 and >> aarch64 >> hosts. >> >> v1 contained warning fixes and various bits that have been upstreamed >> already. >> The only bits left in this series are the gcc_struct removal, and >> fixing the >> plugins build with clang. >> >> This series is for 10.0, as we decided to not include the gcc_struct >> removal is >> 9.2 release. >> >> All patches are now reviewed, so this series can be pulled. I'll >> report that to >> MSYS2 too, so we can enable clang environments for QEMU. >> >> v1: >> https://patchew.org/QEMU/20241031040426.772604-1-pierrick.bouvier@linaro.org/ >> >> v2: >> - drop attribute gcc_struct instead of using -mno-ms-bitfields option >> - add a section about bitfields in documentation >> >> v3: >> - explain why gcc_struct attribute matters in packed structs in >> commit message >> - reword the bitfields documentation with suggestions given >> >> v4: >> - edit for bitfields doc requested by Philippe >> >> Pierrick Bouvier (3): >> win32: remove usage of attribute gcc_struct >> docs/devel/style: add a section about bitfield, and disallow them for >> packed structures >> plugins: enable linking with clang/lld >> >> docs/devel/style.rst | 20 +++++++++++++++++++ >> meson.build | 6 +++--- >> include/qemu/compiler.h | 7 +------ >> scripts/cocci-macro-file.h | 6 +----- >> subprojects/libvhost-user/libvhost-user.h | 6 +----- >> contrib/plugins/meson.build | 2 +- >> plugins/meson.build | 24 +++++++++++++++++++---- >> tests/tcg/plugins/meson.build | 3 +-- >> 8 files changed, 48 insertions(+), 26 deletions(-) > > This nice series allows building QEMU for Windows with the LLVM cross > compiler on my ARM64 machine, so you can add Is this toolchain available publicly or did you build it yourself? It would be handy if there were a linux x86_64 hosted cross-toolchain that can target Windows-aarch64. Or linux aarch64 hosted would be pretty good, too. Is there an MSYS2 or other distributor that provides windows-aarch64 builds of the glib and other library dependencies? > > Tested-by: Stefan Weil <sw@weilnetz.de> > > I only needed a trivial additional fix in scripts/nsis.py for `make > installer` because the usual GNU objdump and the LLVM objdump (or the > cross x86_64-w64-mingw32-objdump in my test) produce slightly > different output (indentation with \t, indentation with four spaces). > I'll prepare a patch which eliminates the need for objdump, so no > intermediate fix is needed for this. > > Stefan W. >
Hi Brian, On 2/17/25 20:11, Brian Cain wrote: > > On 1/11/2025 4:08 PM, Stefan Weil via wrote: >> Am 10.01.25 um 21:33 schrieb Pierrick Bouvier: >>> For now, it was only possible to build plugins using GCC on Windows. >>> However, >>> windows-aarch64 only supports Clang. >>> This biggest roadblock was to get rid of gcc_struct attribute, which >>> is not >>> supported by Clang. After investigation, we proved it was safe to >>> drop it. >>> >>> Built and tested on Windows (all msys env)/Linux/MacOS for x86_64 and >>> aarch64 >>> hosts. >>> >>> v1 contained warning fixes and various bits that have been upstreamed >>> already. >>> The only bits left in this series are the gcc_struct removal, and >>> fixing the >>> plugins build with clang. >>> >>> This series is for 10.0, as we decided to not include the gcc_struct >>> removal is >>> 9.2 release. >>> >>> All patches are now reviewed, so this series can be pulled. I'll >>> report that to >>> MSYS2 too, so we can enable clang environments for QEMU. >>> >>> v1: >>> https://patchew.org/QEMU/20241031040426.772604-1-pierrick.bouvier@linaro.org/ >>> >>> v2: >>> - drop attribute gcc_struct instead of using -mno-ms-bitfields option >>> - add a section about bitfields in documentation >>> >>> v3: >>> - explain why gcc_struct attribute matters in packed structs in >>> commit message >>> - reword the bitfields documentation with suggestions given >>> >>> v4: >>> - edit for bitfields doc requested by Philippe >>> >>> Pierrick Bouvier (3): >>> win32: remove usage of attribute gcc_struct >>> docs/devel/style: add a section about bitfield, and disallow them for >>> packed structures >>> plugins: enable linking with clang/lld >>> >>> docs/devel/style.rst | 20 +++++++++++++++++++ >>> meson.build | 6 +++--- >>> include/qemu/compiler.h | 7 +------ >>> scripts/cocci-macro-file.h | 6 +----- >>> subprojects/libvhost-user/libvhost-user.h | 6 +----- >>> contrib/plugins/meson.build | 2 +- >>> plugins/meson.build | 24 +++++++++++++++++++---- >>> tests/tcg/plugins/meson.build | 3 +-- >>> 8 files changed, 48 insertions(+), 26 deletions(-) >> >> This nice series allows building QEMU for Windows with the LLVM cross >> compiler on my ARM64 machine, so you can add > > Is this toolchain available publicly or did you build it yourself? It > would be handy if there were a linux x86_64 hosted cross-toolchain that > can target Windows-aarch64. Or linux aarch64 hosted would be pretty > good, too. > At the moment, the only open source toolchain supporting windows-arm64 is llvm-mingw (https://github.com/mstorsjo/llvm-mingw). There is some progress on gcc, but it is not yet fully upstream. MSYS2 uses llvm-mingw for windows-arm64 environment. On my side, I used a windows-arm64 machine with MSYS2 native environment. It would be handy to cross compile, and the problem is not really QEMU itself, but to cross compile all the dependencies. For x86_64, we use fedora, which provides convenient precompiled mingw packages for dependencies. It's definitely not impossible to do the same for windows-arm64, but it just takes much more effort. > Is there an MSYS2 or other distributor that provides windows-aarch64 > builds of the glib and other library dependencies? > MSYS2 does, but it's complicated to download packages by hand if it's your idea. Better to cross compile it. Regards, Pierrick >> >> Tested-by: Stefan Weil <sw@weilnetz.de> >> >> I only needed a trivial additional fix in scripts/nsis.py for `make >> installer` because the usual GNU objdump and the LLVM objdump (or the >> cross x86_64-w64-mingw32-objdump in my test) produce slightly >> different output (indentation with \t, indentation with four spaces). >> I'll prepare a patch which eliminates the need for objdump, so no >> intermediate fix is needed for this. >> >> Stefan W. >>
On Tue, Feb 18, 2025 at 08:22:14AM -0800, Pierrick Bouvier wrote: > Hi Brian, > > On 2/17/25 20:11, Brian Cain wrote: > > > > On 1/11/2025 4:08 PM, Stefan Weil via wrote: > > > Am 10.01.25 um 21:33 schrieb Pierrick Bouvier: > > > > For now, it was only possible to build plugins using GCC on Windows. > > > > However, > > > > windows-aarch64 only supports Clang. > > > > This biggest roadblock was to get rid of gcc_struct attribute, which > > > > is not > > > > supported by Clang. After investigation, we proved it was safe to > > > > drop it. > > > > > > > > Built and tested on Windows (all msys env)/Linux/MacOS for x86_64 and > > > > aarch64 > > > > hosts. > > > > > > > > v1 contained warning fixes and various bits that have been upstreamed > > > > already. > > > > The only bits left in this series are the gcc_struct removal, and > > > > fixing the > > > > plugins build with clang. > > > > > > > > This series is for 10.0, as we decided to not include the gcc_struct > > > > removal is > > > > 9.2 release. > > > > > > > > All patches are now reviewed, so this series can be pulled. I'll > > > > report that to > > > > MSYS2 too, so we can enable clang environments for QEMU. > > > > > > > > v1: > > > > https://patchew.org/QEMU/20241031040426.772604-1-pierrick.bouvier@linaro.org/ > > > > > > > > v2: > > > > - drop attribute gcc_struct instead of using -mno-ms-bitfields option > > > > - add a section about bitfields in documentation > > > > > > > > v3: > > > > - explain why gcc_struct attribute matters in packed structs in > > > > commit message > > > > - reword the bitfields documentation with suggestions given > > > > > > > > v4: > > > > - edit for bitfields doc requested by Philippe > > > > > > > > Pierrick Bouvier (3): > > > > win32: remove usage of attribute gcc_struct > > > > docs/devel/style: add a section about bitfield, and disallow them for > > > > packed structures > > > > plugins: enable linking with clang/lld > > > > > > > > docs/devel/style.rst | 20 +++++++++++++++++++ > > > > meson.build | 6 +++--- > > > > include/qemu/compiler.h | 7 +------ > > > > scripts/cocci-macro-file.h | 6 +----- > > > > subprojects/libvhost-user/libvhost-user.h | 6 +----- > > > > contrib/plugins/meson.build | 2 +- > > > > plugins/meson.build | 24 +++++++++++++++++++---- > > > > tests/tcg/plugins/meson.build | 3 +-- > > > > 8 files changed, 48 insertions(+), 26 deletions(-) > > > > > > This nice series allows building QEMU for Windows with the LLVM cross > > > compiler on my ARM64 machine, so you can add > > > > Is this toolchain available publicly or did you build it yourself? It > > would be handy if there were a linux x86_64 hosted cross-toolchain that > > can target Windows-aarch64. Or linux aarch64 hosted would be pretty > > good, too. > > > > At the moment, the only open source toolchain supporting windows-arm64 is > llvm-mingw (https://github.com/mstorsjo/llvm-mingw). > There is some progress on gcc, but it is not yet fully upstream. > MSYS2 uses llvm-mingw for windows-arm64 environment. > > On my side, I used a windows-arm64 machine with MSYS2 native environment. > > It would be handy to cross compile, and the problem is not really QEMU > itself, but to cross compile all the dependencies. > For x86_64, we use fedora, which provides convenient precompiled mingw > packages for dependencies. > It's definitely not impossible to do the same for windows-arm64, but it just > takes much more effort. Once GCC supports arm64 for mingw, we could propose enabling this in Fedora and enabling the it in the build deps. Not a terribly complex bit of work, but probably a bit of a time sink to get all the pieces sorted. If this is important to QEMU long term though, it'l be worth the effort, as the Fedora mingw containers are what everyone is used to for testing Windows buildability. With regards, Daniel
Am 18.02.25 um 17:22 schrieb Pierrick Bouvier: > On 2/17/25 20:11, Brian Cain wrote: >> Is this toolchain available publicly or did you build it yourself? It >> would be handy if there were a linux x86_64 hosted cross-toolchain that >> can target Windows-aarch64. Or linux aarch64 hosted would be pretty >> good, too. >> > > At the moment, the only open source toolchain supporting windows-arm64 > is llvm-mingw (https://github.com/mstorsjo/llvm-mingw). > There is some progress on gcc, but it is not yet fully upstream. > MSYS2 uses llvm-mingw for windows-arm64 environment. > > On my side, I used a windows-arm64 machine with MSYS2 native environment. > > It would be handy to cross compile, and the problem is not really QEMU > itself, but to cross compile all the dependencies. > For x86_64, we use fedora, which provides convenient precompiled mingw > packages for dependencies. > It's definitely not impossible to do the same for windows-arm64, but it > just takes much more effort. > >> Is there an MSYS2 or other distributor that provides windows-aarch64 >> builds of the glib and other library dependencies? >> > > MSYS2 does, but it's complicated to download packages by hand if it's > your idea. Better to cross compile it. I could run a QEMU cross compile on Debian with the llvm toolchain and msys2 clangarm64 packages installed with pacman. The resulting installer is here: https://qemu.weilnetz.de/aarch64/ The only tools which was missing and which I had to build before running the QEMU build is aarch64-w64-mingw32-windmc. It looks like the NSIS installer is i386 code, so I don't know whether it can be used on Windows for aarch64. I also have no suitable Windows host for testing the binaries, so no test was done. Stefan W.
On 2/18/25 12:59, Stefan Weil wrote: > Am 18.02.25 um 17:22 schrieb Pierrick Bouvier: >> On 2/17/25 20:11, Brian Cain wrote: >>> Is this toolchain available publicly or did you build it yourself? It >>> would be handy if there were a linux x86_64 hosted cross-toolchain that >>> can target Windows-aarch64. Or linux aarch64 hosted would be pretty >>> good, too. >>> >> >> At the moment, the only open source toolchain supporting windows-arm64 >> is llvm-mingw (https://github.com/mstorsjo/llvm-mingw). >> There is some progress on gcc, but it is not yet fully upstream. >> MSYS2 uses llvm-mingw for windows-arm64 environment. >> >> On my side, I used a windows-arm64 machine with MSYS2 native environment. >> >> It would be handy to cross compile, and the problem is not really QEMU >> itself, but to cross compile all the dependencies. >> For x86_64, we use fedora, which provides convenient precompiled mingw >> packages for dependencies. >> It's definitely not impossible to do the same for windows-arm64, but it >> just takes much more effort. >> >>> Is there an MSYS2 or other distributor that provides windows-aarch64 >>> builds of the glib and other library dependencies? >>> >> >> MSYS2 does, but it's complicated to download packages by hand if it's >> your idea. Better to cross compile it. > > I could run a QEMU cross compile on Debian with the llvm toolchain and > msys2 clangarm64 packages installed with pacman. The resulting installer > is here: > Have you installed the msys2 clangarm64 packages on a windows machine first, and then copy them to your Debian machine? > https://qemu.weilnetz.de/aarch64/ > > The only tools which was missing and which I had to build before running > the QEMU build is aarch64-w64-mingw32-windmc. > > It looks like the NSIS installer is i386 code, so I don't know whether > it can be used on Windows for aarch64. > > I also have no suitable Windows host for testing the binaries, so no > test was done. > > Stefan W.
Am 19.02.25 um 00:17 schrieb Pierrick Bouvier: > On 2/18/25 12:59, Stefan Weil wrote: >> >> I could run a QEMU cross compile on Debian with the llvm toolchain and >> msys2 clangarm64 packages installed with pacman. The resulting installer >> is here: >> > > Have you installed the msys2 clangarm64 packages on a windows machine > first, and then copy them to your Debian machine? No, the packages were directly installed on Linux like in this older script which shows how this can be done for i686 and x86-64:: https://github.com/stweil/qemu/blob/master/.github/workflows/pacman.sh Newer Debian distributions already provide a package for pacman which simply needs the right configuration. For older distributions I had to build pacman first. I should also have noted that I used a Linux aarch64 build host, so its binutils were able to find the DLL dependencies. This requirement will be fixed with a pure Python script for the same purpose. > >> https://qemu.weilnetz.de/aarch64/ >> >> The only tool which was missing and which I had to build before running >> the QEMU build is aarch64-w64-mingw32-windmc. >> >> It looks like the NSIS installer is i386 code, so I don't know whether >> it can be used on Windows for aarch64. >> >> I also have no suitable Windows host for testing the binaries, so no >> test was done.
On 2/18/25 22:39, Stefan Weil wrote: > Am 19.02.25 um 00:17 schrieb Pierrick Bouvier: > >> On 2/18/25 12:59, Stefan Weil wrote: >>> >>> I could run a QEMU cross compile on Debian with the llvm toolchain and >>> msys2 clangarm64 packages installed with pacman. The resulting installer >>> is here: >>> >> >> Have you installed the msys2 clangarm64 packages on a windows machine >> first, and then copy them to your Debian machine? > > > No, the packages were directly installed on Linux like in this older > script which shows how this can be done for i686 and x86-64:: > > https://github.com/stweil/qemu/blob/master/.github/workflows/pacman.sh > > Newer Debian distributions already provide a package for pacman which > simply needs the right configuration. For older distributions I had to > build pacman first. > > I should also have noted that I used a Linux aarch64 build host, so its > binutils were able to find the DLL dependencies. This requirement will > be fixed with a pure Python script for the same purpose. > Oh excellent! I wondered if it was possible or not to do this (didn't know if some post install hooks try to execute native code). Thanks for the link. > >> >>> https://qemu.weilnetz.de/aarch64/ >>> >>> The only tool which was missing and which I had to build before running >>> the QEMU build is aarch64-w64-mingw32-windmc. >>> >>> It looks like the NSIS installer is i386 code, so I don't know whether >>> it can be used on Windows for aarch64. >>> >>> I also have no suitable Windows host for testing the binaries, so no >>> test was done.
Am 19.02.25 um 08:01 schrieb Pierrick Bouvier: > On 2/18/25 22:39, Stefan Weil wrote: >> Am 19.02.25 um 00:17 schrieb Pierrick Bouvier: >> >>> On 2/18/25 12:59, Stefan Weil wrote: >>>> >>>> I could run a QEMU cross compile on Debian with the llvm toolchain and >>>> msys2 clangarm64 packages installed with pacman. The resulting >>>> installer >>>> is here: >>>> >>> >>> Have you installed the msys2 clangarm64 packages on a windows machine >>> first, and then copy them to your Debian machine? >> >> >> No, the packages were directly installed on Linux like in this older >> script which shows how this can be done for i686 and x86-64:: >> >> https://github.com/stweil/qemu/blob/master/.github/workflows/pacman.sh >> >> Newer Debian distributions already provide a package for pacman which >> simply needs the right configuration. For older distributions I had to >> build pacman first. >> >> I should also have noted that I used a Linux aarch64 build host, so its >> binutils were able to find the DLL dependencies. This requirement will >> be fixed with a pure Python script for the same purpose. >> > > Oh excellent! I wondered if it was possible or not to do this (didn't > know if some post install hooks try to execute native code). > Thanks for the link. A few of them do this. Usually I simply ignore the resulting errors, but it's also possible to provide native Linux executables to get these hooks working.