Skip to content

Commit 4cf0893

Browse files
authored
Merge pull request #16109
Update mingw-w64 to latest git commit
2 parents 9c8c9b7 + e92cc15 commit 4cf0893

File tree

2,175 files changed

+419300
-79524
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,175 files changed

+419300
-79524
lines changed

build.zig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,24 @@ pub fn build(b: *std.Build) !void {
537537

538538
b.step("fmt", "Modify source files in place to have conforming formatting")
539539
.dependOn(&do_fmt.step);
540+
541+
const update_mingw_step = b.step("update-mingw", "Update zig's bundled mingw");
542+
const opt_mingw_src_path = b.option([]const u8, "mingw-src", "path to mingw-w64 source directory");
543+
const update_mingw_exe = b.addExecutable(.{
544+
.name = "update_mingw",
545+
.target = b.host,
546+
.root_source_file = .{ .path = "tools/update_mingw.zig" },
547+
});
548+
const update_mingw_run = b.addRunArtifact(update_mingw_exe);
549+
update_mingw_run.addDirectoryArg(.{ .path = "lib" });
550+
if (opt_mingw_src_path) |mingw_src_path| {
551+
update_mingw_run.addDirectoryArg(.{ .cwd_relative = mingw_src_path });
552+
} else {
553+
// Intentionally cause an error if this build step is requested.
554+
update_mingw_run.addArg("--missing-mingw-source-directory");
555+
}
556+
557+
update_mingw_step.dependOn(&update_mingw_run.step);
540558
}
541559

542560
fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void {

ci/aarch64-windows.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
$TARGET = "$($Env:ARCH)-windows-gnu"
2-
$ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.12.0-dev.203+d3bc1cfc4"
2+
$ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.12.0-dev.2087+e9a18010b"
33
$MCPU = "baseline"
44
$ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip"
55
$PREFIX_PATH = "$(Get-Location)\..\$ZIG_LLVM_CLANG_LLD_NAME"

ci/x86_64-windows-debug.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
$TARGET = "$($Env:ARCH)-windows-gnu"
2-
$ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.12.0-dev.888+130227492"
2+
$ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.12.0-dev.2073+402fe565a"
33
$MCPU = "baseline"
44
$ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip"
55
$PREFIX_PATH = "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME"

ci/x86_64-windows-release.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
$TARGET = "$($Env:ARCH)-windows-gnu"
2-
$ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.12.0-dev.888+130227492"
2+
$ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.12.0-dev.2073+402fe565a"
33
$MCPU = "baseline"
44
$ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip"
55
$PREFIX_PATH = "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME"

lib/libc/include/any-windows-any/_mingw.h

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,6 @@
2727
#endif
2828

2929
/* C/C++ specific language defines. */
30-
#ifdef _WIN64
31-
#ifdef __stdcall
32-
#undef __stdcall
33-
#endif
34-
#define __stdcall
35-
#endif
36-
3730
#ifndef __GNUC__
3831
# ifndef __MINGW_IMPORT
3932
# define __MINGW_IMPORT __declspec(dllimport)
@@ -226,7 +219,7 @@ limitations in handling dllimport attribute. */
226219
# elif defined(_UCRT)
227220
# define __MSVCRT_VERSION__ 0xE00
228221
# else
229-
# define __MSVCRT_VERSION__ 0x700
222+
# define __MSVCRT_VERSION__ 0xE00
230223
# endif
231224
#endif
232225

@@ -236,7 +229,7 @@ limitations in handling dllimport attribute. */
236229
#endif
237230

238231
#ifndef _WIN32_WINNT
239-
#define _WIN32_WINNT 0x0603
232+
#define _WIN32_WINNT 0xa00
240233
#endif
241234

242235
#ifndef _INT128_DEFINED
@@ -577,6 +570,7 @@ extern "C" {
577570

578571

579572
#ifdef __MINGW_INTRIN_INLINE
573+
580574
#ifdef __has_builtin
581575
#define __MINGW_DEBUGBREAK_IMPL !__has_builtin(__debugbreak)
582576
#else
@@ -596,8 +590,52 @@ __MINGW_INTRIN_INLINE void __cdecl __debugbreak(void)
596590
__asm__ __volatile__("unimplemented");
597591
#endif
598592
}
593+
#endif /* __MINGW_DEBUGBREAK_IMPL == 1 */
594+
595+
#ifdef __has_builtin
596+
#define __MINGW_FASTFAIL_IMPL !__has_builtin(__fastfail)
597+
#else
598+
#define __MINGW_FASTFAIL_IMPL 1
599599
#endif
600+
#if __MINGW_FASTFAIL_IMPL == 1
601+
void __cdecl __MINGW_ATTRIB_NORETURN __fastfail(unsigned int code);
602+
__MINGW_INTRIN_INLINE void __cdecl __MINGW_ATTRIB_NORETURN __fastfail(unsigned int code)
603+
{
604+
#if defined(__i386__) || defined(__x86_64__)
605+
__asm__ __volatile__("int {$}0x29"::"c"(code));
606+
#elif defined(__arm__)
607+
register unsigned int r0 __asm__("r0") = code;
608+
__asm__ __volatile__("udf #0xfb"::"r"(r0));
609+
#elif defined(__aarch64__)
610+
register unsigned int w0 __asm__("w0") = code;
611+
__asm__ __volatile__("brk #0xf003"::"r"(w0));
612+
#else
613+
__asm__ __volatile__("unimplemented");
614+
#endif
615+
__builtin_unreachable();
616+
}
617+
#endif /* __MINGW_FASTFAIL_IMPL == 1 */
618+
619+
#ifdef __has_builtin
620+
#define __MINGW_PREFETCH_IMPL !__has_builtin(__prefetch)
621+
#else
622+
#define __MINGW_PREFETCH_IMPL 1
623+
#endif
624+
#if __MINGW_PREFETCH_IMPL == 1
625+
#if defined(__arm__) || defined(__aarch64__)
626+
void __cdecl __prefetch(const void *addr);
627+
__MINGW_INTRIN_INLINE void __cdecl __prefetch(const void *addr)
628+
{
629+
#if defined(__arm__)
630+
__asm__ __volatile__("pld [%0]"::"r"(addr));
631+
#elif defined(__aarch64__)
632+
__asm__ __volatile__("prfm pldl1keep, [%0]"::"r"(addr));
600633
#endif
634+
}
635+
#endif /* defined(__arm__) || defined(__aarch64__) */
636+
#endif /* __MINGW_PREFETCH_IMPL == 1 */
637+
638+
#endif /* defined(__MINGW_INTRIN_INLINE) */
601639

602640
/* mingw-w64 specific functions: */
603641
const char *__mingw_get_crt_info (void);

lib/libc/include/any-windows-any/_mingw_mac.h

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define __MINGW64_STRINGIFY(x) \
1212
__STRINGIFY(x)
1313

14-
#define __MINGW64_VERSION_MAJOR 10
14+
#define __MINGW64_VERSION_MAJOR 12
1515
#define __MINGW64_VERSION_MINOR 0
1616
#define __MINGW64_VERSION_BUGFIX 0
1717

@@ -294,7 +294,7 @@
294294
# define __mingw_static_ovr __mingw_ovr
295295
#endif /* __cplusplus */
296296

297-
#if __MINGW_GNUC_PREREQ(4, 3) && !defined(__clang__)
297+
#if __MINGW_GNUC_PREREQ(4, 3) || defined(__clang__)
298298
# define __mingw_attribute_artificial \
299299
__attribute__((__artificial__))
300300
#else
@@ -303,8 +303,23 @@
303303

304304
#define __MINGW_SELECTANY __attribute__((__selectany__))
305305

306+
#pragma push_macro("__has_builtin")
307+
#ifndef __has_builtin
308+
# define __has_builtin(x) 0
309+
#endif
310+
306311
#if _FORTIFY_SOURCE > 0 && __OPTIMIZE__ > 0 && __MINGW_GNUC_PREREQ(4, 1)
307-
# if _FORTIFY_SOURCE > 1
312+
# if _FORTIFY_SOURCE > 3
313+
# warning Using _FORTIFY_SOURCE=3 (levels > 3 are not supported)
314+
# endif
315+
# if _FORTIFY_SOURCE > 2
316+
# if __has_builtin(__builtin_dynamic_object_size)
317+
# define __MINGW_FORTIFY_LEVEL 3
318+
# else
319+
# warning Using _FORTIFY_SOURCE=2 (level 3 requires __builtin_dynamic_object_size support)
320+
# define __MINGW_FORTIFY_LEVEL 2
321+
# endif
322+
# elif _FORTIFY_SOURCE > 1
308323
# define __MINGW_FORTIFY_LEVEL 2
309324
# else
310325
# define __MINGW_FORTIFY_LEVEL 1
@@ -322,16 +337,26 @@
322337
void __cdecl __mingw_chk_fail_warn(void) __MINGW_ASM_CALL(__chk_fail) \
323338
__attribute__((__noreturn__)) \
324339
__attribute__((__warning__("Buffer overflow detected")))
325-
# define __mingw_bos(p, maxtype) \
326-
__builtin_object_size((p), ((maxtype) > 0) && (__MINGW_FORTIFY_LEVEL > 1))
327-
# define __mingw_bos_known(p) \
328-
(__mingw_bos(p, 0) != (size_t)-1)
340+
# if __MINGW_FORTIFY_LEVEL > 2
341+
# define __mingw_bos(p, maxtype) \
342+
__builtin_dynamic_object_size((p), (maxtype) > 0)
343+
# define __mingw_bos_known(p) \
344+
(__builtin_object_size(p, 0) != (size_t)-1 \
345+
|| !__builtin_constant_p(__mingw_bos(p, 0)))
346+
# else
347+
# define __mingw_bos(p, maxtype) \
348+
__builtin_object_size((p), ((maxtype) > 0) && (__MINGW_FORTIFY_LEVEL > 1))
349+
# define __mingw_bos_known(p) \
350+
(__mingw_bos(p, 0) != (size_t)-1)
351+
# endif
329352
# define __mingw_bos_cond_chk(c) \
330353
(__builtin_expect((c), 1) ? (void)0 : __chk_fail())
331354
# define __mingw_bos_ptr_chk(p, n, maxtype) \
332355
__mingw_bos_cond_chk(!__mingw_bos_known(p) || __mingw_bos(p, maxtype) >= (size_t)(n))
333356
# define __mingw_bos_ptr_chk_warn(p, n, maxtype) \
334-
(__mingw_bos_known(p) && __builtin_constant_p((n)) && __mingw_bos(p, maxtype) < (size_t)(n) \
357+
((__mingw_bos_known(p) \
358+
&& __builtin_constant_p(__mingw_bos(p, maxtype) < (size_t)(n)) \
359+
&& __mingw_bos(p, maxtype) < (size_t)(n)) \
335360
? __mingw_chk_fail_warn() : __mingw_bos_ptr_chk(p, n, maxtype))
336361
# define __mingw_bos_ovr __mingw_ovr \
337362
__attribute__((__always_inline__)) \
@@ -345,14 +370,19 @@
345370

346371
/* If _FORTIFY_SOURCE is enabled, some inline functions may use
347372
__builtin_va_arg_pack(). GCC may report an error if the address
348-
of such a function is used. Set _FORTIFY_VA_ARG=0 in this case. */
349-
#if __MINGW_FORTIFY_LEVEL > 0 && __MINGW_GNUC_PREREQ(4, 3) && !defined(__clang__) \
373+
of such a function is used. Set _FORTIFY_VA_ARG=0 in this case.
374+
Clang doesn't, as of version 15, yet implement __builtin_va_arg_pack(). */
375+
#if __MINGW_FORTIFY_LEVEL > 0 \
376+
&& ((__MINGW_GNUC_PREREQ(4, 3) && !defined(__clang__)) \
377+
|| __has_builtin(__builtin_va_arg_pack)) \
350378
&& (!defined(_FORTIFY_VA_ARG) || _FORTIFY_VA_ARG > 0)
351379
# define __MINGW_FORTIFY_VA_ARG 1
352380
#else
353381
# define __MINGW_FORTIFY_VA_ARG 0
354382
#endif
355383

384+
#pragma pop_macro("__has_builtin")
385+
356386
/* Enable workaround for ABI incompatibility on affected platforms */
357387
#ifndef WIDL_EXPLICIT_AGGREGATE_RETURNS
358388
#if defined(__GNUC__) && defined(__cplusplus)

lib/libc/include/any-windows-any/activation.h

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*** Autogenerated by WIDL 7.0 from include/activation.idl - Do not edit ***/
1+
/*** Autogenerated by WIDL 8.21 from include/activation.idl - Do not edit ***/
22

33
#ifdef _WIN32
44
#ifndef __REQUIRED_RPCNDR_H_VERSION__
@@ -16,6 +16,14 @@
1616
#ifndef __activation_h__
1717
#define __activation_h__
1818

19+
#ifndef __WIDL_INLINE
20+
#if defined(__cplusplus) || defined(_MSC_VER)
21+
#define __WIDL_INLINE inline
22+
#elif defined(__GNUC__)
23+
#define __WIDL_INLINE __inline__
24+
#endif
25+
#endif
26+
1927
/* Forward declarations */
2028

2129
#ifndef __IActivationFactory_FWD_DEFINED__
@@ -108,27 +116,27 @@ interface IActivationFactory {
108116
#define IActivationFactory_ActivateInstance(This,instance) (This)->lpVtbl->ActivateInstance(This,instance)
109117
#else
110118
/*** IUnknown methods ***/
111-
static FORCEINLINE HRESULT IActivationFactory_QueryInterface(IActivationFactory* This,REFIID riid,void **ppvObject) {
119+
static __WIDL_INLINE HRESULT IActivationFactory_QueryInterface(IActivationFactory* This,REFIID riid,void **ppvObject) {
112120
return This->lpVtbl->QueryInterface(This,riid,ppvObject);
113121
}
114-
static FORCEINLINE ULONG IActivationFactory_AddRef(IActivationFactory* This) {
122+
static __WIDL_INLINE ULONG IActivationFactory_AddRef(IActivationFactory* This) {
115123
return This->lpVtbl->AddRef(This);
116124
}
117-
static FORCEINLINE ULONG IActivationFactory_Release(IActivationFactory* This) {
125+
static __WIDL_INLINE ULONG IActivationFactory_Release(IActivationFactory* This) {
118126
return This->lpVtbl->Release(This);
119127
}
120128
/*** IInspectable methods ***/
121-
static FORCEINLINE HRESULT IActivationFactory_GetIids(IActivationFactory* This,ULONG *iidCount,IID **iids) {
129+
static __WIDL_INLINE HRESULT IActivationFactory_GetIids(IActivationFactory* This,ULONG *iidCount,IID **iids) {
122130
return This->lpVtbl->GetIids(This,iidCount,iids);
123131
}
124-
static FORCEINLINE HRESULT IActivationFactory_GetRuntimeClassName(IActivationFactory* This,HSTRING *className) {
132+
static __WIDL_INLINE HRESULT IActivationFactory_GetRuntimeClassName(IActivationFactory* This,HSTRING *className) {
125133
return This->lpVtbl->GetRuntimeClassName(This,className);
126134
}
127-
static FORCEINLINE HRESULT IActivationFactory_GetTrustLevel(IActivationFactory* This,TrustLevel *trustLevel) {
135+
static __WIDL_INLINE HRESULT IActivationFactory_GetTrustLevel(IActivationFactory* This,TrustLevel *trustLevel) {
128136
return This->lpVtbl->GetTrustLevel(This,trustLevel);
129137
}
130138
/*** IActivationFactory methods ***/
131-
static FORCEINLINE HRESULT IActivationFactory_ActivateInstance(IActivationFactory* This,IInspectable **instance) {
139+
static __WIDL_INLINE HRESULT IActivationFactory_ActivateInstance(IActivationFactory* This,IInspectable **instance) {
132140
return This->lpVtbl->ActivateInstance(This,instance);
133141
}
134142
#endif

0 commit comments

Comments
 (0)