diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-09-28 22:08:13 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-09-28 22:08:13 +0000 |
commit | ea117bf9ad162950a1fdd527f8b75d1bdf22456b (patch) | |
tree | 15a1200a1f8fa5699cd0ad28e13e070b063483fe /libcxx/src/algorithm.cpp | |
parent | 392caa538dfa29757f8f1e8635508affab2b1072 (diff) | |
download | llvm-ea117bf9ad162950a1fdd527f8b75d1bdf22456b.tar.gz |
Mark libc++ internal globals with _LIBCPP_SAFE_STATIC.
This patch applies the _LIBCPP_SAFE_STATIC attribute to internal globals,
most of which are locking primitives, in order to ensure that they can
safely be used during program startup.
This patch also fixes an unsafe static init issue with the global locks
used to implement atomic operations on shared pointers. Previously the
locks were initialized using a dynamically initialized pointer, so it was
possible that the pointer was uninitialized.
llvm-svn: 282640
Diffstat (limited to 'libcxx/src/algorithm.cpp')
-rw-r--r-- | libcxx/src/algorithm.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libcxx/src/algorithm.cpp b/libcxx/src/algorithm.cpp index e9752b0653e0..f036eb7abe1c 100644 --- a/libcxx/src/algorithm.cpp +++ b/libcxx/src/algorithm.cpp @@ -48,7 +48,7 @@ template bool __insertion_sort_incomplete<__less<long double>&, long double*>(lo template unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&); #ifndef _LIBCPP_HAS_NO_THREADS -static __libcpp_mutex_t __rs_mut = _LIBCPP_MUTEX_INITIALIZER; +_LIBCPP_SAFE_STATIC static __libcpp_mutex_t __rs_mut = _LIBCPP_MUTEX_INITIALIZER; #endif unsigned __rs_default::__c_ = 0; |