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:
@@ -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;
|
||||
|
||||
|
||||
@@ -158,6 +158,7 @@
|
||||
#define STT_FUNC 2
|
||||
#define STT_SECTION 3
|
||||
#define STT_FILE 4
|
||||
#define STT_TLS 6
|
||||
#define STT_LOPROC 13
|
||||
#define STT_HIPROC 15
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ enum {
|
||||
TLS_ERRNO_SLOT,
|
||||
TLS_ON_EXIT_THREAD_SLOT,
|
||||
TLS_USER_THREAD_SLOT,
|
||||
TLS_DYNAMIC_THREAD_VECTOR,
|
||||
|
||||
// Note: these entries can safely be changed between
|
||||
// releases; 3rd party code always calls tls_allocate()
|
||||
|
||||
Reference in New Issue
Block a user