diff options
| author | Tim Shen <timshen91@gmail.com> | 2017-01-31 01:53:36 +0000 |
|---|---|---|
| committer | Tim Shen <timshen91@gmail.com> | 2017-01-31 01:53:36 +0000 |
| commit | f63f58a28f57891a2efc933bdd8c631013daa684 (patch) | |
| tree | 3f967027608580a1f4d1c32b3da6fea1960d7983 | |
| parent | fa3d93a148d47a60022900815c4dd4f49f9ac08c (diff) | |
| download | bcm5719-llvm-f63f58a28f57891a2efc933bdd8c631013daa684.tar.gz bcm5719-llvm-f63f58a28f57891a2efc933bdd8c631013daa684.zip | |
[compiler-rt] Don't change g_tls_size after initialization.
Summary:
g_tls_size is not supposed to be changed after initialization. It's not
atomic, not guarded by a lock, nor thread_local. But it's read by
multiple threads.
The reason why it's mutated is mips and powerpc64 specific. We can
implement the same funcitonality without mutating g_tls_size.
I'm not sure how to write a test for this. Please advice. Thanks!
Reviewers: eugenis, kcc
Subscribers: kubamracek, dberris, llvm-commits
Differential Revision: https://reviews.llvm.org/D29236
llvm-svn: 293586
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc index f99f0b5948d..a5e284025ff 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc @@ -270,9 +270,7 @@ static uptr TlsPreTcbSize() { # endif const uptr kTlsAlign = 16; const uptr kTlsPreTcbSize = - (ThreadDescriptorSize() + kTcbHead + kTlsAlign - 1) & ~(kTlsAlign - 1); - InitTlsSize(); - g_tls_size = (g_tls_size + kTlsPreTcbSize + kTlsAlign -1) & ~(kTlsAlign - 1); + RoundUpTo(ThreadDescriptorSize() + kTcbHead, kTlsAlign); return kTlsPreTcbSize; } #endif @@ -379,6 +377,8 @@ uptr GetTlsSize() { uptr addr, size; GetTls(&addr, &size); return size; +#elif defined(__mips__) || defined(__powerpc64__) + return RoundUpTo(g_tls_size + TlsPreTcbSize(), 16); #else return g_tls_size; #endif |

