Skip to content

Commit 6f4339b

Browse files
committed
update mingw-w64 crt files to v9.0.0
1 parent d7f00c4 commit 6f4339b

Some content is hidden

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

50 files changed

+857
-3925
lines changed

lib/libc/mingw/crt/crtdll.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
#define _DLL
1111
#endif
1212

13-
#ifdef HAVE_CONFIG_H
14-
#include "config.h"
15-
#endif
16-
1713
#include <oscalls.h>
1814
#include <internal.h>
1915
#include <stdlib.h>
@@ -44,12 +40,6 @@ extern _CRTALLOC(".CRT$XIZ") _PIFV __xi_z[];
4440
extern _CRTALLOC(".CRT$XCA") _PVFV __xc_a[];
4541
extern _CRTALLOC(".CRT$XCZ") _PVFV __xc_z[];
4642

47-
#ifndef HAVE_CTOR_LIST
48-
__attribute__ (( __section__ (".ctors"), __used__ , aligned(sizeof(void *)))) const void * __CTOR_LIST__ = (void *) -1;
49-
__attribute__ (( __section__ (".dtors"), __used__ , aligned(sizeof(void *)))) const void * __DTOR_LIST__ = (void *) -1;
50-
__attribute__ (( __section__ (".ctors.99999"), __used__ , aligned(sizeof(void *)))) const void * __CTOR_END__ = (void *) 0;
51-
__attribute__ (( __section__ (".dtors.99999"), __used__ , aligned(sizeof(void *)))) const void * __DTOR_END__ = (void *) 0;
52-
#endif
5343

5444
/* TLS initialization hook. */
5545
extern const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback;

lib/libc/mingw/crt/crtexe.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
#define _DLL
1010
#endif
1111

12-
#ifdef HAVE_CONFIG_H
13-
#include "config.h"
14-
#endif
15-
1612
#define SPECIAL_CRTEXE
1713

1814
#include <oscalls.h>
@@ -34,7 +30,7 @@ extern wchar_t *** __MINGW_IMP_SYMBOL(__winitenv);
3430
#define __winitenv (* __MINGW_IMP_SYMBOL(__winitenv))
3531
#endif
3632

37-
#if !defined(__initenv) && !defined(__arm__) && !defined(__aarch64__)
33+
#if !defined(__initenv)
3834
extern char *** __MINGW_IMP_SYMBOL(__initenv);
3935
#define __initenv (* __MINGW_IMP_SYMBOL(__initenv))
4036
#endif
@@ -66,12 +62,6 @@ extern _CRTALLOC(".CRT$XIZ") _PIFV __xi_z[];
6662
extern _CRTALLOC(".CRT$XCA") _PVFV __xc_a[];
6763
extern _CRTALLOC(".CRT$XCZ") _PVFV __xc_z[];
6864

69-
#ifndef HAVE_CTOR_LIST
70-
__attribute__ (( __section__ (".ctors"), __used__ , aligned(sizeof(void *)))) const void * __CTOR_LIST__ = (void *) -1;
71-
__attribute__ (( __section__ (".dtors"), __used__ , aligned(sizeof(void *)))) const void * __DTOR_LIST__ = (void *) -1;
72-
__attribute__ (( __section__ (".ctors.99999"), __used__ , aligned(sizeof(void *)))) const void * __CTOR_END__ = (void *) 0;
73-
__attribute__ (( __section__ (".dtors.99999"), __used__ , aligned(sizeof(void *)))) const void * __DTOR_END__ = (void *) 0;
74-
#endif
7565

7666
/* TLS initialization hook. */
7767
extern const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback;
@@ -327,9 +317,7 @@ __tmainCRTStartup (void)
327317
gcc inserts this call automatically for a function called main, but not for wmain. */
328318
mainret = wmain (argc, argv, envp);
329319
#else
330-
#if !defined(__arm__) && !defined(__aarch64__)
331320
__initenv = envp;
332-
#endif
333321
mainret = main (argc, argv, envp);
334322
#endif
335323
if (!managedapp)

lib/libc/mingw/crt/gccmain.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
#include <stdlib.h>
99
#include <setjmp.h>
1010

11-
#ifdef HAVE_CONFIG_H
12-
#include "config.h"
13-
#endif
14-
1511
typedef void (*func_ptr) (void);
1612
extern func_ptr __CTOR_LIST__[];
1713
extern func_ptr __DTOR_LIST__[];
@@ -32,25 +28,6 @@ __do_global_dtors (void)
3228
}
3329
}
3430

35-
#ifndef HAVE_CTOR_LIST
36-
// If the linker didn't provide __CTOR_LIST__, we provided it ourselves,
37-
// and then we also know we have __CTOR_END__ available.
38-
extern func_ptr __CTOR_END__[];
39-
extern func_ptr __DTOR_END__[];
40-
41-
void __do_global_ctors (void)
42-
{
43-
static func_ptr *p = __CTOR_END__ - 1;
44-
while (*p != (func_ptr) -1) {
45-
(*(p))();
46-
p--;
47-
}
48-
atexit (__do_global_dtors);
49-
}
50-
51-
#else
52-
// old method that iterates the list twice because old linker scripts do not have __CTOR_END__
53-
5431
void
5532
__do_global_ctors (void)
5633
{
@@ -70,8 +47,6 @@ __do_global_ctors (void)
7047
atexit (__do_global_dtors);
7148
}
7249

73-
#endif
74-
7550
static int initialized = 0;
7651

7752
void

lib/libc/mingw/crt/tls_atexit.c

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ extern char __mingw_module_is_dll;
3535
static CRITICAL_SECTION lock;
3636
static int inited = 0;
3737
static dtor_obj *global_dtors = NULL;
38-
static __thread dtor_obj *tls_dtors = NULL;
38+
static DWORD tls_dtors_slot = TLS_OUT_OF_INDEXES;
3939

4040
int __mingw_cxa_atexit(dtor_fn dtor, void *obj, void *dso) {
4141
if (!inited)
@@ -73,24 +73,29 @@ int __mingw_cxa_thread_atexit(dtor_fn dtor, void *obj, void *dso) {
7373
return 1;
7474
handler->dtor = dtor;
7575
handler->obj = obj;
76-
handler->next = tls_dtors;
77-
tls_dtors = handler;
76+
handler->next = (dtor_obj *)TlsGetValue(tls_dtors_slot);
77+
TlsSetValue(tls_dtors_slot, handler);
7878
return 0;
7979
}
8080

8181
static void WINAPI tls_atexit_callback(HANDLE __UNUSED_PARAM(hDllHandle), DWORD dwReason, LPVOID __UNUSED_PARAM(lpReserved)) {
8282
if (dwReason == DLL_PROCESS_DETACH) {
83-
run_dtor_list(&tls_dtors);
83+
dtor_obj * p = (dtor_obj *)TlsGetValue(tls_dtors_slot);
84+
run_dtor_list(&p);
85+
TlsSetValue(tls_dtors_slot, p);
86+
TlsFree(tls_dtors_slot);
8487
run_dtor_list(&global_dtors);
8588
}
8689
}
8790

8891
static void WINAPI tls_callback(HANDLE hDllHandle, DWORD dwReason, LPVOID __UNUSED_PARAM(lpReserved)) {
92+
dtor_obj * p;
8993
switch (dwReason) {
9094
case DLL_PROCESS_ATTACH:
9195
if (inited == 0) {
9296
InitializeCriticalSection(&lock);
9397
__dso_handle = hDllHandle;
98+
tls_dtors_slot = TlsAlloc();
9499
/*
95100
* We can only call _register_thread_local_exe_atexit_callback once
96101
* in a process; if we call it a second time the process terminates.
@@ -124,16 +129,19 @@ static void WINAPI tls_callback(HANDLE hDllHandle, DWORD dwReason, LPVOID __UNUS
124129
* main, or when a DLL is unloaded), and when exiting bypassing some of
125130
* the cleanup, by calling _exit or ExitProcess. In the latter cases,
126131
* destructors (both TLS and global) in loaded DLLs still get called,
127-
* but only TLS destructors get called for the main executable, global
128-
* variables' destructors don't run. (This matches what MSVC does with
129-
* a dynamically linked CRT.)
132+
* but none get called for the main executable. This matches what the
133+
* standard says, but differs from what MSVC does with a dynamically
134+
* linked CRT (which still runs TLS destructors for the main thread).
130135
*/
131-
run_dtor_list(&tls_dtors);
132136
if (__mingw_module_is_dll) {
137+
p = (dtor_obj *)TlsGetValue(tls_dtors_slot);
138+
run_dtor_list(&p);
139+
TlsSetValue(tls_dtors_slot, p);
133140
/* For DLLs, run dtors when detached. For EXEs, run dtors via the
134141
* thread local atexit callback, to make sure they don't run when
135142
* exiting the process with _exit or ExitProcess. */
136143
run_dtor_list(&global_dtors);
144+
TlsFree(tls_dtors_slot);
137145
}
138146
if (inited == 1) {
139147
inited = 0;
@@ -143,9 +151,11 @@ static void WINAPI tls_callback(HANDLE hDllHandle, DWORD dwReason, LPVOID __UNUS
143151
case DLL_THREAD_ATTACH:
144152
break;
145153
case DLL_THREAD_DETACH:
146-
run_dtor_list(&tls_dtors);
154+
p = (dtor_obj *)TlsGetValue(tls_dtors_slot);
155+
run_dtor_list(&p);
156+
TlsSetValue(tls_dtors_slot, p);
147157
break;
148158
}
149159
}
150160

151-
_CRTALLOC(".CRT$XLE") PIMAGE_TLS_CALLBACK __xl_e = (PIMAGE_TLS_CALLBACK) tls_callback;
161+
_CRTALLOC(".CRT$XLB") PIMAGE_TLS_CALLBACK __xl_b = (PIMAGE_TLS_CALLBACK) tls_callback;

lib/libc/mingw/include/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ extern wchar_t *** __MINGW_IMP_SYMBOL(__winitenv);
101101
#define __winitenv (* __MINGW_IMP_SYMBOL(__winitenv))
102102
#endif
103103

104-
#if !defined(__initenv) && !defined(__arm__)
104+
#if !defined(__initenv)
105105
extern char *** __MINGW_IMP_SYMBOL(__initenv);
106106
#define __initenv (* __MINGW_IMP_SYMBOL(__initenv))
107107
#endif

lib/libc/mingw/lib-common/bcrypt.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ BCryptGenerateKeyPair
3434
BCryptGenerateSymmetricKey
3535
BCryptGetFipsAlgorithmMode
3636
BCryptGetProperty
37+
BCryptHash
3738
BCryptHashData
3839
BCryptImportKey
3940
BCryptImportKeyPair

lib/libc/mingw/lib-common/dxgi.def

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
LIBRARY "dxgi.dll"
22
EXPORTS
3+
ApplyCompatResolutionQuirking
34
CompatString
45
CompatValue
56
D3DKMTCloseAdapter
@@ -13,10 +14,14 @@ D3DKMTSignalSynchronizationObject
1314
D3DKMTUnlock
1415
D3DKMTWaitForSynchronizationObject
1516
DXGIDumpJournal
17+
PIXBeginCapture
18+
PIXEndCapture
19+
PIXGetCaptureState
1620
DXGIRevertToSxS
1721
OpenAdapter10
1822
OpenAdapter10_2
1923
SetAppCompatStringPointer
24+
UpdateHMDEmulationStatus
2025
CreateDXGIFactory
2126
CreateDXGIFactory1
2227
CreateDXGIFactory2
@@ -50,5 +55,6 @@ DXGID3D10CreateLayeredDevice
5055
DXGID3D10ETWRundown
5156
DXGID3D10GetLayeredDeviceSize
5257
DXGID3D10RegisterLayers
58+
DXGIDeclareAdapterRemovalSupport
5359
DXGIGetDebugInterface1
5460
DXGIReportAdapterConfiguration

lib/libc/mingw/lib-common/mf.def

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ AppendPropVariant
99
ConvertPropVariant
1010
CopyPropertyStore
1111
CreateNamedPropertyStore
12+
; DllCanUnloadNow
13+
; DllGetActivationFactory
14+
; DllGetClassObject
15+
; DllRegisterServer
16+
; DllUnregisterServer
1217
ExtractPropVariant
1318
MFCreate3GPMediaSink
1419
MFCreateAC3MediaSink
@@ -36,6 +41,7 @@ MFCreateCredentialCache
3641
MFCreateDeviceSource
3742
MFCreateDeviceSourceActivate
3843
MFCreateDrmNetNDSchemePlugin
44+
MFCreateEncryptedMediaExtensionsStoreActivate
3945
MFCreateFMPEG4MediaSink
4046
MFCreateFileBlockMap
4147
MFCreateFileSchemePlugin

lib/libc/mingw/libarm32/mfcore.def renamed to lib/libc/mingw/lib-common/mfcore.def

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,24 @@ AppendPropVariant
99
ConvertPropVariant
1010
CopyPropertyStore
1111
CreateNamedPropertyStore
12+
; DllCanUnloadNow
13+
; DllGetActivationFactory
14+
; DllGetClassObject
15+
; DllRegisterServer
16+
; DllUnregisterServer
1217
ExtractPropVariant
1318
MFCopyMFMetadata
19+
MFCopyPropertyStore
20+
MFCopyStreamMetadata
1421
MFCreateAggregateSource
1522
MFCreateAppSourceProxy
1623
MFCreateAudioRenderer
1724
MFCreateAudioRendererActivate
1825
MFCreateDeviceSource
1926
MFCreateDeviceSourceActivate
27+
MFCreateEncryptedMediaExtensionsStoreActivate
28+
MFCreateExtendedCameraIntrinsicModel
29+
MFCreateExtendedCameraIntrinsics
2030
MFCreateFileSchemePlugin
2131
MFCreateMFMetadataOnPropertyStore
2232
MFCreateMediaProcessor
@@ -25,6 +35,7 @@ MFCreatePMPHost
2535
MFCreatePMPMediaSession
2636
MFCreatePMPServer
2737
MFCreatePresentationClock
38+
MFCreatePresentationClockAsyncTimeSource
2839
MFCreateSampleCopierMFT
2940
MFCreateSampleGrabberSinkActivate
3041
MFCreateSequencerSegmentOffset

0 commit comments

Comments
 (0)