[all-commits] [llvm/llvm-project] b8f04a: [builtins] Try to ensure single copy of emulated T...

Shoaib Meenai via All-commits all-commits at lists.llvm.org
Fri Jul 30 14:54:56 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b8f04a670f27a84412099dd025fa762ee58f4c1a
      https://github.com/llvm/llvm-project/commit/b8f04a670f27a84412099dd025fa762ee58f4c1a
  Author: Shoaib Meenai <smeenai at fb.com>
  Date:   2021-07-30 (Fri, 30 Jul 2021)

  Changed paths:
    M compiler-rt/lib/builtins/emutls.c

  Log Message:
  -----------
  [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




More information about the All-commits mailing list