Port-alpha archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: LWP private support / TLS support
Hi all,
this is a follow up to the earlier mail. Once the issues with the uniq
register are sorted out, the attached patch should provide the actual
relocations. Adding __HAVE_TLS_VARIANT_I to alpha/include/types.h should
be enough for the rest to work.
Joerg
Index: alpha_reloc.c
===================================================================
RCS file:
/home/joerg/repo/netbsd/src/libexec/ld.elf_so/arch/alpha/alpha_reloc.c,v
retrieving revision 1.38
diff -u -p -r1.38 alpha_reloc.c
--- alpha_reloc.c 30 Sep 2010 09:11:18 -0000 1.38
+++ alpha_reloc.c 10 Mar 2011 17:36:39 -0000
@@ -66,6 +66,7 @@ __RCSID("$NetBSD: alpha_reloc.c,v 1.38 2
#endif /* not lint */
#include <sys/types.h>
+#include <sys/tls.h>
#include <string.h>
#include "rtld.h"
@@ -261,6 +262,64 @@ _rtld_relocate_nonplt_objects(Obj_Entry
rdbg(("COPY (avoid in main)"));
break;
+ case R_TYPE(TPREL64):
+ 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 = (Elf64_Addr)(def->st_value +
+ sizeof(struct tls_tcb) + defobj->tlsoffset +
+ rela->r_addend);
+
+ if (__predict_true(RELOC_ALIGNED_P(where)))
+ *where = tmp;
+ else
+ store_ptr(where, tmp);
+
+ rdbg(("TPREL64 %s in %s --> %p",
+ obj->strtab + obj->symtab[symnum].st_name,
+ obj->path, (void *)*where));
+
+ break;
+
+ case R_TYPE(DTPMOD64):
+ def = _rtld_find_symdef(symnum, obj, &defobj, false);
+ if (def == NULL)
+ return -1;
+
+ tmp = (Elf64_Addr)defobj->tlsindex;
+ if (__predict_true(RELOC_ALIGNED_P(where)))
+ *where = tmp;
+ else
+ store_ptr(where, tmp);
+
+ rdbg(("DTPMOD64 %s in %s --> %p",
+ obj->strtab + obj->symtab[symnum].st_name,
+ obj->path, (void *)*where));
+
+ break;
+
+ case R_TYPE(DTPREL64):
+ def = _rtld_find_symdef(symnum, obj, &defobj, false);
+ if (def == NULL)
+ return -1;
+
+ tmp = (Elf64_Addr)(def->st_value + rela->r_addend);
+ if (__predict_true(RELOC_ALIGNED_P(where)))
+ *where = tmp;
+ else
+ store_ptr(where, tmp);
+
+ rdbg(("DTPREL64 %s in %s --> %p",
+ obj->strtab + obj->symtab[symnum].st_name,
+ obj->path, (void *)*where));
+
+ break;
+
default:
rdbg(("sym = %lu, type = %lu, offset = %p, "
"addend = %p, contents = %p, symbol = %s",
Home |
Main Index |
Thread Index |
Old Index