Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/ld.elf_so/arch/arm Add support for TLS relocations.
details: https://anonhg.NetBSD.org/src/rev/eed380caff48
branches: trunk
changeset: 764148:eed380caff48
user: matt <matt%NetBSD.org@localhost>
date: Tue Apr 12 16:40:04 2011 +0000
description:
Add support for TLS relocations.
>From Joerg Sonnenberger
diffstat:
libexec/ld.elf_so/arch/arm/mdreloc.c | 59 ++++++++++++++++++++++++++++++++++-
1 files changed, 57 insertions(+), 2 deletions(-)
diffs (76 lines):
diff -r 5d83a1badf87 -r eed380caff48 libexec/ld.elf_so/arch/arm/mdreloc.c
--- a/libexec/ld.elf_so/arch/arm/mdreloc.c Tue Apr 12 16:19:44 2011 +0000
+++ b/libexec/ld.elf_so/arch/arm/mdreloc.c Tue Apr 12 16:40:04 2011 +0000
@@ -1,8 +1,8 @@
-/* $NetBSD: mdreloc.c,v 1.35 2011/03/25 18:07:05 joerg Exp $ */
+/* $NetBSD: mdreloc.c,v 1.36 2011/04/12 16:40:04 matt Exp $ */
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: mdreloc.c,v 1.35 2011/03/25 18:07:05 joerg Exp $");
+__RCSID("$NetBSD: mdreloc.c,v 1.36 2011/04/12 16:40:04 matt Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -179,6 +179,61 @@
rdbg(("COPY (avoid in main)"));
break;
+#ifdef __HAVE_TLS_VARIANT_I
+ case R_TYPE(TLS_DTPOFF32):
+ def = _rtld_find_symdef(symnum, obj, &defobj, false);
+ if (def == NULL)
+ return -1;
+
+ tmp = (Elf_Addr)(def->st_value);
+ if (__predict_true(RELOC_ALIGNED_P(where)))
+ *where = tmp;
+ else
+ store_ptr(where, tmp);
+
+ rdbg(("TLS_DTPOFF32 %s in %s --> %p",
+ obj->strtab + obj->symtab[symnum].st_name,
+ obj->path, (void *)tmp));
+
+ break;
+ case R_TYPE(TLS_DTPMOD32):
+ def = _rtld_find_symdef(symnum, obj, &defobj, false);
+ if (def == NULL)
+ return -1;
+
+ tmp = (Elf_Addr)(defobj->tlsindex);
+ if (__predict_true(RELOC_ALIGNED_P(where)))
+ *where = tmp;
+ else
+ store_ptr(where, tmp);
+
+ rdbg(("TLS_DTPMOD32 %s in %s --> %p",
+ obj->strtab + obj->symtab[symnum].st_name,
+ obj->path, (void *)tmp));
+
+ break;
+
+ case R_TYPE(TLS_TPOFF32):
+ def = _rtld_find_symdef(symnum, obj, &defobj, false);
+ if (def == NULL)
+ return -1;
+
+ if (!defobj->tls_done &&
+ _rtld_tls_offset_allocate(obj))
+ return -1;
+
+ tmp = (Elf_Addr)def->st_value + defobj->tlsoffset +
+ sizeof(struct tls_tcb);
+ if (__predict_true(RELOC_ALIGNED_P(where)))
+ *where = tmp;
+ else
+ store_ptr(where, tmp);
+ rdbg(("TLS_TPOFF32 %s in %s --> %p",
+ obj->strtab + obj->symtab[symnum].st_name,
+ obj->path, (void *)tmp));
+ break;
+#endif /* __HAVE_TLS_VARIANT_I */
+
default:
rdbg(("sym = %lu, type = %lu, offset = %p, "
"contents = %p, symbol = %s",
Home |
Main Index |
Thread Index |
Old Index