1
0
mirror of https://github.com/skeeto/w64devkit.git synced 2026-10-23 06:08:56 +03:00
Commit Graph

541 Commits

Author SHA1 Message Date
Christopher Wellons
f28b0d02f9 Overload C functions on argument type with gnu::overloadable
Clang has an "overloadable" attribute that lets several C functions
share a name, chosen between by argument type, with C++ name mangling
applied so that the symbols stay distinct. GCC rejected the idea
upstream, so carry it here for the shipped compiler. The patch header
explains the implementation; in short, overload sets reuse the binding
chain pushdecl already maintains, a call is resolved beside the
type-directed overloading GCC does for the __atomic builtins, and
mangling is a new C-subset Itanium writer, since cp/mangle.cc is a
cc1plus object that would silently mangle C function types wrong.

Mangling matches g++ byte for byte across the types C can express, at
both -m32 and -m64, substitution compression and stdcall decoration
included. Dispatch agrees with Clang 23 on every case tried. The C
testsuite passes 42100 tests with no failures, the patched compiler
still builds libgcc and libstdc++, and the gcc.exe from a full kit
build passes the whole test corpus.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-19 11:39:07 -04:00
g-berthiaume
16ed33fa2d Add make2compdb, JSON Compilation Database tool
Closes #251.
2026-09-17 08:17:43 -04:00
Christopher Wellons
5561bfe3ab recycle: Mention in README.md 2026-09-17 08:17:34 -04:00
Christopher Wellons
bfd76abc0c Bump to 2.10.0 v2.10.0 2026-09-13 20:56:27 -04:00
Christopher Wellons
5e7953184d Add missing trailing newline to libgomp-gfortran-path.patch
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>
2026-09-03 08:52:58 -04:00
Christopher Wellons
3e233990e0 Rename the crossgcc patch queue to gcc-final
"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>
2026-09-03 08:43:31 -04:00
Christopher Wellons
21a80a34a8 gdb: allow zero repeat count in artificial arrays 2026-09-03 08:18:44 -04:00
Christopher Wellons
0863bbaad7 gcc: Fix compound literals ICE
int g(){__builtin_strlen((static struct{char i,d[]}){0,0}.d);}

Via gardenweb.
2026-09-03 08:17:31 -04:00
Christopher Wellons
8a587db9a7 Upgrade to CMake 4.4.3
Per the upstream release notes, the only documented change is that Swift
policy CMP0215's NEW behavior now also requires CMP0157 and CMP0195 to
be set to NEW. force-ninja.patch still applies.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-31 18:15:17 -04:00
Christopher Wellons
8be14c351d Upgrade to Expat 2.8.4
Security release fixing 4 vulnerabilities.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-31 18:14:53 -04:00
Christopher Wellons
5179007b22 Manage patch queues with quilt series files
Move each component's patches from flat, prefixed file names into a
per-component directory with a quilt series file, dropping the number
prefixes: application order is now stated by series rather than
enforced by lexicographic glob expansion. Outside the build, a queue
is managed by our own quilt against an unpacked tarball from source/
with QUILT_PATCHES=/path/to/src/<component>. The shipped kit carries
the same layout under $W64DEVKIT_HOME/src, consumable by the bundled
quilt.exe the same way.

Inside the build, apply queues with Debian's original quilt rather
than a native build of src/quilt.cpp, whose amalgamation is
Windows-only. This keeps battle-tested GNU patch as the engine, and
makes every image build a conformance check: series semantics mean
whatever the reference implementation says, and a queue our clone
manages must be accepted by original quilt. The .pc state is removed
after each push because source trees are never popped, and a stale
.pc from one queue blocks pushing a second queue onto the same tree,
which happens twice: gcc then crossgcc, mingw then gendef.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-30 17:25:31 -04:00
Christopher Wellons
54c7887e6d Drop the ANSI stubs from x86 NSIS builds
NSIS unconditionally builds ANSI stubs and plugin variants alongside
Unicode whenever the target CPU is x86, with no option to disable
them. ANSI installers are legacy compatibility w64devkit does not
need: makensis defaults to Unicode everywhere, and "Target x86-ansi"
fails cleanly with "adequate stub not found". This keeps the x86 kit
and the multilib kit's secondary x86 set Unicode-only, matching the
shape of the amd64 set.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-30 13:13:16 -04:00
Christopher Wellons
666c7c1983 Ship x86 NSIS stubs in the multilib kit
makensis is retargetable: the architecture of the installers it emits
is decided by which precompiled stub it attaches, stubs and plugins
are stored under target-suffixed names, and a script selects one with
"Target x86-unicode" (or CPU x86). Its default remains amd64, chosen
by the bitness of makensis itself. Add a second stub-and-plugin pass
so the multilib kit can emit 32-bit installers, which remain the
traditional choice even for 64-bit payloads since they run on every
Windows and can fail politely on 32-bit hosts.

The NSIS build derives each tool from XGCC_W32_PREFIX and never adds
-m32 on its own, so present the multilib compiler through an i686
interface: wrapper scripts that forward with -m32, --32, and
--target=pe-i386, mirroring the aliases the kit itself ships. The
x86-ansi extras come along unconditionally, matching the standalone
x86 kit's layout.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-30 13:13:16 -04:00
Christopher Wellons
7b39d30a7b Namespace the CMake profile flags
CMAKE_C_FLAGS and CMAKE_CXX_FLAGS are real CMake variable names, and
profile values sit in the environment of every RUN, including the other
cmake invocations that do not pass these flags explicitly. CMake does
not read them from the environment today, but it honors a growing list
of CMAKE_* environment variables, so real names are a latent hazard.
Rename them and document the naming discipline alongside the profiles,
which also covers why CRT_LIB32/CRT_LIB64 avoid their obvious names.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-30 13:13:16 -04:00
Peter0x44
f7ba9d67da Merge multilib support into x64 variant 2026-08-30 13:13:16 -04:00
Peter0x44
e293462e2b Simplify variant profile controls
Use the selected VARIANT directly for multilib-only control flow rather
than maintaining a separate EXTRA_32 boolean. Redeclare the global build
argument in the selected cross stage so each conditional can state the
actual profile requirement explicitly.

Represent GCC multilib and mingw-w64 CRT selections as enable or disable
state instead of storing complete configure options. Form the GCC and CRT
arguments at their call sites, which keeps punctuation out of the profile
data and makes the three configurations easier to compare.

Remove the standalone x86 WINNT_FLAGS override. The
mingw-default-win32-winnt patch already substitutes Windows XP for every
__i386__ compilation, so passing the same header default through configure
was redundant. Keep the separate Windows 7 CMake flags because CMake and
its bundled curl cannot build against the XP target.

Rename the remaining values that intentionally contain complete command
arguments to GCC_ARCH_FLAG, GCC_MANIFEST_FLAG, and ZSTD_THREAD_FLAG. The
component scope and representation are now visible in each name.

Verify the resulting x64, x86, and multilib Dockerfiles with build checks
and complete cross-toolchain builds. Confirm that only the multilib profile
executes the secondary 32-bit runtime and alias blocks and that each GCC and
CRT configure command receives the expected enable or disable options.
2026-08-30 13:13:16 -04:00
Peter0x44
aba4843ff8 Build multilib artifacts in CI
Treat the multilib profile as a first-class CI and release artifact
alongside the standalone x64 and x86 profiles.

Add a build-multilib job that selects VARIANT=multilib, uses an
independent GitHub Actions cache scope, extracts the generated
self-extracting archive, and uploads it with a multilib-specific name.
Run it after the x64 job so the workflow retains the existing ordering
while allowing the x86 and multilib builds to proceed independently.

Make tagged releases wait for the multilib build as well. Build the
signed target with VARIANT=multilib, pass the same trusted-signing
credentials used by the other profiles, and pack the result as
w64devkit-multilib-<version>.7z.exe. The existing release glob then
publishes the signed multilib archive with the x64, x86, and source
artifacts.
2026-08-30 13:13:16 -04:00
Peter0x44
2e424d7941 Replace variant arguments with build profiles
Replace the loosely coordinated collection of x86 build arguments with
a single VARIANT selector. Define x64, x86, and multilib configuration
stages, then select the requested stage as the common cross-compiler
base. This keeps each supported configuration closed and prevents
callers from combining incompatible architecture settings.

Make x64 the default standalone profile. It targets
x86_64-w64-mingw32, disables GCC multilib support, builds only the
64-bit CRT, and omits the secondary 32-bit libraries and aliases.

Keep the standalone x86 behavior in its own profile. It targets
i686-w64-mingw32, retains the Pentium 4 default, enables only the
32-bit CRT, preserves the Windows XP header default and manifest
behavior, selects the 32-bit BusyBox and NSIS configurations, disables
zstd threading, and raises _WIN32_WINNT only while building CMake.
CMake and its bundled curl require at least Windows Vista APIs, so the
C and C++ flags continue to target Windows 7 without changing the
XP-oriented default of the installed toolchain.

Define multilib as an x86_64 compiler with GCC multilib enabled, both
CRT library sets installed, and the existing i686 forwarding aliases.
Use a dedicated EXTRA_32 setting for the secondary lib32 libraries,
winpthreads builds, thread support object, and aliases instead of
inferring that work from the spelling of a GCC configure option.
Expose independent CRT_LIB32 and CRT_LIB64 settings so each profile
selects exactly the runtime libraries it needs.

Pass the profile's CMake C and C++ flags directly rather than building
an optional argument list through shell positional parameters. Keep all
other profile-specific values next to the selected base stage, including
GCC architecture and manifest flags, BusyBox configuration, zstd
options, and NSIS target architecture.

Simplify multibuild.sh to pass only VARIANT to Docker. Add -m for the
multilib flavor, make -a build all three profiles, and remove the old
argument-file and Dockerfile-patch fallback paths. Update unsigned and
signed CI builds to select x64 or x86 directly, remove the obsolete
variant-x86.args bundle, and document the new build interface.

Verify all three profiles with docker build --check and complete cross
toolchain builds. Smoke-test x64 and x86 compilation, plus both the
64-bit compiler and i686 alias in the multilib profile. Also build the
x64 and x86 CMake targets to exercise both the empty and Windows 7
CMake flag configurations.
2026-08-30 13:13:16 -04:00
Christopher Wellons
c308f151ef Use x86 build args instead of the patch in CI
The variant patch no longer exists, so both x86 builds read
src/variant-x86.args into a step output, which build-push-action
accepts verbatim as its newline-delimited build-args input. The args
file remains the single definition of the variant.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-30 13:13:16 -04:00
Christopher Wellons
5daabd5683 Replace the variant patch with Dockerfile build args
Hoist every variant-sensitive value into an ARG at the top of the cross
stage, with defaults producing the x64 kit, and gate the multilib-only
sidecar builds on MULTILIB. The x86 variant becomes a set of NAME=value
overrides in src/variant-x86.args, which multibuild.sh turns into
--build-arg options. A plain "docker build" continues to work untouched,
downloads stay shared between variants, and the patch mechanism remains
available as a fallback for a future variant needing structural changes.

One hazard of this approach: ARGs leak into the environment of every
subsequent RUN in the stage, and configure scripts read arbitrary
environment variables. mingw-w64-crt decides whether to build the Win64
runtime by testing whether a shell variable named LIB64 is merely set,
so an ARG of that name forced lib64 on past an explicit --disable-lib64.
Hence CRT_LIB64. Keep ARG names clear of names configure might consult.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-30 13:13:16 -04:00
Christopher Wellons
60cfbd242c Remove dllwrap from the distribution
It's been deprecated for 6 years and unmaintained for 20 years.
2026-08-30 13:13:16 -04:00
Peter0x44
47e0092d6d Fix i686 multilib tool aliases 2026-08-30 13:13:16 -04:00
Peter0x44
0f358cbe71 Default x86 Windows target version in headers 2026-08-30 13:13:16 -04:00
Peter0x44
83f3251d4a Add x86 multilib toolchain support
Keep x86_64 as the default output while enabling the GCC and mingw-w64
32-bit multilib under lib32. Build 32-bit support archives, CRT
libraries, and winpthreads for both the bootstrap and final sysroots so
each compiler stage has a complete i686 runtime.

Use pentium4 as the 32-bit architecture baseline. Add a GCC specs rule
that defaults _WIN32_WINNT to 0x0501 only under -m32 and only when the
caller has not supplied a value, preserving the existing x64 default and
explicit overrides.

Retain the x86_64-w64-mingw32-prefixed tools and add a separate build
step for an i686-w64-mingw32 interface. Compiler drivers inject -m32.
Target-sensitive binutils select their 32-bit modes explicitly: as uses
--32, ld uses -m i386pe, dlltool uses -m i386 with --as-flags=--32, and
windres uses --target=pe-i386. Input-driven inspection and archive tools
forward without a target override.

These forwarding executables provide both prefixed interfaces without
duplicating a second binutils installation. They deliberately remain
selectors for the underlying x86_64-configured multilib compiler rather
than spoofing its configured target identity.

Direct, Autoconf, CMake, and Libtool probes using the i686-prefixed
interface all produced PE-i386 output.
2026-08-30 13:13:16 -04:00
Christopher Wellons
90c83d12a6 Swap GNU downloads to a mirror
The main GNU site has been down for a few days.
2026-08-28 06:52:43 -04:00
Christopher Wellons
700c0611fc Fetch sources with ADD --checksum instead of curl
BuildKit keys ADD --checksum on the checksum and the URL basename, not
on the host, so re-pointing a download at another mirror is a cache hit
and does not even resolve the host. Swapping mirrors during an ftp.gnu.org
outage no longer costs a re-download of everything, which is the trap
that made the recent debian:trixie-slim digest bump so expensive.

Stages that fetched several tarballs in one curl now get one ADD each,
so a mirror change re-fetches a single file rather than all of dl-cross.

Names come from ADD's dest where the URL basename differs, replacing
curl --remote-header-name. This matters beyond cosmetics: every stage's
/dl/*.* is copied into /source/, so these names ship in the source
distribution. GitHub archive refs are the four affected downloads.

ADD cannot run a shell, so expat's tag gains an EXPAT_TAG arg rather
than deriving it from EXPAT_VERSION with tr.

Drops curl from base. BuildKit verifies TLS with its own trust store,
so the downloads are now authenticated rather than passing --insecure.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-27 22:46:07 -04:00
Christopher Wellons
9aec47017c Add a .dockerignore
The build context was the whole working tree, including source/ (227MB
of release tarballs), release artifacts, and .git. BuildKit only sends
files matched by a COPY, so little of this was transferred, but it was
still walked and hashed on every build, and a COPY with a broad pattern
would silently pull in the lot.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-27 22:32:17 -04:00
Christopher Wellons
c17ba6fb19 Fetch busybox-w32 from GitHub instead of frippery.org
The archives are identical except for .frp_describe, which is gitignored
and absent from GitHub archives. Without it the Makefile finds neither a
git checkout nor a source directory named after the tag, and the version
degrades from 1.38.0.git-6075-g169694ebd to 1.38.0.git. Recreate the
file after extraction.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-27 21:11:48 -04:00
Christopher Wellons
58ad9865a5 Self-locate GCC driver so the toolchain works without PATH
The driver trusted argv[0], which requires a PATH search when it lacks
a directory component, as with w64devkit command aliases. Instead ask
Win32 for the true module path. Also search the driver's own directory
for subprograms, because as and ld live in bin/ rather than a tooldir.
Invoked by absolute path, the toolchain no longer needs its bin/ in
PATH, and remains relocatable.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-27 20:59:35 -04:00
Christopher Wellons
af35517988 Upgrade to ccache 4.14
- Windows path rewriting is now case-insensitive and Unicode-aware, and
  ignore_headers_in_manifest matches case-insensitively on Windows.
- Detects C23 #embed directives and assembler .incbin directives,
  preventing false cache hits.
- Removed the cpp_extension (CCACHE_EXTENSION) option; preprocessor
  output is now processed in memory instead of via temporary files.
- Fixed a size overflow when allocating very large files on Windows.

Both Windows console output patches were regenerated against 4.14.
2026-08-23 15:29:42 -04:00
Peter0x44
8611d4d242 Fixes for ccache output on Windows consoles
Ccache captures compiler diagnostics and writes them to the terminal
itself. Its Unix-style isatty and TERM checks do not reliably describe
Win32 console capabilities, and its byte-oriented output path cannot
preserve Unicode outside the active code page.

The color bug can be reproduced in a legacy console without virtual
terminal processing:

    printf 'int main(void) { return undeclared; }\n' > error.c
    TERM=cygwin ccache gcc -c error.c

The diagnostic contains literal escape sequences such as ?[01m?[K
instead of colored text.

The Unicode bug can be reproduced with a non-ASCII identifier:

    printf 'float π(void) { return 3; }\nvoid f(void) { float unused = π(); }\n' > unicode.c
    ccache gcc -Wall -Wextra -c unicode.c
    ccache gcc -Wall -Wextra -c unicode.c

The source line emitted by ccache renders π as mojibake on both captured
and cached diagnostic output.

Add two ccache patches. The first detects native console handles with
GetConsoleMode, enables virtual terminal processing when available, and
otherwise translates supported SGR and erase-line sequences with Win32
console APIs. Redirected output remains unchanged.

The second decodes valid UTF-8 and writes non-ASCII text to native
consoles with WriteConsoleW. ASCII, invalid UTF-8, and redirected output
retain the existing byte-oriented path.

Apply both patches when building ccache.

Fixes skeeto/w64devkit#413.
2026-08-16 15:32:43 -05:00
Christopher Wellons
1f5f751172 Upgrade to Expat 2.8.3
Security release fixing CVE-2026-72522.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 14:30:33 -04:00
Christopher Wellons
3c04ff709b Move trap terminate handler out of vterminate.cc
Defining __trap_terminate_handler in vterminate.cc places it in the
same archive member as the verbose terminate handler, so the default
terminate handler dragged __cxa_demangle, __mingw_sprintf, and gdtoa
into every program that can throw, despite --disable-libstdcxx-verbose.
Define it in eh_term_handler.cc instead, alongside the initializer that
references it, so vterminate.o stays out of default links. A trivial
C++ program shrinks from 190K to 104K.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 18:24:58 -04:00
Christopher Wellons
d0d13ce550 Drop arch-prefixed elfedit and readelf aliases
The actual tools are not included and these aliases point at nothing.
Plucked from #412.
2026-08-11 18:56:58 -04:00
Christopher Wellons
6082530e86 Bump to 2.9.1 v2.9.1 2026-08-09 20:04:42 -04:00
Christopher Wellons
9d32fc517a Swap libgomp patch from CRLF to LF
The upstream source is LF so there is no reason for this to be CRLF.
2026-08-07 14:09:05 -04:00
Christopher Wellons
5a10dca37f Upgrade to GCC 16.2.0
All seven gcc-*/crossgcc-* patches still apply, with line offsets only.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-07 13:09:08 -04:00
Christopher Wellons
27c2e0de7a Add a .gitignore
This ignores the output of multibuild.sh and a copy of the source/
directory extracted from the "source" Docker target, which I typically
keep on hand.
2026-08-02 19:57:31 -04:00
Christopher Wellons
a2884c316a Upgrade to CMake 4.4.2
Per the upstream release notes: "This version made no changes to
documented features or interfaces. Some implementation updates were
made to support ecosystem changes and/or fix regressions."

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-02 19:33:04 -04:00
Christopher Wellons
f53bfd0308 binutils: number windmc messages per facility
Message ids for .mc files that use a relative MessageId across a change
of Facility will change. See the patch for details.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-02 19:28:51 -04:00
Christopher Wellons
398961a84f binutils: carry windmc severity, facility forward
Fixes #409, closes #410.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-02 19:28:51 -04:00
Christopher Wellons
819813aec6 binutils: patch windmc to accept BOM (#408) 2026-08-01 14:52:56 -04:00
Christopher Wellons
1233cbea80 Upgrade to CMake 4.4.1
> The FindPython, FindPython3 modules learned to manage, on Windows
> systems, the pydebug ABI flag.
2026-07-29 09:58:11 -04:00
Peter0x44
e11fe5b843 ci: tolerate cache export failures
Sometimes, github actions cache is flaky and fails to export the cache.
Add ignore-error=true so a failing cache upload doesn't fail the CI run
and send a noisy email.
2026-07-27 12:47:52 -05:00
Christopher Wellons
c1a00cccd0 Bump to 2.9.0 v2.9.0 2026-07-26 22:34:55 -04:00
Christopher Wellons
c05722d917 Drop libbacktrace COFF hack after bigobj changes 2026-07-26 21:12:46 -04:00
Peter0x44
e1c35823b2 Remove llama.mak
Upstream has made some choices that make maintaining llama.mak
increasingly impractical. It's not really needed now that w64devkit has
cmake anyway.
2026-07-26 20:09:20 -05:00
Peter0x44
d37cd99adc Drop patches Binutils 2.47 obsoleted
Binutils 2.47 includes several fixes for PE-COFF weak external fixes
from 2e2848327d8f, afec39e439ea, and 65043894aaac. The last of these
fixes GCC PR124263 so gcc-contract-violation-handler is no longer
needed.

It also includes 18ca02157d9c, which automatically promotes oversized
PE-COFF objects to BigObj. The limit was also increased to the safe
limit for regular COFF in d9d09c878e56.
2026-07-26 20:02:44 -05:00
Christopher Wellons
f0cdd55068 Upgrade to Binutils 2.47
https://lists.gnu.org/archive/html/info-gnu/2026-07/msg00006.html
2026-07-26 20:28:57 -04:00
Christopher Wellons
adadb3e9f5 Upgrade to CMake 4.4.0
The debugger breakpoint path normalization fix landed upstream (as
cmSystemTools::ToNormalizedPathOnDisk), so drop the local patch.
cmake-force-ninja.patch is still needed.

CMake 4.4.0 bundles curl 8.20.0, whose curl_setup.h now hard-errors
if _WIN32_WINNT < 0x0600. CMake's bundled copy explicitly disables
curl's CURL_TARGET_WINDOWS_VERSION option (wrapped in "if(0) XXX
not needed for build within cmake"), so the flag has to reach C
compilation directly. Add CMAKE_C_FLAGS matching the existing
CMAKE_CXX_FLAGS override.
2026-07-21 09:09:14 -04:00