This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][RFC] MIPS glibc-2.5 linuxthreads with TLS (was Re: [MIPS] glibc-2.5 with tls with linux threads)


Hi,

> > Has anyone successfully built glibc-2.5 --with-tls, --with-__thread,
> > on linuxthread?
> 
> I know I built glibc 2.5 for MIPS with LinuxThreads, but it was
> probably --with-tls --without-__thread.  I don't remember if
> --with-__thread worked.
> 
> You can't do it from HEAD any more - LinuxThreads is officially broken
> now.  Use NPTL.

Thanks.

With the below patch, I was able to use linuxthreads --with-tls
--with-__thread on MIPS board. I have just tested a few sample, and it
seems working (though I haven't run make check).

# I'd really like to use NTPL if I could... linuxthreads was requirement.

Best Regards,

(Hiroki Kaminaga)
t
--

Index: glibc-2.5-mips-with__thraed/linuxthreads/sysdeps/mips/pt-machine.h
===================================================================
--- glibc-2.5-mips-with__thraed.orig/linuxthreads/sysdeps/mips/pt-machine.h
+++ glibc-2.5-mips-with__thraed/linuxthreads/sysdeps/mips/pt-machine.h
@@ -43,6 +43,9 @@ testandset (int *spinlock)
   return _test_and_set (spinlock, 1);
 }
 
+/* We want the OS to assign stack address */
+#define FLOATING_STACKS 1
+#define ARCH_STACK_MAX_SIZE 8*1024*1024
 
 /* Get some notion of the current stack.  Need not be exactly the top
    of the stack, just something somewhere in the current frame.  */
Index: glibc-2.5-mips-with__thraed/linuxthreads/sysdeps/mips/tls.h
===================================================================
--- glibc-2.5-mips-with__thraed.orig/linuxthreads/sysdeps/mips/tls.h
+++ glibc-2.5-mips-with__thraed/linuxthreads/sysdeps/mips/tls.h
@@ -155,9 +155,31 @@ typedef struct
     ((pthread_descr) (READ_THREAD_POINTER () \
 		      - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE))
 
+#  undef INIT_THREAD_SELF
+#  define INIT_THREAD_SELF(DESCR, NR) \
+     TLS_INIT_TP ((struct _pthread_descr_struct *)(DESCR) + 1, 0)
+
 /* Get the thread descriptor definition.  */
 #  include <linuxthreads/descr.h>
 
+/* ??? Generic bits of LinuxThreads may call these macros with
+   DESCR set to NULL.  We are expected to be able to reference
+   the "current" value.
+
+   In our case, we'd really prefer to use DESCR, since lots of
+   PAL_code calls would be expensive.  We can only trust that
+   the compiler does its job and unifies the multiple
+   __builtin_thread_pointer instances.  */
+
+#define THREAD_GETMEM(descr, member) \
+  ((void) sizeof (descr), THREAD_SELF->member)
+#define THREAD_GETMEM_NC(descr, member) \
+  ((void) sizeof (descr), THREAD_SELF->member)
+#define THREAD_SETMEM(descr, member, value) \
+  ((void) sizeof (descr), THREAD_SELF->member = (value))
+#define THREAD_SETMEM_NC(descr, member, value) \
+  ((void) sizeof (descr), THREAD_SELF->member = (value))
+
 /* l_tls_offset == 0 is perfectly valid on MIPS, so we have to use some
    different value to mean unset l_tls_offset.  */
 #  define NO_TLS_OFFSET	-1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]