runtime_loader: add support for ELF based TLS

This patch introduces support of ELF based TLS handling with lazy allocation
and initalization of TLS block for each DSO and thread. The implementation
generally follows the official ABI except that generation counter in dtv
is in fact a pointer to Generation object that contains both generation
counter and size of the dtv. That simplified the implementation a bit, but
could be changed later. The ABI requirements regariding in memory position
of TLS block is not honoured what results in static TLS model being
unsupported. However, that should not be a problem as long as
"executables" in Haiku are in fact shared objects and optimizations which
require specific TLS block in memory layout are not possible anyway.
This commit is contained in:
Pawel Dziepak
2014-05-04 04:00:17 +02:00
parent 828ea2c47d
commit 44c0c4d3d0
20 changed files with 497 additions and 10 deletions
@@ -45,6 +45,8 @@ struct rld_export {
const char** _architecture);
status_t (*get_next_image_dependency)(image_id id, uint32 *cookie,
const char **_name);
void* (*get_tls_address)(unsigned dso, addr_t offset);
void (*destroy_thread_tls)();
status_t (*reinit_after_fork)();
@@ -114,6 +116,8 @@ typedef struct image_t {
elf_rel *pltrel;
int pltrel_len;
unsigned dso_tls_id;
uint32 num_needed;
struct image_t **needed;