Index: HelenOS.config
===================================================================
--- HelenOS.config	(revision e5360a8bd9f789c25d096f9b82732ab3cdab6716)
+++ HelenOS.config	(revision 3ffb69b74f64b601fd9f7a3b730cccf355de9ee0)
@@ -578,6 +578,6 @@
 
 % Dynamic linking support
-! [PLATFORM=amd64|PLATFORM=ia32|PLATFORM=ppc32|PLATFORM=sparc64] CONFIG_RTLD (y/n)
-! [PLATFORM=abs32le|PLATFORM=arm32|PLATFORM=ia64|PLATFORM=mips32|PLATFORM=riscv64] CONFIG_RTLD (n)
+! [PLATFORM=amd64|PLATFORM=arm32|PLATFORM=ia32|PLATFORM=ppc32|PLATFORM=sparc64] CONFIG_RTLD (y/n)
+! [PLATFORM=abs32le|PLATFORM=ia64|PLATFORM=mips32|PLATFORM=riscv64] CONFIG_RTLD (n)
 
 % Build shared libraries
Index: defaults/arm32/Makefile.config
===================================================================
--- defaults/arm32/Makefile.config	(revision e5360a8bd9f789c25d096f9b82732ab3cdab6716)
+++ defaults/arm32/Makefile.config	(revision 3ffb69b74f64b601fd9f7a3b730cccf355de9ee0)
@@ -38,4 +38,13 @@
 CONFIG_HID_OUT = generic
 
+# Dynamic linking support
+CONFIG_RTLD = y
+
+# Build shared libraries
+CONFIG_BUILD_SHARED_LIBS = y
+
+# Link against shared libraries
+CONFIG_USE_SHARED_LIBS = y
+
 # Optimization level
 OPTIMIZATION = 3
Index: uspace/lib/c/arch/arm32/Makefile.common
===================================================================
--- uspace/lib/c/arch/arm32/Makefile.common	(revision e5360a8bd9f789c25d096f9b82732ab3cdab6716)
+++ uspace/lib/c/arch/arm32/Makefile.common	(revision 3ffb69b74f64b601fd9f7a3b730cccf355de9ee0)
@@ -29,5 +29,5 @@
 
 COMMON_CFLAGS += -ffixed-r9 -mtp=soft -fno-omit-frame-pointer -mapcs-frame \
-	-mcpu=$(subst _,-,$(PROCESSOR))
+	-mcpu=$(subst _,-,$(PROCESSOR)) -Wl,-z,max-page-size=0x1000
 
 LDFLAGS += -Wl,--gc-sections
Index: uspace/lib/c/arch/arm32/Makefile.inc
===================================================================
--- uspace/lib/c/arch/arm32/Makefile.inc	(revision e5360a8bd9f789c25d096f9b82732ab3cdab6716)
+++ uspace/lib/c/arch/arm32/Makefile.inc	(revision 3ffb69b74f64b601fd9f7a3b730cccf355de9ee0)
@@ -37,3 +37,5 @@
 	arch/$(UARCH)/src/eabi.S \
 	arch/$(UARCH)/src/stacktrace.c \
-	arch/$(UARCH)/src/stacktrace_asm.S
+	arch/$(UARCH)/src/stacktrace_asm.S \
+	arch/$(UARCH)/src/rtld/dynamic.c \
+	arch/$(UARCH)/src/rtld/reloc.c
Index: uspace/lib/c/arch/arm32/include/libarch/rtld/dynamic.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/rtld/dynamic.h	(revision 3ffb69b74f64b601fd9f7a3b730cccf355de9ee0)
+++ uspace/lib/c/arch/arm32/include/libarch/rtld/dynamic.h	(revision 3ffb69b74f64b601fd9f7a3b730cccf355de9ee0)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2019 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_arm32_RTLD_DYNAMIC_H_
+#define LIBC_arm32_RTLD_DYNAMIC_H_
+
+typedef struct {
+	/* Empty. */
+} dyn_info_arch_t;
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/c/arch/arm32/include/libarch/rtld/elf_dyn.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/rtld/elf_dyn.h	(revision 3ffb69b74f64b601fd9f7a3b730cccf355de9ee0)
+++ uspace/lib/c/arch/arm32/include/libarch/rtld/elf_dyn.h	(revision 3ffb69b74f64b601fd9f7a3b730cccf355de9ee0)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2019 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_arm32_RTLD_ELF_DYN_H_
+#define LIBC_arm32_RTLD_ELF_DYN_H_
+
+/*
+ * arm32 dynamic relocation types
+ */
+
+#define R_ARM_ABS32         2
+#define R_ARM_TLS_DTPMOD32 17
+#define R_ARM_TLS_DTPOFF32 18
+#define R_ARM_TLS_TPOFF32  19
+#define R_ARM_COPY         20
+#define R_ARM_GLOB_DAT     21
+#define R_ARM_JUMP_SLOT    22
+#define R_ARM_RELATIVE     23
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/c/arch/arm32/include/libarch/rtld/module.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/rtld/module.h	(revision 3ffb69b74f64b601fd9f7a3b730cccf355de9ee0)
+++ uspace/lib/c/arch/arm32/include/libarch/rtld/module.h	(revision 3ffb69b74f64b601fd9f7a3b730cccf355de9ee0)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2019 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
+
+#ifndef LIBC_arm32_RTLD_MODULE_H_
+#define LIBC_arm32_RTLD_MODULE_H_
+
+#include <elf/elf_mod.h>
+
+/** ELF module load flags */
+#define RTLD_MODULE_LDF 0
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/c/arch/arm32/include/libarch/tls.h
===================================================================
--- uspace/lib/c/arch/arm32/include/libarch/tls.h	(revision e5360a8bd9f789c25d096f9b82732ab3cdab6716)
+++ uspace/lib/c/arch/arm32/include/libarch/tls.h	(revision 3ffb69b74f64b601fd9f7a3b730cccf355de9ee0)
@@ -49,4 +49,6 @@
  */
 typedef struct {
+	void **dtv;
+	void *pad;
 	/** Fibril data. */
 	void *fibril_data;
Index: uspace/lib/c/arch/arm32/src/atomic.c
===================================================================
--- uspace/lib/c/arch/arm32/src/atomic.c	(revision e5360a8bd9f789c25d096f9b82732ab3cdab6716)
+++ uspace/lib/c/arch/arm32/src/atomic.c	(revision 3ffb69b74f64b601fd9f7a3b730cccf355de9ee0)
@@ -35,5 +35,5 @@
 #include <stdbool.h>
 
-extern volatile unsigned *ras_page;
+volatile unsigned *ras_page;
 
 bool __atomic_compare_exchange_4(volatile unsigned *mem, unsigned *expected, unsigned desired, bool weak, int success, int failure)
Index: uspace/lib/c/arch/arm32/src/entry.S
===================================================================
--- uspace/lib/c/arch/arm32/src/entry.S	(revision e5360a8bd9f789c25d096f9b82732ab3cdab6716)
+++ uspace/lib/c/arch/arm32/src/entry.S	(revision 3ffb69b74f64b601fd9f7a3b730cccf355de9ee0)
@@ -57,4 +57,4 @@
 .data
 
-SYMBOL(ras_page)
-	.long 0
+# SYMBOL(ras_page)
+#	.long 0
Index: uspace/lib/c/arch/arm32/src/rtld/dynamic.c
===================================================================
--- uspace/lib/c/arch/arm32/src/rtld/dynamic.c	(revision 3ffb69b74f64b601fd9f7a3b730cccf355de9ee0)
+++ uspace/lib/c/arch/arm32/src/rtld/dynamic.c	(revision 3ffb69b74f64b601fd9f7a3b730cccf355de9ee0)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2019 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libcarm32
+ * @brief
+ * @{
+ */
+/**
+ * @file
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <rtld/elf_dyn.h>
+#include <rtld/dynamic.h>
+
+void dyn_parse_arch(elf_dyn_t *dp, size_t bias, dyn_info_t *info)
+{
+	(void) dp;
+	(void) bias;
+	(void) info;
+}
+
+/** @}
+ */
Index: uspace/lib/c/arch/arm32/src/rtld/reloc.c
===================================================================
--- uspace/lib/c/arch/arm32/src/rtld/reloc.c	(revision 3ffb69b74f64b601fd9f7a3b730cccf355de9ee0)
+++ uspace/lib/c/arch/arm32/src/rtld/reloc.c	(revision 3ffb69b74f64b601fd9f7a3b730cccf355de9ee0)
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2019 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libcarm32
+ * @brief
+ * @{
+ */
+/**
+ * @file
+ */
+
+#include <bitops.h>
+#include <smc.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <inttypes.h>
+#include <str.h>
+
+#include <libarch/rtld/elf_dyn.h>
+#include <rtld/symbol.h>
+#include <rtld/rtld.h>
+#include <rtld/rtld_debug.h>
+#include <rtld/rtld_arch.h>
+
+void module_process_pre_arch(module_t *m)
+{
+	/* Unused */
+}
+
+/**
+ * Process (fixup) all relocations in a relocation table.
+ */
+void rel_table_process(module_t *m, elf_rel_t *rt, size_t rt_size)
+{
+	unsigned i;
+
+	size_t rt_entries;
+	size_t r_offset;
+	elf_word r_info;
+	unsigned rel_type;
+	elf_word sym_idx;
+	uint32_t sym_addr;
+
+	elf_symbol_t *sym_table;
+	elf_symbol_t *sym;
+	uint32_t *r_ptr;
+	uint32_t sym_size;
+	char *str_tab;
+
+	elf_symbol_t *sym_def;
+	module_t *dest;
+
+	DPRINTF("parse relocation table\n");
+
+	sym_table = m->dyn.sym_tab;
+	rt_entries = rt_size / sizeof(elf_rel_t);
+	str_tab = m->dyn.str_tab;
+
+	DPRINTF("address: 0x%" PRIxPTR ", entries: %zd\n", (uintptr_t)rt, rt_entries);
+
+	for (i = 0; i < rt_entries; ++i) {
+#if 0
+		DPRINTF("symbol %d: ", i);
+#endif
+		r_offset = rt[i].r_offset;
+		r_info = rt[i].r_info;
+
+		sym_idx = ELF32_R_SYM(r_info);
+		sym = &sym_table[sym_idx];
+
+#if 0
+		DPRINTF("name '%s', value 0x%x, size 0x%x\n",
+		    str_tab + sym->st_name, sym->st_value, sym->st_size);
+#endif
+		rel_type = ELF32_R_TYPE(r_info);
+		r_ptr = (uint32_t *)(r_offset + m->bias);
+
+		if (sym->st_name != 0) {
+#if 0
+			DPRINTF("rel_type: %x, rel_offset: 0x%x\n", rel_type, r_offset);
+#endif
+			sym_def = symbol_def_find(str_tab + sym->st_name,
+			    m, ssf_none, &dest);
+			DPRINTF("dest name: '%s'\n", dest->dyn.soname);
+			DPRINTF("dest bias: 0x%x\n", dest->bias);
+			if (sym_def) {
+				sym_addr = (uint32_t)
+				    symbol_get_addr(sym_def, dest, NULL);
+#if 0
+				DPRINTF("symbol definition found, addr=0x%x\n", sym_addr);
+#endif
+			} else {
+				printf("Definition of '%s' not found.\n",
+				    str_tab + sym->st_name);
+				continue;
+			}
+		} else {
+			sym_addr = 0;
+			sym_def = NULL;
+			dest = m;
+		}
+
+		switch (rel_type) {
+		case R_ARM_ABS32:
+			DPRINTF("ignore R_ARM_ABS32\n");
+			/*
+			 * Not sure why we get these static relocations, but
+			 * attempting to process them will crash the
+			 * loader. If we ignore them, everything
+			 * seems to work.
+			 */
+			break;
+
+		case R_ARM_TLS_DTPMOD32:
+			DPRINTF("fixup R_ARM_TLS_DTPMOD32\n");
+			*r_ptr = dest->id;
+			break;
+
+		case R_ARM_TLS_DTPOFF32:
+			DPRINTF("fixup R_ARM_TLS_DTPOFF32\n");
+			*r_ptr = sym_def->st_value;
+			break;
+
+		case R_ARM_TLS_TPOFF32:
+			DPRINTF("fixup R_ARM_TLS_TPOFF\n");
+			if (sym_def != NULL)
+				*r_ptr = sym_def->st_value + dest->tpoff;
+			else
+				*r_ptr = m->tpoff;
+			break;
+
+		case R_ARM_COPY:
+			/*
+			 * Copy symbol data from shared object to specified
+			 * location. Need to find the 'source', i.e. the
+			 * other instance of the object than the one in the
+			 * executable program.
+			 */
+			DPRINTF("fixup R_ARM_COPY (s)\n");
+
+			sym_def = symbol_def_find(str_tab + sym->st_name,
+			    m, ssf_noexec, &dest);
+
+			if (sym_def) {
+				sym_addr = (uint32_t)
+				    symbol_get_addr(sym_def, dest, NULL);
+			} else {
+				printf("Source definition of '%s' not found.\n",
+				    str_tab + sym->st_name);
+				continue;
+			}
+
+			sym_size = sym->st_size;
+			if (sym_size != sym_def->st_size) {
+				printf("Warning: Mismatched symbol sizes.\n");
+				/* Take the lower value. */
+				if (sym_size > sym_def->st_size)
+					sym_size = sym_def->st_size;
+			}
+
+			memcpy(r_ptr, (const void *)sym_addr, sym_size);
+			break;
+
+		case R_ARM_GLOB_DAT:
+		case R_ARM_JUMP_SLOT:
+			DPRINTF("fixup R_ARM_GLOB_DAT/JUMP_SLOT (S)\n");
+			*r_ptr = sym_addr;
+			break;
+
+		case R_ARM_RELATIVE:
+			DPRINTF("fixup R_ARM_RELATIVE (B)\n");
+			*r_ptr += dest->bias;
+			break;
+
+		default:
+			printf("Error: Unknown relocation type %d\n",
+			    rel_type);
+			exit(1);
+		}
+	}
+}
+
+/**
+ * Process (fixup) all relocations in a relocation table with explicit addends.
+ */
+void rela_table_process(module_t *m, elf_rela_t *rt, size_t rt_size)
+{
+	(void) m;
+	(void) rt;
+	(void) rt_size;
+}
+
+/** @}
+ */
Index: uspace/lib/c/arch/arm32/src/tls.c
===================================================================
--- uspace/lib/c/arch/arm32/src/tls.c	(revision e5360a8bd9f789c25d096f9b82732ab3cdab6716)
+++ uspace/lib/c/arch/arm32/src/tls.c	(revision 3ffb69b74f64b601fd9f7a3b730cccf355de9ee0)
@@ -1,3 +1,4 @@
 /*
+ * Copyright (c) 2019 Jiri Svoboda
  * Copyright (c) 2007 Pavel Jancik
  * All rights reserved.
@@ -38,4 +39,8 @@
 #include <stddef.h>
 
+#ifdef CONFIG_RTLD
+#include <rtld/rtld.h>
+#endif
+
 tcb_t *tls_alloc_arch(size_t size, size_t align)
 {
@@ -48,4 +53,32 @@
 }
 
+/*
+ * Rtld TLS support
+ */
+
+typedef struct {
+	unsigned long int ti_module;
+	unsigned long int ti_offset;
+} tls_index;
+
+int __tls_debug = 0;
+
+void *__tls_get_addr(tls_index *ti);
+
+void *__tls_get_addr(tls_index *ti)
+{
+	uint8_t *tls;
+
+#ifdef CONFIG_RTLD
+	if (runtime_env != NULL) {
+		return rtld_tls_get_addr(runtime_env, __tcb_get(),
+		    ti->ti_module, ti->ti_offset);
+	}
+#endif
+	/* Get address of static TLS block */
+	tls = tls_get();
+	return tls + ti->ti_offset;
+}
+
 /** @}
  */
