Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Side by Side Diff: syzygy/integration_tests/deferred_free_tests.cc

Issue 2989023003: Add correct linker symbols fot tls for win64. (Closed)
Patch Set: Add correct linker symbols fot tls for win64. Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 Google Inc. All Rights Reserved. 1 // Copyright 2016 Google Inc. All Rights Reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 } 44 }
45 45
46 // This will be set as the TLS callback. It calls the real implementation only 46 // This will be set as the TLS callback. It calls the real implementation only
47 // if |tls_callback_enabled| is set. 47 // if |tls_callback_enabled| is set.
48 void NTAPI TlsCallback(PVOID, DWORD dwReason, PVOID) { 48 void NTAPI TlsCallback(PVOID, DWORD dwReason, PVOID) {
49 if (tls_callback_enabled) 49 if (tls_callback_enabled)
50 TlsCallbackImpl(dwReason); 50 TlsCallbackImpl(dwReason);
51 } 51 }
52 52
53 // Magic to set the TLS callback. 53 // Magic to set the TLS callback.
54 #ifdef _WIN64
55 #pragma comment(linker, "/INCLUDE:_tls_used")
56 #pragma comment(linker, "/INCLUDE:tls_callback_func")
57 #else
54 #pragma comment(linker, "/INCLUDE:__tls_used") 58 #pragma comment(linker, "/INCLUDE:__tls_used")
55 #pragma comment(linker, "/INCLUDE:_tls_callback_func") 59 #pragma comment(linker, "/INCLUDE:_tls_callback_func")
60 #endif
61
62 #ifdef _WIN64
63 #pragma const_seg(".CRT$XLF")
64 #else
56 #pragma data_seg(".CRT$XLF") 65 #pragma data_seg(".CRT$XLF")
66 #endif
67
57 EXTERN_C PIMAGE_TLS_CALLBACK tls_callback_func = TlsCallback; 68 EXTERN_C PIMAGE_TLS_CALLBACK tls_callback_func = TlsCallback;
69
70 #ifdef _WIN64
71 #pragma const_seg()
72 #else
58 #pragma data_seg() 73 #pragma data_seg()
74 #endif //_WIN64
59 75
60 } // namespace 76 } // namespace
61 77
62 // Implementation of the AsanDeferredFreeTLS test. Returns 0 on success, 1 on 78 // Implementation of the AsanDeferredFreeTLS test. Returns 0 on success, 1 on
63 // failure. 79 // failure.
64 size_t AsanDeferredFreeTLSImpl() { 80 size_t AsanDeferredFreeTLSImpl() {
65 tls_callback_ran = false; 81 tls_callback_ran = false;
66 82
67 // Enable the deferred free thread. This will spawn up a new thread, which 83 // Enable the deferred free thread. This will spawn up a new thread, which
68 // will trigger the TLS callback (this event is ignored by our TLS 84 // will trigger the TLS callback (this event is ignored by our TLS
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // Returns 0 on success, 1 on failure. 125 // Returns 0 on success, 1 on failure.
110 size_t AsanDeferredFreeTLS() { 126 size_t AsanDeferredFreeTLS() {
111 tls_callback_enabled = true; 127 tls_callback_enabled = true;
112 size_t ret = AsanDeferredFreeTLSImpl(); 128 size_t ret = AsanDeferredFreeTLSImpl();
113 tls_callback_enabled = false; 129 tls_callback_enabled = false;
114 130
115 return ret; 131 return ret;
116 } 132 }
117 133
118 } // namespace testing 134 } // namespace testing
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698