Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mingw-w64 to latest git commit #16109

Merged
merged 14 commits into from
Jan 9, 2024
Merged

Update mingw-w64 to latest git commit #16109

merged 14 commits into from
Jan 9, 2024

Conversation

andrewrk
Copy link
Member

@andrewrk andrewrk commented Jun 20, 2023

Originally, this branch updated to v11.0.1, however @mstorsjo suggested synchronizing with git snapshots rather than waiting for tagged releases, so this updates to the latest mingw-w64 git commit at the time of writing which is dddccbc3ef50ac52bf00723fd2f68d98140aab80. Let's try this for a few releases of Zig and see how we like it.

Notably, this changes our mingw-w64 build to default to using ucrtbase.dll as much as possible.

This branch also includes a new tool which can be invoked like this:

zig build update-mingw -Dmingw-src=$HOME/Downloads/mingw-w64

This streamlines updating the C runtime portion of mingw-w64 upgrades, making it slightly easier to keep up with git snapshots. It also encodes the rules about what files are included or excluded, making it easier for people other than me to perform this upgrade.

This branch requires all the CI zip files for Windows to be updated because those zip files contain pre-built LLVM, which needed to be built against the new mingw-w64 SDK.

While working on this I discovered a potential installation size optimization:

v11.0.1 Upstream Changelog

  • New libdloadhelper.a, like libdelayimp.a but using Windows 8 and later
    APIs.
  • Fix race condition when building lib32 and lib64 in parallel on Windows.
  • *recalloc now only available from msvcr90 and later, UCRT.
  • Redirect access() to __mingw_access() on UCRT wrt to X_OK problems.
  • New Hyper-V APIs.
  • SEH based setjmp on ARM if supported by compiler.
  • --enable-cfguard to enable Control Flow Guard in CRT, requires
    compiler support, clang only at this time.
  • Implement some of the stack protector functions/variables so -lssp is
    now optional when _FORTIFY_SOURCE or -fstack-protector-strong is used.
  • _FORTIFY_SOURCE=3 support added if __builtin_dynamic_object_size is
    supported by the compiler (gcc 12 or later).
  • genstubdll removed.
  • uchar_c16rtomb, uchar_c32rtomb, uchar_mbrtoc16 and uchar_mbrtoc32
    removed for MSVCR*, UCRT only for now.
  • Updates to DX12 headers and much more from Wine.
  • Many other new win32 APIs.

source

@andrewrk andrewrk force-pushed the mingw-w64-v11.0.1 branch 3 times, most recently from 667bed4 to 402fe56 Compare January 8, 2024 01:45
@andrewrk andrewrk changed the title Update mingw-w64 to v11.0.1 Update mingw-w64 to latest git commit Jan 8, 2024
Upstream commit dddccbc3ef50ac52bf00723fd2f68d98140aab80

Martin Storsjö suggested synchronizing with git snapshots rather than
waiting for tagged releases. Let's try this for a few releases of Zig
and see how we like it.

These headers were configured with `--with-default-msvcrt=ucrt`.

See related issue #18477.
Upstream commit dddccbc3ef50ac52bf00723fd2f68d98140aab80

* adds ucrtbase.def.in
* mingwex: replace mingw crt files with ucrt files
* adds missing mingw-w64 ucrt files

The rules that govern which set of files are included or excluded is
contained in the logic for tools/update_mingw.zig
Martin Storsjö kindly took the time to discuss things at length with me,
and the results are that this status quo is correct. I added comments so
that I don't think it should be changed later.
This makes C/C++ files when targeting mingw-w64 choose to depend on ucrt
for stdio.
prevents it from being defined twice when building mingw-w64 libs.
We would rather use the ucrt for these, but sometimes dependencies on
the mingw stdio functions creep in. 仕方ない.

The cost is only paid if they are used; otherwise the symbols are
garbage-collected at link time.
Separate commits for the zig logic and the copied files.
The tarballs have to be rebuilt because now we want to use the ucrt.
I observed a duplicate symbol linker error; pow was defined both by
mingwex.lib and ucrtbase.dll.
Contains the mingw upgrade to use ucrt.
@andrewrk andrewrk enabled auto-merge January 8, 2024 20:29
@andrewrk andrewrk merged commit 4cf0893 into master Jan 9, 2024
10 checks passed
@andrewrk andrewrk deleted the mingw-w64-v11.0.1 branch January 9, 2024 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant