Hi,
I updated my TLS patches on savannah. Neal, can you have a look at
the hurd part? It is relatively straight forward, it shouldn't be a
problem. As I said earlier, the -transitional version is only meant for
a debian transition package.
Now, here is the glibc part inline for discussion:
First I had to make MACHINE_THREAD_STATE_FLAVR defined to
i386_REGS_SEGS_STATE instead of i386_THREAD_STATE_****, because in many
places, we need to save/restore the segment registers as well. However,
this breaks some places that create new contexts and don't want to
know about segments, so I added MACHINE_NEW_THREAD_STATE_FLAVR which
is defined to i386_THREAD_STATE_****, and used that instead in those
places.
The second part is composed of two initialization fixups:
- when using cthreads, init() copies argc, argv and envp to a new stack,
add a hurd_startup_data structure, and switches to it. However,
argv[0], are not copied, so that the test ((void *) d == argv[0])
always evaluates to false. A simple way to fix it is after finding out
that ((void *) d != argv[0]) (which means we have a hurd_startup_data
structure in d), to check that phdr was provided by the exec server
or was zeroed by init().
- _start points on the first instruction, not on the elf header.
__executable_start does point on the elf header.
Samuel
Index: hurd/hurdfault.c
RCS file: /,v
retrieving revision 1.21
diff -u -p -r1.21 hurdfault.c
hurd/hurdfault.c21 Dec 2005 22:16:20 -00001.21
hurd/hurdfault.c12 Jun 2007 00:02:53 -0000
@@ -214,7 +214,7 @@ _hurdsig_fault_init(void)
__proc_handle_exceptions (port,
sigexc,
forward_sigexc, MACH_MSG_TYPE_MAKE_SEND,
- MACHINE_THREAD_STATE_FLAVR,
+ MACHINE_NEW_THREAD_STATE_FLAVR,
(natural_t *) &state,
MACHINE_THREAD_STATE_****));
assert_perror (err);
Index: mach/setup-thread.c
RCS file: /,v
retrieving revision 1.19
mach/setup-thread.c22 Dec 2005 11:31:24 -00001.19
mach/setup-thread.c12 Jun 2007 00:02:54 -0000
@@ -73,7 +73,7 @@ __mach_setup_thread()
if (error = __vm_protect (task, stack, __vm_page_size, 0, VM_PRT_NNE))
return error;
- return __thread_set_state (thread, MACHINE_THREAD_STATE_FLAVR,
+ return __thread_set_state (thread, MACHINE_NEW_THREAD_STATE_FLAVR,
(natural_t *) &ts, tssize);
}
Index: sysdeps/generic/thread_state.h
RCS file: /,v
retrieving revision 1.2
sysdeps/generic/thread_state.h6 Jul 2001 04:55:50 -00001.2
sysdeps/generic/thread_state.h12 Jun 2007 00:02:54 -0000
@@ -23,6 +23,7 @@
/* Replace <machinewith "i386" or "mips" or whatever. */
+#define MACHINE_NEW_THREAD_STATE_FLAVR<machine>_NEW_THREAD_STATE
#define MACHINE_THREAD_STATE_FLAVR<machine>_THREAD_STATE
#define MACHINE_THREAD_STATE_****<machine>_THREAD_STATE_****
Index:
RCS file: /,v
retrieving revision 1.5
6 Jul 2001 04:55:56 -00001.5
12 Jun 2007 00:02:54 -0000
@@ -19,6 +19,7 @@
#include <mach/machine/thread_status.h>
+#define MACHINE_NEW_THREAD_STATE_FLAVRALPHA_THREAD_STATE
#define MACHINE_THREAD_STATE_FLAVRALPHA_THREAD_STATE
#define MACHINE_THREAD_STATE_****ALPHA_THREAD_STATE_****
Index:
RCS file: /,v
retrieving revision 1.14
6 Jul 2001 04:56:00 -00001.14
12 Jun 2007 00:02:54 -0000
@@ -19,7 +19,8 @@
#include <mach/machine/thread_status.h>
-#define MACHINE_THREAD_STATE_FLAVRi386_THREAD_STATE
+#define MACHINE_NEW_THREAD_STATE_FLAVRi386_THREAD_STATE
+#define MACHINE_THREAD_STATE_FLAVRi386_REGS_SEGS_STATE
#define MACHINE_THREAD_STATE_****i386_THREAD_STATE_****
#define machine_thread_state i386_thread_state
Index:
RCS file: /,v
retrieving revision 1.2
26 Aug 2002 22:39:44 -00001.2
12 Jun 2007 00:02:54 -0000
@@ -19,6 +19,7 @@
#include <mach/machine/thread_status.h>
+#define MACHINE_NEW_THREAD_STATE_FLAVRPPC_THREAD_STATE
#define MACHINE_THREAD_STATE_FLAVRPPC_THREAD_STATE
#define MACHINE_THREAD_STATE_****PPC_THREAD_STATE_****
2007-06-23 19:27:14.000000000 +0000
2007-06-23 21:41:40.000000000 +0000
@@ -116,14 +116,14 @@
/* If we are the bootstrap task started by the kernel,
then after the environment pointers there is no Hurd
data block; the argument strings start there. */
- if ((void *) d == argv[0])
+ if ((void *) d == argv[0] || !d->phdr)
{
#ifndef SHARED
/* We may need to see our own phdrs, e.g. for TLS setup.
Try the usual kludge to find the headers without help from
the exec server. */
- extern const void _start;
- const ElfW(Ehdr) *const ehdr = &_start;
+ extern const void __executable_start;
+ const ElfW(Ehdr) *const ehdr = &__executable_start;
_dl_phdr = (ElfW(Phdr) *) ((const void *) ehdr + ehdr->e_phoff);
_dl_phnum = ehdr->e_phnum;
assert (ehdr->e_phentsize == sizeof (ElfW(Phdr)));
Bug-hurd mailing list
Bug-hurd (AT) gnu (DOT) org