Index: uspace/lib/c/include/elf/elf_mod.h
===================================================================
--- uspace/lib/c/include/elf/elf_mod.h	(revision af2254ece47fffd627e909e8547dca085773c990)
+++ uspace/lib/c/include/elf/elf_mod.h	(revision 118a87275d5c435ee0fb9ffe132af4cf1be32af5)
@@ -58,4 +58,16 @@
 } eld_flags_t;
 
+/** TLS info for a module */
+typedef struct {
+	/** tdata section image */
+	void *tdata;
+	/** Size of tdata section image in bytes */
+	size_t tdata_size;
+	/** Size of tbss section */
+	size_t tbss_size;
+	/** Alignment of TLS initialization image */
+	size_t tls_align;
+} elf_tls_info_t;
+
 /**
  * Some data extracted from the headers are stored here
@@ -70,4 +82,7 @@
 	/** Pointer to the dynamic section */
 	void *dynamic;
+
+	/** TLS info */
+	elf_tls_info_t tls;
 } elf_finfo_t;
 
Index: uspace/lib/c/include/rtld/module.h
===================================================================
--- uspace/lib/c/include/rtld/module.h	(revision af2254ece47fffd627e909e8547dca085773c990)
+++ uspace/lib/c/include/rtld/module.h	(revision 118a87275d5c435ee0fb9ffe132af4cf1be32af5)
@@ -42,10 +42,13 @@
 #include <types/rtld/rtld.h>
 
+extern int module_create_static_exec(rtld_t *, module_t **);
 extern void module_process_relocs(module_t *);
 extern module_t *module_find(rtld_t *, const char *);
 extern module_t *module_load(rtld_t *, const char *, mlflags_t);
 extern void module_load_deps(module_t *, mlflags_t);
+extern module_t *module_by_id(rtld_t *, unsigned long);
 
 extern void modules_process_relocs(rtld_t *, module_t *);
+extern void modules_process_tls(rtld_t *);
 extern void modules_untag(rtld_t *);
 
Index: uspace/lib/c/include/rtld/rtld.h
===================================================================
--- uspace/lib/c/include/rtld/rtld.h	(revision af2254ece47fffd627e909e8547dca085773c990)
+++ uspace/lib/c/include/rtld/rtld.h	(revision 118a87275d5c435ee0fb9ffe132af4cf1be32af5)
@@ -41,10 +41,14 @@
 
 #include <rtld/dynamic.h>
+#include <tls.h>
 #include <types/rtld/rtld.h>
 
 extern rtld_t *runtime_env;
 
-extern void rtld_init_static(void);
+extern int rtld_init_static(void);
 extern int rtld_prog_process(elf_finfo_t *, rtld_t **);
+extern tcb_t *rtld_tls_make(rtld_t *);
+extern unsigned long rtld_get_next_id(rtld_t *);
+extern void *rtld_tls_get_addr(rtld_t *, tcb_t *, unsigned long, unsigned long);
 
 #endif
Index: uspace/lib/c/include/rtld/symbol.h
===================================================================
--- uspace/lib/c/include/rtld/symbol.h	(revision af2254ece47fffd627e909e8547dca085773c990)
+++ uspace/lib/c/include/rtld/symbol.h	(revision 118a87275d5c435ee0fb9ffe132af4cf1be32af5)
@@ -38,4 +38,5 @@
 #include <elf/elf.h>
 #include <rtld/rtld.h>
+#include <tls.h>
 
 /** Symbol search flags */
@@ -50,5 +51,5 @@
 extern elf_symbol_t *symbol_def_find(const char *, module_t *,
     symbol_search_flags_t, module_t **);
-extern void *symbol_get_addr(elf_symbol_t *, module_t *);
+extern void *symbol_get_addr(elf_symbol_t *, module_t *, tcb_t *);
 
 #endif
Index: uspace/lib/c/include/tls.h
===================================================================
--- uspace/lib/c/include/tls.h	(revision af2254ece47fffd627e909e8547dca085773c990)
+++ uspace/lib/c/include/tls.h	(revision 118a87275d5c435ee0fb9ffe132af4cf1be32af5)
@@ -39,4 +39,7 @@
 #include <sys/types.h>
 
+/** DTV Generation number - equals vector length */
+#define DTV_GN(dtv) (((uintptr_t *)(dtv))[0])
+
 /*
  * Symbols defined in the respective linker script.
@@ -52,4 +55,6 @@
 extern void tls_free(tcb_t *);
 extern void tls_free_arch(tcb_t *, size_t);
+extern size_t tls_get_size(void);
+extern void *tls_get(void);
 
 #ifdef CONFIG_TLS_VARIANT_1
Index: uspace/lib/c/include/types/rtld/module.h
===================================================================
--- uspace/lib/c/include/types/rtld/module.h	(revision af2254ece47fffd627e909e8547dca085773c990)
+++ uspace/lib/c/include/types/rtld/module.h	(revision 118a87275d5c435ee0fb9ffe132af4cf1be32af5)
@@ -46,6 +46,21 @@
 /** Dynamically linked module */
 typedef struct module {
+	/** Module ID */
+	unsigned long id;
+	/** Dynamic info for this module */
 	dyn_info_t dyn;
+	/** Load bias */
 	size_t bias;
+
+	/** tdata image start */
+	void *tdata;
+	/** tdata image size */
+	size_t tdata_size;
+	/** tbss size */
+	size_t tbss_size;
+	/** TLS alignment */
+	size_t tls_align;
+
+	size_t ioffs;
 
 	/** Containing rtld */
@@ -61,4 +76,6 @@
 	/** Link to list of all modules in runtime environment */
 	link_t modules_link;
+	/** Link to list of initial modules */
+	link_t imodules_link;
 
 	/** Link to BFS queue. Only used when doing a BFS of the module graph */
Index: uspace/lib/c/include/types/rtld/rtld.h
===================================================================
--- uspace/lib/c/include/types/rtld/rtld.h	(revision af2254ece47fffd627e909e8547dca085773c990)
+++ uspace/lib/c/include/types/rtld/rtld.h	(revision 118a87275d5c435ee0fb9ffe132af4cf1be32af5)
@@ -48,6 +48,15 @@
 	module_t *program;
 
+	/** Next module ID */
+	unsigned long next_id;
+
+	/** Size of initial TLS tdata + tbss */
+	size_t tls_size;
+
 	/** List of all loaded modules including rtld and the program */
 	list_t modules;
+
+	/** List of initial modules */
+	list_t imodules;
 
 	/** Temporary hack to place each module at different address. */
