The main thread's thread_local destructors must finish before any static destructor starts, but statics and atexit handlers registered after the first thread_local was constructed ran first, because cross builds of libstdc++ used their atexit-based fallback. Use the CRT's __cxa_thread_atexit instead. On msvcrt that is only correct with mingw-w64 a394c23a51, merged after v14.0.0, so backport it without its Makefile.am change. Tested on Windows 11 and XP, x64 and x86. One XP limitation is noted in the gcc patch header. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Patch queues
Each subdirectory here is a quilt patch queue for one component: a
series file listing patches in application order, plus the patches. The
Dockerfile applies each queue to a freshly unpacked source tree using
Quilt.cpp, though the original Quilt works on them too. Order comes
from series, never from file names.
Working on a queue
Drive a queue straight out of this directory by pointing QUILT_PATCHES
at it from inside an unpacked source tree, with --quiltrc selecting the
shared settings in quiltrc so that everyone produces identical patches:
$ W=/path/to/w64devkit
$ tar xf $W/source/cmake-4.4.4.tar.gz
$ cd cmake-4.4.4/
$ export QUILT_PATCHES=$W/src/cmake
$ quilt --quiltrc $W/src/quiltrc push -a
From there use quilt as usual (push, pop, refresh, new, edit,
etc.). refresh writes directly into this directory, so check git status afterward.
Always start from a freshly unpacked tree. Quilt records applied patches
in .pc/, and a tree reused with a different QUILT_PATCHES acts on the
queue recorded there.
Updating a component
When a component's version changes, refresh its entire queue against the new source in the same commit:
$ quilt --quiltrc $W/src/quiltrc push -a --refresh
Read the output before committing. "Hunk succeeded at N (offset M)" is harmless and is what the refresh cleans up. "with fuzz" means patch discarded context to make a hunk fit, so check that the hunk landed where intended before accepting the refreshed result.
GCC's two queues
gcc and gcc-final apply to the same GCC tree. gcc goes on first and
affects both the bootstrap cross-compiler and the distributed compiler.
gcc-final goes on top afterward, just before the distributed compiler
is configured, and affects only that compiler. Patches in gcc-final
therefore apply to an already-patched tree, and must be refreshed that
way:
$ QUILT_PATCHES=$W/src/gcc quilt --quiltrc $W/src/quiltrc push -a --refresh
$ rm -rf .pc
$ QUILT_PATCHES=$W/src/gcc-final quilt --quiltrc $W/src/quiltrc push -a --refresh
Removing .pc between queues mirrors the Dockerfile, which never pops.
The w64devkit distribution includes this directory and quilt.exe, so
the same commands work inside the kit.