diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-05-27 23:24:27 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-05-28 10:14:42 -0700 |
| commit | 1b5f9cb1f1529e03cd9a1d60a40d17624baffa65 (patch) | |
| tree | 62afaaf8265b17bfcefeadfb651f923b8368a98c /src/libstd/thread/scoped_tls.rs | |
| parent | efcc1d1bcb48122ae1c522b0f4a996188791f38a (diff) | |
| download | rust-1b5f9cb1f1529e03cd9a1d60a40d17624baffa65.tar.gz rust-1b5f9cb1f1529e03cd9a1d60a40d17624baffa65.zip | |
std: Add an option to disable ELF based TLS
This commit adds a ./configure option called `--disable-elf-tls` which disables ELF based TLS (that which is communicated to LLVM) on platforms which already support it. OSX 10.6 does not support this form of TLS, and some users of Rust need to target 10.6 and are unable to do so due to the usage of TLS. The standard library will continue to use ELF based TLS on OSX by default (as the officially supported platform is 10.7+), but this adds an option to compile the standard library in a way that is compatible with 10.6.
Diffstat (limited to 'src/libstd/thread/scoped_tls.rs')
| -rw-r--r-- | src/libstd/thread/scoped_tls.rs | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/libstd/thread/scoped_tls.rs b/src/libstd/thread/scoped_tls.rs index dda1db9aece..f0a4c318d91 100644 --- a/src/libstd/thread/scoped_tls.rs +++ b/src/libstd/thread/scoped_tls.rs @@ -60,9 +60,11 @@ pub struct ScopedKey<T> { inner: imp::KeyInner<T> } /// This macro declares a `static` item on which methods are used to get and /// set the value stored within. /// -/// See [ScopedKey documentation](thread/struct.ScopedKey.html) for more information. +/// See [ScopedKey documentation](thread/struct.ScopedKey.html) for more +/// information. #[macro_export] #[allow_internal_unstable] +#[cfg(not(no_elf_tls))] macro_rules! scoped_thread_local { (static $name:ident: $t:ty) => ( #[cfg_attr(not(any(windows, @@ -86,6 +88,20 @@ macro_rules! scoped_thread_local { ); } +#[macro_export] +#[allow_internal_unstable] +#[cfg(no_elf_tls)] +macro_rules! scoped_thread_local { + (static $name:ident: $t:ty) => ( + static $name: ::std::thread::ScopedKey<$t> = + ::std::thread::ScopedKey::new(); + ); + (pub static $name:ident: $t:ty) => ( + pub static $name: ::std::thread::ScopedKey<$t> = + ::std::thread::ScopedKey::new(); + ); +} + #[unstable(feature = "scoped_tls", reason = "scoped TLS has yet to have wide enough use to fully consider \ stabilizing its interface")] @@ -187,7 +203,8 @@ impl<T> ScopedKey<T> { target_os = "android", target_os = "ios", target_os = "openbsd", - target_arch = "aarch64")))] + target_arch = "aarch64", + no_elf_tls)))] mod imp { use std::cell::Cell; @@ -208,7 +225,8 @@ mod imp { target_os = "android", target_os = "ios", target_os = "openbsd", - target_arch = "aarch64"))] + target_arch = "aarch64", + no_elf_tls))] mod imp { use prelude::v1::*; |
