Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Jul 2004 15:29:55 GMT
From:      Doug Rabson <dfr@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 57924 for review
Message-ID:  <200407221529.i6MFTtx8005502@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=57924

Change 57924 by dfr@dfr_home on 2004/07/22 15:29:39

	Move allocate_tls_offset() to MI code.

Affected files ...

.. //depot/projects/kse/libexec/rtld-elf/i386/reloc.c#7 edit
.. //depot/projects/kse/libexec/rtld-elf/ia64/reloc.c#5 edit
.. //depot/projects/kse/libexec/rtld-elf/rtld.c#10 edit
.. //depot/projects/kse/libexec/rtld-elf/rtld.h#6 edit

Differences ...

==== //depot/projects/kse/libexec/rtld-elf/i386/reloc.c#7 (text+ko) ====

@@ -348,35 +348,6 @@
     return 0;
 }
 
-bool
-allocate_tls_offset(Obj_Entry *obj)
-{
-    size_t off;
-
-    if (obj->tlsindex == 1)
-	off = calculate_first_tls_offset(obj->tlssize, obj->tlsalign);
-    else
-	off = calculate_tls_offset(tls_last_offset, tls_last_size,
-				   obj->tlssize, obj->tlsalign);
-
-    /*
-     * If we have already fixed the size of the static TLS block, we
-     * must stay within that size. When allocating the static TLS, we
-     * leave a small amount of space spare to be used for dynamically
-     * loading modules which use static TLS.
-     */
-    if (tls_static_space) {
-	if (calculate_tls_end(off, obj->tlssize) > tls_static_space)
-	    return false;
-    }
-
-    tls_last_offset = obj->tlsoffset = off;
-    tls_last_size = obj->tlssize;
-    obj->tls_done = true;
-
-    return true;
-}
-
 void *
 allocate_tls(Objlist* list, size_t tcbsize, size_t tcbalign)
 {

==== //depot/projects/kse/libexec/rtld-elf/ia64/reloc.c#5 (text+ko) ====

@@ -616,35 +616,6 @@
 	pltres[2] = FPTR_GP(_rtld_bind_start);
 }
 
-bool
-allocate_tls_offset(Obj_Entry *obj)
-{
-    size_t off;
-
-    if (obj->tlsindex == 1)
-	off = calculate_first_tls_offset(obj->tlssize, obj->tlsalign);
-    else
-	off = calculate_tls_offset(tls_last_offset, tls_last_size,
-				   obj->tlssize, obj->tlsalign);
-
-    /*
-     * If we have already fixed the size of the static TLS block, we
-     * must stay within that size. When allocating the static TLS, we
-     * leave a small amount of space spare to be used for dynamically
-     * loading modules which use static TLS.
-     */
-    if (tls_static_space) {
-	if (calculate_tls_end(off, obj->tlssize) > tls_static_space)
-	    return false;
-    }
-
-    tls_last_offset = obj->tlsoffset = off;
-    tls_last_size = obj->tlssize;
-    obj->tls_done = true;
-
-    return true;
-}
-
 void
 allocate_tls(Objlist *list, size_t tcbsize, size_t tcbalign)
 {

==== //depot/projects/kse/libexec/rtld-elf/rtld.c#10 (text+ko) ====

@@ -2525,6 +2525,35 @@
     return p;
 }
 
+bool
+allocate_tls_offset(Obj_Entry *obj)
+{
+    size_t off;
+
+    if (obj->tlsindex == 1)
+	off = calculate_first_tls_offset(obj->tlssize, obj->tlsalign);
+    else
+	off = calculate_tls_offset(tls_last_offset, tls_last_size,
+				   obj->tlssize, obj->tlsalign);
+
+    /*
+     * If we have already fixed the size of the static TLS block, we
+     * must stay within that size. When allocating the static TLS, we
+     * leave a small amount of space spare to be used for dynamically
+     * loading modules which use static TLS.
+     */
+    if (tls_static_space) {
+	if (calculate_tls_end(off, obj->tlssize) > tls_static_space)
+	    return false;
+    }
+
+    tls_last_offset = obj->tlsoffset = off;
+    tls_last_size = obj->tlssize;
+    obj->tls_done = true;
+
+    return true;
+}
+
 void *
 _rtld_allocate_tls(size_t tcbsize, size_t tcbalign)
 {

==== //depot/projects/kse/libexec/rtld-elf/rtld.h#6 (text+ko) ====

@@ -233,6 +233,7 @@
   const Obj_Entry *, bool);
 void *tls_get_addr_common(Elf_Addr** dtvp, int index, size_t offset);
 void *allocate_module_tls(int index);
+bool allocate_tls_offset(Obj_Entry *obj);
 
 /*
  * MD function declarations.
@@ -241,7 +242,6 @@
 int reloc_non_plt(Obj_Entry *, Obj_Entry *);
 int reloc_plt(Obj_Entry *);
 int reloc_jmpslots(Obj_Entry *);
-bool allocate_tls_offset(Obj_Entry *obj);
 void *allocate_tls(Objlist *, size_t, size_t);
 void free_tls(Objlist *, void *, size_t, size_t);
 void allocate_initial_tls(Objlist *);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200407221529.i6MFTtx8005502>