Skip to content

Commit c46d66a

Browse files
committed
Revert "[builtins] Try to ensure single copy of emulated TLS state"
This reverts commit b8f04a6 for Apple Clang. This upstream change now causes dylibs in our SDK to unnecessarily export this symbol from the builtin static archives. The long term solution should be to disable emulated TLS support on Darwin entirely since its already supported natively. Resolves: <rdar://92713838> (cherry picked from commit 14942c5)
1 parent fc6c14f commit c46d66a

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

compiler-rt/lib/builtins/emutls.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -374,21 +374,6 @@ emutls_get_address_array(uintptr_t index) {
374374
return array;
375375
}
376376

377-
#ifndef _WIN32
378-
// Our emulated TLS implementation relies on local state (e.g. for the pthread
379-
// key), and if we duplicate this state across different shared libraries,
380-
// accesses to the same TLS variable from different shared libraries will yield
381-
// different results (see https://github.com/android/ndk/issues/1551 for an
382-
// example). __emutls_get_address is the only external entry point for emulated
383-
// TLS, and by making it default visibility and weak, we can rely on the dynamic
384-
// linker to coalesce multiple copies at runtime and ensure a single unique copy
385-
// of TLS state. This is a best effort; it won't work if the user is linking
386-
// with -Bsymbolic or -Bsymbolic-functions, and it also won't work on Windows,
387-
// where the dynamic linker has no notion of coalescing weak symbols at runtime.
388-
// A more robust solution would be to create a separate shared library for
389-
// emulated TLS, to ensure a single copy of its state.
390-
__attribute__((visibility("default"), weak))
391-
#endif
392377
void *__emutls_get_address(__emutls_control *control) {
393378
uintptr_t index = emutls_get_index(control);
394379
emutls_address_array *array = emutls_get_address_array(index--);

0 commit comments

Comments
 (0)