Skip to content

Commit

Permalink
Auto merge of #117873 - quininer:android-emutls, r=Amanieu
Browse files Browse the repository at this point in the history
Add emulated TLS support

This is a reopen of rust-lang/rust#96317 . many android devices still only use 128 pthread keys, so using emutls can be helpful.

Currently LLVM uses emutls by default for some targets (such as android, openbsd), but rust does not use it, because `has_thread_local` is false.

This commit has some changes to allow users to enable emutls:

1. add `-Zhas-thread-local` flag to specify that std uses `#[thread_local]` instead of pthread key.
2. when using emutls, decorate symbol names to find thread local symbol correctly.
3. change `-Zforce-emulated-tls` to `-Ztls-model=emulated` to explicitly specify whether to generate emutls.

r? `@Amanieu`
  • Loading branch information
bors committed Dec 9, 2023
2 parents 42eb240 + 1c20e9a commit 1f9797c
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 1f9797c

Please sign in to comment.