Lines Matching refs:with
12 ELF TLS is a system for automatically allocating thread-local variables with cooperation among the
15 Thread-local variables are declared in C and C++ with a specifier, e.g.:
41 it can correctly relocate TLS accesses. Both variants are incompatible with Bionic's current
44 Each thread has a "Dynamic Thread Vector" (DTV) with a pointer to each module's TLS block (or NULL
154 variable with a dynamic initializer has an associated TLS guard variable.)
159 object), then its offset from the TP is known at load-time. The variable can be accessed with a few
174 // allocated in the .got, resolved at load-time with a dynamic reloc.
201 * Code compiled with `-fpic` could be in a shared object, so use GD/LD.
202 * The per-file default can be overridden with `-ftls-model=<model>`.
204 * A variable can be annotated with `__attribute__((tls_model(...)))`. Clang may still use a more
207 # Shared Objects with Static TLS
209 Shared objects are sometimes compiled with `-ftls-model=initial-exec` (i.e. "static TLS") for better
211 objects using static TLS can't be loaded with `dlopen` unless libc has reserved enough surplus
212 memory in the static TLS block. glibc reserves a kilobyte or two (`TLS_STATIC_SURPLUS`) with the
216 * web search: [`"dlopen: cannot load any more object with static TLS"`][glibc-static-tls-error]
228 …s-error]: https://www.google.com/search?q=%22dlopen:+cannot+load+any+more+object+with+static+TLS%22
272 To support modules loaded with `dlopen`, the loader must use a resolver function that calls
317 The loader needs to allocate a table of `TlsDescDynamicArg` objects for each TLS module with dynamic
335 object file compiled with `-fpic` is linked into an executable, the linker could relax GD accesses
337 static relocations, then replaces the sequence with a different one of equal size. It may need to
346 Linker support for GD->LE relaxation with `-mtls-dialect=gnu/trad` (traditional):
355 Linker support for GD->LE relaxation with `-mtls-dialect=gnu2/desc` (TLSDESC):
436 these sorts of problems with glibc's libpthread?)
438 ## Reading the Thread Pointer with Ptrace
449 C/C++ TLS variables are declared with a specifier:
478 * On arm64, the primary TLS relocation (R_AARCH64_TLSDESC) is [confused with an obsolete
519 region, along with a thread's stack if it needs one allocated. It doesn't place TLS memory on a
520 preallocated stack (either the main thread's stack or one provided with `pthread_attr_setstack`).
578 most of it) also can't use ELF TLS. It might be possible to lift this restriction, perhaps with
583 ## Bionic Memory Layout Conflicts with Common TLS Layout
585 Bionic already allocates thread-specific data in a way that conflicts with TLS variants 1 and 2:
592 The `bionic_tls.h` header is marked with a warning:
607 There are issues with rearranging this memory:
610 by GCC on x86 (and x86-64), where it is compatible with x86's TLS variant 2. We [modified Clang
611 to use this slot for arm64 in 2016][D18632], though, and the slot isn't compatible with ARM's
622 breakage happening with Android N.](https://go-review.googlesource.com/c/go/+/38636) (XXX: I
623 suspect the actual platform breakage happened with Android M's [lock-free pthread key
633 * It's unclear how many Android apps use Go. There are at least two with 1,000,000+ installs.
652 The TLS prototype currently uses a patched LLD that uses a variant 1 TLS layout with a 16-word TCB
656 (https://godbolt.org/z/_NIXjF). If Android ever supports this target, and in a configuration with
675 * arm64: a new TLS relocation reduces compiler/assembler compatibility with non-Android
729 * Binaries linked with the flag crash on non-Bionic, and binaries without the flag crash on Bionic.
734 * Add a [`.note.gnu.property`](https://reviews.llvm.org/D53906#1283425) with a
749 As with the first workaround, we'd probably want to mark the binary to indicate the non-standard
759 ### Workaround: Use Variant 1 Everywhere with an Extra-Large TCB
787 This workaround doesn't help with statically-linked executables, but they're probably less of a
805 ### (Non-)workaround for Go: Allocate a Slot with Go's Magic Values
813 slot with this magic value. This hack doesn't appear to work, however. The runtime finds its pthread
815 example][go-tlsg-zero]). With this hack, it's never zero, but with its current allocation strategy,
824 Most Android executables do not use any `thread_local` variables. In the current prototype, with the
856 * Alexandre Oliva's TLSDESC proposal with details for x86 and x86-64: ["Thread-Local Storage
869 * [2015 LLVM bugtracker comment][llvm22408] with an excerpt from an unnamed ARM draft specification