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>
Stubs drop from ~117 KB to ~52 KB on x86 and from ~133 KB to ~51 KB on
x64, mostly by discarding unreferenced libuuid.a constants, and every
installer shrinks by as much. See the patch header for details.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NSISdl compared WSAGetLastError() against EINPROGRESS and EWOULDBLOCK,
which mingw-w64's errno.h defines as the CRT's POSIX codes, so its
Winsock fallbacks never applied and no comparison could match. Every
NSISdl::download failed at once with "connecting to host", and fixing
only connect() leaves recv() closing the connection early. Patch all
five comparisons to use WSAEWOULDBLOCK.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NSIS links makensis with -s only if a test program so linked runs,
which a cross build cannot do, so makensis.exe shipped with its
symbol table and DWARF from its libraries. Strip it after install,
as with vimrun.exe. Nothing else NSIS installs carried symbols, and
the stubs and plugins are unchanged. makensis.exe shrinks from
1,536,466 to 835,072 bytes in the x64 kit, and from 1,414,912 to
889,856 bytes in the x86 kit. Its loaded sections are unchanged, and
it produces byte-identical installers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
None of them installs a page of its own, so each was written from its
source and checked by running the kit's build. With these, every program
in bin/ has a page.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A page for each applet in the kit, plus .so stubs for aliases such as
egrep and unxz. Each was written from the pinned busybox-w32 source with
the kit's patches and configuration, then checked against the source
and by experiment. The NOTES sections cover Windows behavior.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In busybox-w32, recursing into a bare drive such as C: walked the root
of the drive, while stat() treated C: as its current directory, so
"rm -rf C:" run in C:\some\dir deleted from the root of C:. cp, mv, ln,
install, find, grep -r, tar, chmod -R, du, diff -r, ls, wget -P,
mktemp -p and globs like C:* were affected too. Now C: is the drive's
current directory everywhere, as in Windows, and rm refuses it as it
refuses "." itself.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pages for xxd, make2compdb, peports, recycle, uuidgen, vc++filt,
debugbreak, nroff and w64devkit, written from their sources.
man/README.md describes the style for hand-written pages.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep the pages that GCC, Binutils and others install, add GDB's, Make's
and zstd's from their sources, and generate ctags, CMake and Ccache
pages from their documentation in a new stage with docutils, Sphinx and
asciidoctor. Aliases such as cc, g++ and vi get one-line .so stubs
instead of copies. The build fails if any installed page is not roff.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
man now looks in MANPATH and then the kit's share/man, formats pages
with the kit's nroff, finds target-prefixed names such as
x86_64-w64-mingw32-gcc under their base name, and pages through less -R.
less -R previously stripped SGR escapes. It now passes them through with
correct line widths and searching, so pages show bold and underline, and
so does colored output such as ls --color=always.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A small, self-contained roff formatter for BusyBox man to run in place
of groff. It covers what manual pages use: man(7), mdoc(7) and tbl, laid
out like groff and mandoc respectively. Over 98% of the lines in a
295,000-line corpus of real pages render identically to those tools. -w
lints a page, and it also formats pages that are not installed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Download the release instead of vendoring the amalgamated pkg-config.c,
and generate the amalgamation with its makefile. Also install its
manual page, and point make2compdb.c's credits at u-config itself.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Build from the release's source tarball rather than its amalgams, which
are generated with tugz's own CMake script, since only the tarball has
the new gzip, unzip and zip manual pages.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The release previously had an empty body, so GitHub showed the raw tag
message as plain text. Take the annotated tag's body (excluding subject
and signature) and pass it to gh release create so it renders as
Markdown. Fail before the slow signed builds if the tag has no body.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GCC 16 lowered the 32-bit cygming preferred stack boundary to 4 bytes,
and the i386 back end then places long long locals at 4-byte alignment
even though -malign-double, the default on these targets, makes
_Alignof(long long) 8. Such locals trap under -fsanitize=alignment.
Treat them as the back end already treats doubles.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With msvcrt, mingw-w64 defaults x86 to a 32-bit time_t, so ordinary
programs built today fail in January 2038. A new header patch makes
64-bit time_t the default, as with UCRT and MSVC, and everything in the
kit is built that way, including the kit's own tools. The 64-bit time
functions are emulated in libmsvcrt-os.a on top of XP-era imports, so
programs still run on Windows XP. Use _TIME_BITS=32 or
_USE_32BIT_TIME_T to opt out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
libstdc++ implemented system_clock::now() with gettimeofday, whose
timeval has a long tv_sec, and long is 32 bits on Windows. Both
system_clock and steady_clock (derived from it on this target) would
overflow in January 2038 on x64 as well as x86, no matter how time_t is
configured. A new patch reads the system time directly, preferring
GetSystemTimePreciseAsFileTime as mingw-w64's gettimeofday does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
thrd_sleep, mtx_timedlock, and cnd_timedwait take a struct timespec,
whose layout follows time_t. libmingwex.a was compiled for 32-bit
time_t only, so x86 programs built with 64-bit time_t read garbage
timeouts. The plain names keep the 32-bit ABI so existing objects still
link correctly, and threads.h redirects 64-bit time_t callers to new
*64 variants. x64 is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On 64-bit Windows a 32-bit process flagged large address aware gets 4GiB
of address space instead of 2GiB. Apply the flag in the x86 kit to the
memory-hungry programs that are safe above 2GiB: binutils, the shipped
GCC, gdb, zstd, and tugz's gzip, unzip, and zip. The flag goes on GCC's
host LDFLAGS, so programs built with the kit are unaffected. It is empty
in the x64 kit, where PE32+ images are already large address aware and
the linker rejects the option.
Tested with all free address space below 2GiB reserved before startup,
forcing allocations high, and smoke tested on Windows XP, which ignores
the flag without /3GB.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without -M or --long, the zstd CLI refuses frames with windows over
128MiB, and some files in the wild now require --long=30. A new patch
adds a ZSTDCLI_DECOMPRESS_WINDOWLOG build option for the decompression
default, set to 31 in the x64 kit only. Compression defaults, and so
compatibility of produced files with other zstd builds, are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tugz 1.1.0 adds Info-ZIP's ZipInfo mode to unzip, selected by program
name, so zipinfo is an alias.c alias of unzip, as gunzip and zcat are
of gzip. The release also speeds up deflate and inflate, including
x86-64 SIMD paths chosen at run time; it still runs on Windows XP.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes an nsExec::ExecToLog crash. makensis's default target now comes
from the build's TARGET_ARCH rather than its own pointer size, which
gives the same defaults here: amd64 in the x64 kit, x86 in the x86 kit.
Patches refreshed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bug fixes, including cleanup of temporary response files on Windows,
storage helper lock compatibility with versions before 4.14, and GCC
profile data lookup for objects in subdirectories. Patches refreshed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes two vulnerabilities: CVE-2026-102633, an integer overflow in
expat_realloc on 32-bit platforms, and CVE-2026-77214, a missing check
of XML_ParseBuffer's len against the available buffer. Also adds new
property and 64-bit location APIs, and drops the attribute info and
minimum size features, which were disabled by default and unused here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Quilt.cpp now honors --strip-trailing-cr in QUILT_DIFF_OPTS, set in
src/quiltrc, so a refresh against a CRLF file produces an LF-only
patch, and push still applies it with the file's CRLF line endings.
NSIS's Source/build.cpp no longer needs its carriage returns stripped
before patching. The NSIS patches are refreshed accordingly.
This release also makes push --refresh honor QUILT_REFRESH_ARGS.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Quilt.cpp is now an ordinary external dependency, fetched as a release
tarball. A POSIX build replaces Debian's quilt for applying every patch
queue in the image, and the same build generates the amalgamation that
is compiled into quilt.exe and shipped as src/quilt.cpp, as before.
Before switching, every queue was pushed with both Debian's quilt and
Quilt.cpp against its pinned source, producing identical trees and
output.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
src/quiltrc fixes refresh output (no Index: lines or timestamps, a/ b/
prefixes, diffstat) so that every contributor produces identical
patches. src/README.md describes driving the queues with it, the policy
of refreshing a component's whole queue when its version changes, and
how gcc-final stacks on gcc.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gendef's one patch was a second queue pushed onto the mingw tree in the
gendef build stage. It now sits at the end of the mingw queue, so the
tree is patched once like every other component.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tugz provides gzip, unzip, and a new Info-ZIP compatible zip. Built from
the release amalgamations; gunzip and zcat are alias.c aliases of gzip,
which selects its mode by program name. It runs on Windows XP, looking
up Vista-era functions at run time.
With those applets disabled, BusyBox tar runs the external gzip/gunzip
for .gz, as it already does for zstd. A new patch swaps the internal
inflater, now unused, for a stub that execs gunzip.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GDB waited with WaitForDebugEvent, so Windows converted
OutputDebugStringW strings to the inferior's ANSI code page first,
losing any character outside it. On Windows 10 and later, wait with
WaitForDebugEventEx instead, which opts in to Unicode strings, and
convert them from UTF-16 to the host charset.
WaitForDebugEventEx is looked up at runtime, so gdb.exe does not import
it and still runs on older Windows with the old behavior. gdbserver
shares the wait wrapper but does not opt in. Details in the patch
header.
Tested on Windows 10 and Windows XP.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without it, PDCurses decodes narrow strings with the CRT's mbtowc(),
which follows LC_CTYPE. When GDB 18.1 selects a UTF-8 host charset it
calls setlocale(LC_CTYPE, "C"), so in the TUI each byte of a UTF-8
sequence became its own character: π (CF 80) displayed as Ï.
PDC_FORCE_UTF8 makes PDCurses decode UTF-8 itself, independent of the
locale. Its decoder covers only the BMP. ccmake links the same library
and gets the same behavior.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Windows-relevant changes: the native target gains scheduler-locking,
non-stop mode (Windows 10+), and native TLS variable support; Windows
Terminal consoles get UTF-8 output handling; and backslashes in paths
are now normalized to forward slashes.
Support for stabs, mdebug, dbx, and CTF was removed. None affect this
toolchain, which emits DWARF. All three local patches still apply.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The sed chain grew with each tweak and fails silently: a pattern that
misses leaves the default in place, a wildcard like CONFIG_FTP\w* may
catch symbols added by a future upstream, and kconfig quietly discards
values it rejects. List the overrides in src/busybox.config instead.
Kconfig keeps the first assignment of each symbol and ignores later
ones, so prepending the overrides to the stock defconfig makes them
win. After configuring, every override must appear verbatim in .config,
or the build fails and prints the ones that did not take (unknown
symbol, out-of-range value, unmet dependency).
The resulting .config is identical to the sed chain's for both x64 and
x86.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The busybox-w32 defconfig caps HISTSIZE at 1023 and defaults to 384,
which is cramped for desktop use. Nothing in the history code is worse
than linear. The one cost that scales with history is fork emulation:
each forkshell child of an interactive shell (command substitution,
subshell, pipeline stage) receives a copy of the in-memory history. At
10k entries that adds roughly 0.3 ms to a ~5 ms spawn. The cap itself
only sizes a fixed pointer array, so raising it is nearly free, and
the 1024 default stays well under 1% per fork.
Upstream Kconfig limits FEATURE_EDITING_HISTORY to 2000, and kconfig
treats out-of-range values as unset, so patch the range.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without it GNU patch reads the final context line as incomplete, warns
"patch unexpectedly ends in middle of line", drops that line, and
reports fuzz 1 on the hunk. The hunk now applies with a plain offset.
This is the residual issue after 9d32fc5 fixed the file's line endings;
the leftover fuzz was the newline, not CRLF.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
"crossgcc" names a property both GCC builds share: /x-gcc is a plain
cross build and /gcc is a Canadian cross, so "cross" does not tell them
apart, and it points at the bootstrap compiler, which is the one queue
it does not apply to.
What separates the queues is reach. Both push onto the same tree, which
is never popped: src/gcc goes on before the bootstrap compiler and is
still applied when the shipped compiler configures, so it reaches both.
The second queue goes on top afterward and reaches only the compiler
that ships. Name it for that.
As a bonus the directories now sort in push order; crossgcc sorted
before gcc while being applied after it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>