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