mirror of
https://github.com/skeeto/w64devkit.git
synced 2026-10-24 17:39:18 +03:00
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>