[builtins] Try to ensure single copy of emulated TLS state
Multiple copies of emulated TLS state means inconsistent results when accessing the same thread-local variable from different shared objects (https://github.com/android/ndk/issues/1551). Making `__emutls_get_address` be a weak default visibility symbol should make the dynamic linker ensure only a single copy gets used at runtime. This is best-effort, but the more robust approach of putting emulated TLS into its own shared object would (a) be a much bigger change, and (b) shared objects are pretty heavyweight, and adding a new one to a space-constrained environment isn't an easy sell. Given the expected rarity of direct accesses to emulated TLS variables across different shared objects, the best-effort approach should suffice. Reviewed By: danalbert, rprichard Differential Revision: https://reviews.llvm.org/D107127
Loading
Please sign in to comment