8 * Components which depend upon TLS must express a dependency on the symbol
9 * _tls_used. This will cause said symbol to be emitted.
11 * The linker (in the case of both Microsoft's linker and Binutils, at least)
12 * will point the TLS directory entry in the PE header to _tls_used.
14 * NOTE: On Windows versions < NT 6.0, the TLS support _only_ works for
15 * the main executable and any DLLs loaded as dependencies of it
18 extern char __tls_start__[], __tls_end__[];
19 ULONG _tls_index = TLS_OUT_OF_INDEXES;
21 extern void NTAPI _PDCLIB_runTlsCallbacks(void * image, DWORD reason, PVOID pv);
22 static PIMAGE_TLS_CALLBACK tlsCallbacks[] = {
23 &_PDCLIB_runTlsCallbacks,
28 __attribute__((__section__(".rdata$T")))
30 __declspec(allocate(".rdata$T"))
33 const IMAGE_TLS_DIRECTORY64 _tls_used = {
35 const IMAGE_TLS_DIRECTORY _tls_used = {
37 (uintptr_t) &__tls_start__,
38 (uintptr_t) &__tls_end__,
39 (uintptr_t) &_tls_index, // TLS index
40 (uintptr_t) &tlsCallbacks[0], // TLS callback array
41 (ULONG) 0, // Size of zero fill
42 (ULONG) 0 // Characteristics
47 #include "_PDCLIB_test.h"
49 /* Tested in tss_get.c */