summaryrefslogtreecommitdiff
path: root/packaging/0023-vm-threads-change-tls-model-for-gCurrentThreadInfo-v.patch
blob: 9976ee1fb9002ad307f87da789ee0577960d59c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From df179b357e12c57b5e0caa8a1427a344bdae812f Mon Sep 17 00:00:00 2001
From: Konstantin Baladurin <k.baladurin@partner.samsung.com>
Date: Tue, 13 Feb 2018 16:14:37 +0300
Subject: [PATCH 23/47] vm/threads: change tls model for gCurrentThreadInfo
 variable

We should use initial-exec tls model to avoid memory allocations
during first access to this variable because it may ocuur in
signal handlers.
---
 src/vm/threads.inl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/vm/threads.inl b/src/vm/threads.inl
index 26682ec..0105955 100644
--- a/src/vm/threads.inl
+++ b/src/vm/threads.inl
@@ -27,7 +27,7 @@
 #ifndef __llvm__
 EXTERN_C __declspec(thread) ThreadLocalInfo gCurrentThreadInfo;
 #else // !__llvm__
-EXTERN_C __thread ThreadLocalInfo gCurrentThreadInfo;
+EXTERN_C __thread ThreadLocalInfo gCurrentThreadInfo __attribute__ ((tls_model("initial-exec")));
 #endif // !__llvm__
 
 EXTERN_C inline Thread* STDCALL GetThread()
-- 
2.7.4