This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
> I've checked in some code to fix dlclose of modules with static TLS > for TLS_TCB_AT_TP platforms. The existing code was completely broken > but I thnk it should more or less work for TLS_DTV_AT_TP platforms.
diff -urN nptl-0.36/nptl/sysdeps/powerpc/tls.h libc23/nptl/sysdeps/powerpc/tls.h
--- nptl-0.36/nptl/sysdeps/powerpc/tls.h 2003-03-20 02:53:01.000000000 -0600
+++ libc23/nptl/sysdeps/powerpc/tls.h 2003-04-28 13:58:43.000000000 -0500
@@ -69,19 +69,21 @@
} tcbhead_t;
/* This is the size of the initial TCB. */
-# define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
+# define TLS_INIT_TCB_SIZE 0
/* Alignment requirements for the initial TCB. */
-# define TLS_INIT_TCB_ALIGN __alignof__ (tcbhead_t)
+# define TLS_INIT_TCB_ALIGN __alignof__ (struct pthread)
/* This is the size of the TCB. */
-# define TLS_TCB_SIZE sizeof (tcbhead_t)
+# define TLS_TCB_SIZE 0
/* Alignment requirements for the TCB. */
-# define TLS_TCB_ALIGN __alignof__ (tcbhead_t)
+# define TLS_TCB_ALIGN __alignof__ (struct pthread)
/* This is the size we need before TCB. */
-# define TLS_PRE_TCB_SIZE sizeof (struct pthread)
+# define TLS_PRE_TCB_SIZE \
+ (sizeof (struct pthread) \
+ + ((sizeof (tcbhead_t) + TLS_TCB_ALIGN - 1) & ~(TLS_TCB_ALIGN - 1)))
/* XXX if __alignof__ (struct pthread) > __alignof (tcbhead_t)
we could be in trouble. -- paulus */
@@ -98,37 +100,37 @@
/* The following assumes that TP (R2 or R13) points to the end of the
TCB + 0x7000 (per the ABI). This implies that TCB address is
- TP-(TLS_TCB_SIZE + 0x7000). As we define TLS_DTV_AT_TP we can
+ TP - 0x7000. As we define TLS_DTV_AT_TP we can
assume that the pthread struct is allocated immediately ahead of the
TCB. This implies that the pthread_descr address is
- TP-(TLS_PRE_TCB_SIZE + TLS_TCB_SIZE + 0x7000). */
+ TP - (TLS_PRE_TCB_SIZE + 0x7000). */
# define TLS_TCB_OFFSET 0x7000
/* Install the dtv pointer. The pointer passed is to the element with
index -1 which contain the length. */
-# define INSTALL_DTV(tcbp, dtvp) \
- ((tcbhead_t *) (tcbp))->dtv = dtvp + 1
+# define INSTALL_DTV(TCBP, DTVP) \
+ ((tcbhead_t *) (TCBP))[-1].dtv = (DTVP) + 1
/* Install new dtv for current thread. */
-# define INSTALL_NEW_DTV(dtv) (THREAD_DTV() = (dtv))
+# define INSTALL_NEW_DTV(DTV) (THREAD_DTV() = (DTV))
/* Return dtv of given thread descriptor. */
-# define GET_DTV(tcbp) (((tcbhead_t *) (tcbp))->dtv)
+# define GET_DTV(TCBP) (((tcbhead_t *) (TCBP))[-1].dtv)
/* Code to initially initialize the thread pointer. This might need
special attention since 'errno' is not yet available and if the
operation can cause a failure 'errno' must not be touched. */
-# define TLS_INIT_TP(tcbp, secondcall) \
- (__thread_register = (void *) (tcbp) + TLS_TCB_OFFSET + TLS_TCB_SIZE, NULL)
+# define TLS_INIT_TP(TCBP, secondcall) \
+ (__thread_register = (void *) (TCBP) + TLS_TCB_OFFSET, NULL)
/* Return the address of the dtv for the current thread. */
# define THREAD_DTV() \
- (((tcbhead_t *) (__thread_register - TLS_TCB_OFFSET - TLS_TCB_SIZE))->dtv)
+ (((tcbhead_t *) (__thread_register - TLS_TCB_OFFSET))[-1].dtv)
/* Return the thread descriptor for the current thread. */
# define THREAD_SELF \
((struct pthread *) (__thread_register \
- - TLS_TCB_OFFSET - TLS_TCB_SIZE - TLS_PRE_TCB_SIZE))
+ - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE))
/* Read member of the thread descriptor directly. */
# define THREAD_GETMEM(descr, member) ((void)(descr), (THREAD_SELF)->member)
diff -urN libc23-cvstip-20030428/sysdeps/powerpc/dl-tls.h libc23/sysdeps/powerpc/dl-tls.h --- libc23-cvstip-20030428/sysdeps/powerpc/dl-tls.h 2003-04-25 04:08:56.000000000 -0500 +++ libc23/sysdeps/powerpc/dl-tls.h 2003-04-28 17:34:28.000000000 -0500 @@ -35,7 +35,7 @@ /* Compute the value for a @tprel reloc. */ #define TLS_TPREL_VALUE(sym_map, sym, reloc) \ ((sym_map)->l_tls_offset + (sym)->st_value + (reloc)->r_addend \ - - TLS_TP_OFFSET) + - TLS_TCB_SIZE - TLS_TP_OFFSET) /* Compute the value for a @dtprel reloc. */ #define TLS_DTPREL_VALUE(sym, reloc) \
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |