Index: uspace/lib/c/include/rtld/module.h
===================================================================
--- uspace/lib/c/include/rtld/module.h	(revision 0f792c28c69f695fd1956a86e0489bd2ea27cc3f)
+++ uspace/lib/c/include/rtld/module.h	(revision 054476d01aca9bd28135fce64c7c46d84fe7398c)
@@ -39,33 +39,14 @@
 #include <rtld/dynamic.h>
 #include <adt/list.h>
+#include <types/rtld/module.h>
+#include <types/rtld/rtld.h>
 
-typedef struct module {
-	dyn_info_t dyn;
-	size_t bias;
+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 *);
+extern void module_load_deps(module_t *);
 
-	/** Array of pointers to directly dependent modules */
-	struct module **deps;
-	/** Number of fields in deps */
-	size_t n_deps;
-
-	/** True iff relocations have already been processed in this module. */
-	bool relocated;
-
-	/** Link to list of all modules in runtime environment */
-	link_t modules_link;
-
-	/** Link to BFS queue. Only used when doing a BFS of the module graph */
-	link_t queue_link;
-	/** Tag for modules already processed during a BFS */
-	bool bfs_tag;
-} module_t;
-
-void module_process_relocs(module_t *m);
-module_t *module_find(const char *name);
-module_t *module_load(const char *name);
-void module_load_deps(module_t *m);
-
-void modules_process_relocs(module_t *start);
-void modules_untag(void);
+extern void modules_process_relocs(rtld_t *, module_t *);
+extern void modules_untag(rtld_t *);
 
 #endif
Index: uspace/lib/c/include/rtld/rtld.h
===================================================================
--- uspace/lib/c/include/rtld/rtld.h	(revision 0f792c28c69f695fd1956a86e0489bd2ea27cc3f)
+++ uspace/lib/c/include/rtld/rtld.h	(revision 054476d01aca9bd28135fce64c7c46d84fe7398c)
@@ -36,26 +36,15 @@
 #define LIBC_RTLD_H_
 
+#include <adt/list.h>
+#include <elf/elf_mod.h>
 #include <sys/types.h>
-#include <adt/list.h>
 
 #include <rtld/dynamic.h>
-#include <rtld/module.h>
+#include <types/rtld/rtld.h>
 
-typedef struct {
-	elf_dyn_t *rtld_dynamic;
-	module_t rtld;
-
-	module_t *program;
-
-	/** List of all loaded modules including rtld and the program */
-	list_t modules;
-
-	/** Temporary hack to place each module at different address. */
-	uintptr_t next_bias;
-} runtime_env_t;
-
-extern runtime_env_t *runtime_env;
+extern rtld_t *runtime_env;
 
 extern void rtld_init_static(void);
+extern int rtld_prog_process(elf_finfo_t *, rtld_t **);
 
 #endif
Index: uspace/lib/c/include/rtld/rtld_debug.h
===================================================================
--- uspace/lib/c/include/rtld/rtld_debug.h	(revision 0f792c28c69f695fd1956a86e0489bd2ea27cc3f)
+++ uspace/lib/c/include/rtld/rtld_debug.h	(revision 054476d01aca9bd28135fce64c7c46d84fe7398c)
@@ -36,4 +36,6 @@
 #define LIBC_RTLD_RTLD_DEBUG_H_
 
+#include <stdio.h>
+
 /* Define to enable debugging mode. */
 #undef RTLD_DEBUG
