summaryrefslogtreecommitdiff
path: root/tests/stdlib_test.cpp
diff options
context:
space:
mode:
authorRyan Prichard <rprichard@google.com>2019-01-23 17:47:10 -0800
committerRyan Prichard <rprichard@google.com>2019-01-29 08:33:09 +0000
commitffaae70936a12e310cb1b468566d39f0f7dbcdf0 (patch)
tree9ccc9887061fa0ebe40c44d1c383ee3a7273c081 /tests/stdlib_test.cpp
parent16455b5100ea46b930c1fa84d6bc905b7977643d (diff)
Implement arm64 TLSDESC
Each TLSDESC relocation relocates a 2-word descriptor in the GOT that contains: - the address of a TLS resolver function - an argument to pass (indirectly) to the resolver function (Specifically, the address of the 2-word descriptor is passed to the resolver.) The loader resolves R_GENERIC_TLSDESC relocations using one of three resolver functions that it defines: - tlsdesc_resolver_static - tlsdesc_resolver_dynamic - tlsdesc_resolver_unresolved_weak The resolver functions are written in assembly because they have a restrictive calling convention. They're only allowed to modify x0 and (apparently) the condition codes. For a relocation to memory in static TLS (i.e. the executable or an solib loaded initially), the loader uses a simple resolver function, tlsdesc_resolver_static, that returns the static offset it receives from the loader. For relocations to dynamic TLS memory (i.e. memory in a dlopen'ed solib), the loader uses tlsdesc_resolver_dynamic, which allocates TLS memory on demand. It inlines the fast path of __tls_get_addr, then falls back to __tls_get_addr when it needs to allocate memory. The loader handles these dynamic TLS relocations in two passes: - In the first pass, it allocates a table of TlsDynamicResolverArg objects, one per dynamic TLSDESC relocation. - In the second pass, once the table is finalized, it writes the addresses of the TlsDynamicResolverArg objects into the TLSDESC relocations. tlsdesc_resolver_unresolved_weak returns a negated thread pointer so that taking the address of an unresolved weak TLS symbols produces NULL. The loader handles R_GENERIC_TLSDESC in a target-independent way, but only for arm64, because Bionic has only implemented the resolver functions for arm64. Bug: http://b/78026329 Test: bionic unit tests Test: check that backtrace works inside a resolver function and inside __tls_get_addr called from a resolver (gdbclient.py, b __tls_get_addr, bt) Merged-In: I752e59ff986292449892c449dad2546e6f0ff7b6 Change-Id: I752e59ff986292449892c449dad2546e6f0ff7b6
Diffstat (limited to 'tests/stdlib_test.cpp')
0 files changed, 0 insertions, 0 deletions