Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable #[thread_local] for all windows-msvc targets #92042

Merged
merged 2 commits into from
Dec 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/aarch64_pc_windows_msvc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use crate::spec::Target;
pub fn target() -> Target {
let mut base = super::windows_msvc_base::opts();
base.max_atomic_width = Some(64);
base.has_elf_tls = true;
base.features = "+neon,+fp-armv8".to_string();

Target {
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/aarch64_uwp_windows_msvc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use crate::spec::Target;
pub fn target() -> Target {
let mut base = super::windows_uwp_msvc_base::opts();
base.max_atomic_width = Some(64);
base.has_elf_tls = true;

Target {
llvm_target: "aarch64-pc-windows-msvc".to_string(),
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/i686_uwp_windows_msvc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pub fn target() -> Target {
let mut base = super::windows_uwp_msvc_base::opts();
base.cpu = "pentium4".to_string();
base.max_atomic_width = Some(64);
base.has_elf_tls = true;

Target {
llvm_target: "i686-pc-windows-msvc".to_string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ pub fn target() -> Target {
options: TargetOptions {
features: "+vfp3,+neon".to_string(),
max_atomic_width: Some(64),
has_elf_tls: true,
// FIXME(jordanrh): use PanicStrategy::Unwind when SEH is
// implemented for windows/arm in LLVM
panic_strategy: PanicStrategy::Abort,
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_target/src/spec/windows_msvc_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub fn opts() -> TargetOptions {
// linking some libraries which require a specific agreement, so it may
// not ever be possible for us to pass this flag.
no_default_libraries: false,
has_elf_tls: true,
Copy link
Member

@nagisa nagisa Dec 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this field wants a rename to something like has_thread_local or something of a similar nature?

EDIT: reading the issue, yeah it is fine to rename target fields.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has_thread_local sounds ok to me! If anybody wants to bikeshed the name I don't mind changing it again but it's probably not worth arguing about it too much 🙂.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure that this field is never used in some ELF-specific way?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, well if it is then it was wrong to use it for msvc targets. But I did do a search and the only place it's used (other than specs) is here:

if sess.target.has_elf_tls {
ret.insert((sym::target_thread_local, None));
}

As far as I understand it, Rust defers to LLVM for actually generating the TLS access (it uses the LLVM IR thread_local).


..base
}
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/x86_64_pc_windows_msvc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pub fn target() -> Target {
let mut base = super::windows_msvc_base::opts();
base.cpu = "x86-64".to_string();
base.max_atomic_width = Some(64);
base.has_elf_tls = true;

Target {
llvm_target: "x86_64-pc-windows-msvc".to_string(),
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_target/src/spec/x86_64_uwp_windows_msvc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pub fn target() -> Target {
let mut base = super::windows_uwp_msvc_base::opts();
base.cpu = "x86-64".to_string();
base.max_atomic_width = Some(64);
base.has_elf_tls = true;

Target {
llvm_target: "x86_64-pc-windows-msvc".to_string(),
Expand Down