* Glibc broken for ia64
@ 2003-01-14 15:40 Andreas Schwab
2003-01-14 15:47 ` Jakub Jelinek
0 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2003-01-14 15:40 UTC (permalink / raw)
To: libc-hacker
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.
Andreas.
--- linuxthreads/sysdeps/ia64/tls.h.~1.3.~ 2003-01-13 10:10:10.000000000 +0100
+++ linuxthreads/sysdeps/ia64/tls.h 2003-01-14 12:15:22.000000000 +0100
@@ -116,6 +116,14 @@ typedef struct
__thread_self = ((__typeof (__thread_self)) &nontls_init_tp) + 1; \
} while (0)
+/* Return the thread descriptor for the current thread. */
+# undef THREAD_SELF
+# define THREAD_SELF (__thread_self - 1)
+
+# undef INIT_THREAD_SELF
+# define INIT_THREAD_SELF(descr, nr) \
+ (__thread_self = (struct _pthread_descr_struct *)(descr) + 1)
+
#endif
#endif /* USE_TLS */
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Glibc broken for ia64
2003-01-14 15:40 Glibc broken for ia64 Andreas Schwab
@ 2003-01-14 15:47 ` Jakub Jelinek
2003-01-14 15:54 ` Andreas Schwab
0 siblings, 1 reply; 8+ messages in thread
From: Jakub Jelinek @ 2003-01-14 15:47 UTC (permalink / raw)
To: Andreas Schwab; +Cc: libc-hacker
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?
Jakub
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Glibc broken for ia64
2003-01-14 15:47 ` Jakub Jelinek
@ 2003-01-14 15:54 ` Andreas Schwab
2003-01-14 17:23 ` Jakub Jelinek
0 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2003-01-14 15:54 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: libc-hacker
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).
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Glibc broken for ia64
2003-01-14 15:54 ` Andreas Schwab
@ 2003-01-14 17:23 ` Jakub Jelinek
2003-01-15 1:08 ` [PATCH] " Jakub Jelinek
0 siblings, 1 reply; 8+ messages in thread
From: Jakub Jelinek @ 2003-01-14 17:23 UTC (permalink / raw)
To: Andreas Schwab; +Cc: libc-hacker
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.
2003-01-14 Jakub Jelinek <jakub@redhat.com>
* 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-14 18:19:17.000000000 +0100
@@ -1,4 +1,8 @@
#include <sysdep.h>
#include <tls.h>
+#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
Jakub
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Re: Glibc broken for ia64
2003-01-14 17:23 ` Jakub Jelinek
@ 2003-01-15 1:08 ` Jakub Jelinek
2003-01-15 1:36 ` Roland McGrath
0 siblings, 1 reply; 8+ messages in thread
From: Jakub Jelinek @ 2003-01-15 1:08 UTC (permalink / raw)
To: Ulrich Drepper, Roland McGrath; +Cc: Andreas Schwab, libc-hacker
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Re: Glibc broken for ia64
2003-01-15 1:08 ` [PATCH] " Jakub Jelinek
@ 2003-01-15 1:36 ` Roland McGrath
2003-01-15 9:54 ` [PATCH] Re: Glibc broken for ia64 (take 2) Jakub Jelinek
0 siblings, 1 reply; 8+ messages in thread
From: Roland McGrath @ 2003-01-15 1:36 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Ulrich Drepper, Andreas Schwab, libc-hacker
> 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
> }
Yeah, I noticed that at the start and never did anything about it. I think
having an explicit non-kludge separator between the includes and the
expressions is fine, either your patch or just something like:
$1 == "--" { next }
There is no reason to pass anything like comments through, it's just an
intermediate file.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Re: Glibc broken for ia64 (take 2)
2003-01-15 1:36 ` Roland McGrath
@ 2003-01-15 9:54 ` Jakub Jelinek
2003-01-16 18:25 ` Ulrich Drepper
0 siblings, 1 reply; 8+ messages in thread
From: Jakub Jelinek @ 2003-01-15 9:54 UTC (permalink / raw)
To: Roland McGrath; +Cc: Ulrich Drepper, Andreas Schwab, libc-hacker
On Tue, Jan 14, 2003 at 05:36:17PM -0800, Roland McGrath wrote:
> Yeah, I noticed that at the start and never did anything about it. I think
> having an explicit non-kludge separator between the includes and the
> expressions is fine, either your patch or just something like:
> $1 == "--" { next }
> There is no reason to pass anything like comments through, it's just an
> intermediate file.
That's much nicer. Thanks.
The following seemed to generate the same tcb-offsets.h as the
previous patch in both --without-tls and --with-tls case.
2003-01-15 Jakub Jelinek <jakub@redhat.com>
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 10:35:19.000000000 +0100
@@ -1,4 +1,9 @@
#include <sysdep.h>
#include <tls.h>
+--
+#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
Jakub
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Re: Glibc broken for ia64 (take 2)
2003-01-15 9:54 ` [PATCH] Re: Glibc broken for ia64 (take 2) Jakub Jelinek
@ 2003-01-16 18:25 ` Ulrich Drepper
0 siblings, 0 replies; 8+ messages in thread
From: Ulrich Drepper @ 2003-01-16 18:25 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: libc-hacker
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jakub Jelinek wrote:
> The following seemed to generate the same tcb-offsets.h as the
> previous patch in both --without-tls and --with-tls case.
I've applied the patch. Thanks,
- --
- --------------. ,-. 444 Castro Street
Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA
Red Hat `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+JvkN2ijCOnn/RHQRAqgRAKCw33sRxaRgGsZbSLAj1zqjgnHK1QCgxOHp
qrE8BSpOFdsJxwcCHnn7KSc=
=Gq9V
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2003-01-16 18:25 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-14 15:40 Glibc broken for ia64 Andreas Schwab
2003-01-14 15:47 ` Jakub Jelinek
2003-01-14 15:54 ` Andreas Schwab
2003-01-14 17:23 ` Jakub Jelinek
2003-01-15 1:08 ` [PATCH] " Jakub Jelinek
2003-01-15 1:36 ` Roland McGrath
2003-01-15 9:54 ` [PATCH] Re: Glibc broken for ia64 (take 2) Jakub Jelinek
2003-01-16 18:25 ` Ulrich Drepper
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).