From cc13edc8d4351bb96bb2e0d785284ec089705cfa Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Fri, 30 Aug 2002 01:51:11 +0000 Subject: [PATCH] * sysdeps/mach/hurd/i386/init-first.c (_hurd_stack_setup: doinit): Change argument type from int to intptr_t. * locale/global-locale.c (__libc_tsd_LOCALE_data): Conditionalize the initializer on [! _HURD_THREADVAR_H] (bad kludge). * sysdeps/mach/hurd/i386/init-first.c (init): Initialize _HURD_THREADVAR_LOCALE slot to &_nl_global_locale. * hurd/hurdsig.c (_hurdsig_init): Likewise. Zero other slots. --- ChangeLog | 9 +++++++++ hurd/hurdsig.c | 7 ++++++- locale/global-locale.c | 6 +++++- sysdeps/mach/hurd/i386/init-first.c | 4 +++- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 394789a143..25de4eee0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2002-08-29 Roland McGrath + * sysdeps/mach/hurd/i386/init-first.c (_hurd_stack_setup: doinit): + Change argument type from int to intptr_t. + + * locale/global-locale.c (__libc_tsd_LOCALE_data): Conditionalize the + initializer on [! _HURD_THREADVAR_H] (bad kludge). + * sysdeps/mach/hurd/i386/init-first.c (init): Initialize + _HURD_THREADVAR_LOCALE slot to &_nl_global_locale. + * hurd/hurdsig.c (_hurdsig_init): Likewise. Zero other slots. + * sysdeps/mach/_strerror.c (__strerror_r): Add libc_hidden_def. * sysdeps/mach/hurd/pwrite64.c: No libc_hidden_def (__libc_pwrite64). diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c index 2507a8b8a9..bbd0c17182 100644 --- a/hurd/hurdsig.c +++ b/hurd/hurdsig.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2000,01 +/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2000,01,2002 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -31,6 +31,7 @@ #include "hurdfault.h" #include "hurdmalloc.h" /* XXX */ +#include "../locale/localeinfo.h" const char *_hurdsig_getenv (const char *); @@ -1265,6 +1266,10 @@ _hurdsig_init (const int *intarray, size_t intarraysize) malloc (__hurd_threadvar_max * sizeof (unsigned long int)); if (__hurd_sigthread_variables == NULL) __libc_fatal ("hurd: Can't allocate threadvars for signal thread\n"); + memset (__hurd_sigthread_variables, 0, + __hurd_threadvar_max * sizeof (unsigned long int)); + __hurd_sigthread_variables[_HURD_THREADVAR_LOCALE] + = (unsigned long int) &_nl_global_locale; /* Reinitialize the MiG support routines so they will use a per-thread variable for the cached reply port. */ diff --git a/locale/global-locale.c b/locale/global-locale.c index 70f10ab5ae..bec7498dae 100644 --- a/locale/global-locale.c +++ b/locale/global-locale.c @@ -58,6 +58,10 @@ __thread void *__libc_tsd_LOCALE = &_nl_global_locale; #else __libc_tsd_define (, LOCALE) /* This is a bad kludge presuming the variable name used by the macros. - Using typeof makes sure to barf if we do not match the macro definition. */ + Using typeof makes sure to barf if we do not match the macro definition. + This ifndef is a further bad kludge for Hurd, where there is an explicit + initialization. */ +# ifndef _HURD_THREADVAR_H __typeof (__libc_tsd_LOCALE_data) __libc_tsd_LOCALE_data = &_nl_global_locale; +# endif #endif diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c index 787a750045..47edae5086 100644 --- a/sysdeps/mach/hurd/i386/init-first.c +++ b/sysdeps/mach/hurd/i386/init-first.c @@ -26,6 +26,7 @@ #include #include "hurdstartup.h" #include "hurdmalloc.h" /* XXX */ +#include "../locale/localeinfo.h" extern void __mach_init (void); extern void __libc_init (int, char **, char **); @@ -145,6 +146,7 @@ init (int *data) for malloc et al, or so we can use malloc below for the real threadvars array. */ memset (threadvars, 0, sizeof threadvars); + threadvars[_HURD_THREADVAR_LOCALE] = (unsigned long int) &_nl_global_locale; __hurd_threadvar_stack_offset = (unsigned long int) threadvars; /* Since the cthreads initialization code uses malloc, and the @@ -319,7 +321,7 @@ strong_alias (posixland_init, __libc_init_first); void _hurd_stack_setup (volatile int argc, ...) { - void doinit (int *data) + void doinit (intptr_t *data) { /* This function gets called with the argument data at TOS. */ void doinit1 (volatile int argc, ...)