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] |
On Tue, Jan 14, 2003 at 06:23:08PM +0100, Jakub Jelinek wrote: > On Tue, Jan 14, 2003 at 04:54:17PM +0100, Andreas Schwab wrote: > > Jakub Jelinek <jakub@redhat.com> writes: > > > > |> On Tue, Jan 14, 2003 at 04:40:44PM +0100, Andreas Schwab wrote: > > |> > Current CVS is broken on ia64. It is crashing after __errno_location has > > |> > handed out a bogus pointer, which is due to the thread register not > > |> > properly initialized. I tried with the patch below, but then > > |> > linuxthreads does not work at all. I also tried --without-__thread, but > > |> > that did not help. > > |> > > |> --with-tls or --without-tls? > > > > The latter (implicitly, no support in binutils). > > The following patch could fix it, haven't tested it yet though. Ok, testing revealed a problem. With #ifdef USE_TLS MULTIPLE_THREADS_OFFSET offsetof (struct _pthread_descr_struct, p_header.data.multiple_threads) - sizeof (struct _pthread_descr_struct) #else MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads) #endif in the .sym file we try to compile #ifdef USE_TLS void dummy(void) { asm ("@@@name@@@MULTIPLE_THREADS_OFFSET@@@value@@@%0@@@end@@@" : : "i" (something)); #else asm ("@@@name@@@MULTIPLE_THREADS_OFFSET@@@value@@@%0@@@end@@@" : : "i" (somethingelse)); #endif } which means a syntax error if USE_TLS is not defined. This can be either solved by adding some dummy never used define, say TCB_OFFSET_DUMMY 0 #ifdef USE_TLS ... or by the following change (which I've bootstrapped/regtested on IA-64 with both --with-tls --without-__thread and --without-tls --without-__thread). 2003-01-15 Jakub Jelinek <jakub@redhat.com> * scripts/gen-as-const.awk: Pass // comments through after starting dummy function. linuxthreads/ * sysdeps/ia64/tls.h (tcbhead_t): Use the TLS ABI required layout if USE_TLS only. (NONTLS_INIT_TP): Revert last change. * sysdeps/ia64/tcb-offsets.sym (MULTIPLE_THREADS_OFFSET): Define to offsetof (tcbhead_t, multiple_threads) if USE_TLS not defined. --- libc/linuxthreads/sysdeps/ia64/tls.h.jj 2003-01-13 13:57:10.000000000 +0100 +++ libc/linuxthreads/sysdeps/ia64/tls.h 2003-01-14 18:12:27.000000000 +0100 @@ -32,13 +32,6 @@ typedef union dtv void *pointer; } dtv_t; - -typedef struct -{ - dtv_t *dtv; - void *private; -} tcbhead_t; - #else /* __ASSEMBLER__ */ # include <tcb-offsets.h> #endif /* __ASSEMBLER__ */ @@ -49,6 +42,13 @@ typedef struct # define USE_TLS 1 # ifndef __ASSEMBLER__ + +typedef struct +{ + dtv_t *dtv; + void *private; +} tcbhead_t; + /* This is the size of the initial TCB. */ # define TLS_INIT_TCB_SIZE sizeof (tcbhead_t) @@ -106,14 +106,22 @@ typedef struct #else # ifndef __ASSEMBLER__ + +typedef struct +{ + void *tcb; + dtv_t *dtv; + void *self; + int multiple_threads; +} tcbhead_t; + /* Get the thread descriptor definition. */ # include <linuxthreads/descr.h> # define NONTLS_INIT_TP \ do { \ - static struct _pthread_descr_struct nontls_init_tp \ - = { .p_header.data.multiple_threads = 0 }; \ - __thread_self = ((__typeof (__thread_self)) &nontls_init_tp) + 1; \ + static const tcbhead_t nontls_init_tp = { .multiple_threads = 0 }; \ + __thread_self = (__typeof (__thread_self)) &nontls_init_tp; \ } while (0) #endif --- libc/linuxthreads/sysdeps/ia64/tcb-offsets.sym.jj 2003-01-13 13:57:10.000000000 +0100 +++ libc/linuxthreads/sysdeps/ia64/tcb-offsets.sym 2003-01-15 01:03:27.000000000 +0100 @@ -1,4 +1,9 @@ #include <sysdep.h> #include <tls.h> +// This comment ensures USE_TLS is output inside of the test function +#ifdef USE_TLS MULTIPLE_THREADS_OFFSET offsetof (struct _pthread_descr_struct, p_header.data.multiple_threads) - sizeof (struct _pthread_descr_struct) +#else +MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads) +#endif --- libc/scripts/gen-as-const.awk.jj 2002-12-28 00:05:53.000000000 +0100 +++ libc/scripts/gen-as-const.awk 2003-01-15 01:02:38.000000000 +0100 @@ -17,6 +17,9 @@ NF >= 1 && !started { started = 1; } +# // comments go straight through, after starting the function +/^\/\// { print; next } + NF == 1 { sub(/^.*$/, "& &"); } NF > 1 { Jakub
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |