forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#96317 - name1e5s:android_tls_on_1, r=Amanieu
set has_thread_local=true for android It seems that llvm uses emulated tls on android by default since [this commit](https://reviews.llvm.org/D42999). Which uses a `pthread_key` to emulate various tls objects at runtime([code](https://github.com/llvm-mirror/compiler-rt/blob/master/lib/builtins/emutls.c)). I've built a demo with a custom android target setting `has_thread_local=true` and a slightly modified `std` as what this PR does, and it works fine. The generated function symbol `__emutls_get_address` would link to an implementation in `libgcc.a` , which is also [required by std](https://github.com/rust-lang/rust/blob/master/library/unwind/build.rs#L18) for now. By enable `has_thread_local`, we can reduce the number of `pthread_key`s used by rust libraries on android, which are quite limited resources(128 per process). I've been investgating some crashes caused by unable to create more pthread_key in our project with about 80 `pthread_key`s used by rust part. cc rust-lang#96145 [rust-lang/compiler-builtins#458](rust-lang/compiler-builtins#458)
- Loading branch information
Showing
4 changed files
with
5 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters