LibC/DynamicLoader: Add support for dynamically loaded TLS
Previously I failed to dlopen if any of the objects contained TLS section
This commit is contained in:
@@ -17,25 +17,41 @@ __BEGIN_DECLS
|
||||
|
||||
#include <bits/types/pthread_types.h>
|
||||
|
||||
struct _pthread_cleanup_t
|
||||
typedef struct _pthread_cleanup_t
|
||||
{
|
||||
void (*routine)(void*);
|
||||
void* arg;
|
||||
struct _pthread_cleanup_t* next;
|
||||
};
|
||||
} _pthread_cleanup_t;
|
||||
|
||||
typedef struct _dynamic_tls_entry_t
|
||||
{
|
||||
void* master_addr;
|
||||
size_t master_size;
|
||||
} _dynamic_tls_entry_t;
|
||||
|
||||
typedef struct _dynamic_tls_t
|
||||
{
|
||||
int lock;
|
||||
size_t entry_count;
|
||||
_dynamic_tls_entry_t* entries;
|
||||
} _dynamic_tls_t;
|
||||
|
||||
struct uthread
|
||||
{
|
||||
struct uthread* self;
|
||||
void* master_tls_addr;
|
||||
size_t master_tls_size;
|
||||
struct _pthread_cleanup_t* cleanup_stack;
|
||||
size_t master_tls_module_count;
|
||||
_dynamic_tls_t* dynamic_tls;
|
||||
_pthread_cleanup_t* cleanup_stack;
|
||||
pthread_t id;
|
||||
int errno_;
|
||||
int cancel_type;
|
||||
int cancel_state;
|
||||
int canceled;
|
||||
uintptr_t dtv[];
|
||||
// FIXME: make this dynamic
|
||||
uintptr_t dtv[1 + 128];
|
||||
};
|
||||
|
||||
#define PTHREAD_CANCELED (void*)1
|
||||
|
||||
Reference in New Issue
Block a user