Skip to content

Commit

Permalink
Auto merge of #30678 - Amanieu:no_elf_tls, r=alexcrichton
Browse files Browse the repository at this point in the history
I also re-enabled the use of `#[thread_local]` on AArch64. It was originally disabled in the PR that introduced AArch64 (#19790), but the reasons for this were not explained. `#[thread_local]` seems to work fine in my tests on AArch64, so I don't think this should be an issue.

cc @alexcrichton @akiss77
  • Loading branch information
bors committed Jan 12, 2016
2 parents d6cb279 + e304fb4 commit 3246eae
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 45 deletions.
4 changes: 0 additions & 4 deletions mk/crates.mk
Expand Up @@ -175,9 +175,5 @@ endef

$(foreach crate,$(TOOLS),$(eval $(call RUST_TOOL,$(crate))))

ifdef CFG_DISABLE_ELF_TLS
RUSTFLAGS_std := --cfg no_elf_tls
endif

CRATEFILE_libc := $(SREL)src/liblibc/src/lib.rs
RUSTFLAGS_libc := --cfg stdbuild
3 changes: 1 addition & 2 deletions src/librustc_back/target/aarch64_unknown_linux_gnu.rs
Expand Up @@ -11,8 +11,7 @@
use target::Target;

pub fn target() -> Target {
let mut base = super::linux_base::opts();
base.has_elf_tls = false;
let base = super::linux_base::opts();
Target {
llvm_target: "aarch64-unknown-linux-gnu".to_string(),
target_endian: "little".to_string(),
Expand Down
1 change: 1 addition & 0 deletions src/librustc_back/target/android_base.rs
Expand Up @@ -17,5 +17,6 @@ pub fn opts() -> TargetOptions {
base.pre_link_args.push("-Wl,--allow-multiple-definition".to_string());
base.is_like_android = true;
base.position_independent_executables = true;
base.has_elf_tls = false;
base
}
1 change: 0 additions & 1 deletion src/librustc_back/target/arm_linux_androideabi.rs
Expand Up @@ -13,7 +13,6 @@ use target::Target;
pub fn target() -> Target {
let mut base = super::android_base::opts();
base.features = "+v7".to_string();
base.has_elf_tls = false;

Target {
llvm_target: "arm-linux-androideabi".to_string(),
Expand Down
41 changes: 3 additions & 38 deletions src/libstd/thread/scoped_tls.rs
Expand Up @@ -87,32 +87,9 @@ macro_rules! scoped_thread_local {
issue = "0")]
#[macro_export]
#[allow_internal_unstable]
#[cfg(no_elf_tls)]
macro_rules! __scoped_thread_local_inner {
($t:ty) => {{
static _KEY: $crate::thread::__ScopedKeyInner<$t> =
$crate::thread::__ScopedKeyInner::new();
fn _getit() -> &'static $crate::thread::__ScopedKeyInner<$t> { &_KEY }
$crate::thread::ScopedKey::new(_getit)
}}
}

#[doc(hidden)]
#[unstable(feature = "thread_local_internals",
reason = "should not be necessary",
issue = "0")]
#[macro_export]
#[allow_internal_unstable]
#[cfg(not(no_elf_tls))]
macro_rules! __scoped_thread_local_inner {
($t:ty) => {{
#[cfg_attr(not(any(windows,
target_os = "android",
target_os = "ios",
target_os = "netbsd",
target_os = "openbsd",
target_arch = "aarch64")),
thread_local)]
#[cfg_attr(target_thread_local, thread_local)]
static _KEY: $crate::thread::__ScopedKeyInner<$t> =
$crate::thread::__ScopedKeyInner::new();
fn _getit() -> &'static $crate::thread::__ScopedKeyInner<$t> { &_KEY }
Expand Down Expand Up @@ -221,13 +198,7 @@ impl<T> ScopedKey<T> {
}
}

#[cfg(not(any(windows,
target_os = "android",
target_os = "ios",
target_os = "netbsd",
target_os = "openbsd",
target_arch = "aarch64",
no_elf_tls)))]
#[cfg(target_thread_local)]
#[doc(hidden)]
mod imp {
use cell::Cell;
Expand All @@ -246,13 +217,7 @@ mod imp {
}
}

#[cfg(any(windows,
target_os = "android",
target_os = "ios",
target_os = "netbsd",
target_os = "openbsd",
target_arch = "aarch64",
no_elf_tls))]
#[cfg(not(target_thread_local))]
#[doc(hidden)]
mod imp {
use cell::Cell;
Expand Down

0 comments on commit 3246eae

Please sign in to comment.