This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

__ctype_init (was: GNU C Library master sources branch, master, updated. glibc-2.14-368-ge9b25bd)


Hi!

During commit review for GNU Hurd suitability I noticed that the
following commit is incomplete (and indeed provokes a SEGFAULT on x86 GNU
Hurd).

On 15 Oct 2011 20:28:33 -0000, drepper@sourceware.org wrote:
> commit fd5bdc0924e0cfd1688b632068c1b26f3b0c88da
> Author: Ulrich Drepper <drepper@gmail.com>
> Date:   Sat Oct 15 16:27:08 2011 -0400
> 
>     Optimize access to isXYZ and toXYZ tables
>     
>     The functions to get the pointers can now depend on the TLS variable
>     be initialized.
> 
> diff --git a/ChangeLog b/ChangeLog
> index 414611a..a708003 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,13 @@
> +2011-10-15  Ulrich Drepper  <drepper@gmail.com>
> +
> +	* ctype/ctype-info.c (__ctype_init): Define.
> +	* include/ctype.h (__ctype_init): Declare.
> +	(__ctype_b_loc): The variable is always initialized.
> +	(__ctype_toupper_loc): Likewise.
> +	(__ctype_tolower_loc): Likewise.
> +	* ctype/Versions: Export __ctype_init for GLIBC_PRIVATE.
> +	* sysdeps/unix/sysv/linux/init-first.c (_init): Call __ctype_init.

> diff --git a/nptl/ChangeLog b/nptl/ChangeLog
> index ae48299..7ff2516 100644
> --- a/nptl/ChangeLog
> +++ b/nptl/ChangeLog
> @@ -1,3 +1,7 @@
> +2011-10-15  Ulrich Drepper  <drepper@gmail.com>
> +
> +	* pthread_create.c (start_thread): Ca;; __ctype_init.
> +

Here are the missing bits.  OK to commit?  I only tested x86 GNU Hurd,
but the others follow analoguously -- and they very likely are not used
in any functional configuration (it is debatable whether we should be
carrying such unused files in-tree; the problem will be to identify all
the unused ones).

For the curious: the Hurd's libthreads and libpthread do not need an
equivalent change to the nptl/pthread_create.c one, because they already
call ``uselocale (LC_GLOBAL_LOCALE)'' which already includes matching
code to what __ctype_init is now doing.

	* csu/init-first.c (__libc_init_first): Call __ctype_init.
	* sysdeps/i386/init-first.c (init): Likewise.
	* sysdeps/mach/hurd/i386/init-first.c (posixland_init): Likewise.
	* sysdeps/mach/hurd/powerpc/init-first.c (posixland_init): Likewise.
	* sysdeps/sh/init-first.c (init): Likewise.

diff --git a/csu/init-first.c b/csu/init-first.c
index fa21274..59fd477 100644
--- a/csu/init-first.c
+++ b/csu/init-first.c
@@ -17,6 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <ctype.h>
 #include <unistd.h>
 #include <sys/types.h>
 
@@ -56,4 +57,7 @@ void __libc_init_first
   /* This is a hack to make the special getopt in GNU libc working.  */
   __getopt_clean_environment (envp);
 #endif
+
+  /* Initialize ctype data.  */
+  __ctype_init ();
 }
diff --git a/sysdeps/i386/init-first.c b/sysdeps/i386/init-first.c
index 2af042f..a8970cf 100644
--- a/sysdeps/i386/init-first.c
+++ b/sysdeps/i386/init-first.c
@@ -17,6 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <ctype.h>
 #include <unistd.h>
 
 extern void __libc_init (int, char **, char **);
@@ -41,6 +42,9 @@ init (int *data)
   /* This is a hack to make the special getopt in GNU libc working.  */
   __getopt_clean_environment (envp);
 #endif
+
+  /* Initialize ctype data.  */
+  __ctype_init ();
 }
 
 #ifdef SHARED
diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c
index ec03de3..d3b2f5d 100644
--- a/sysdeps/mach/hurd/i386/init-first.c
+++ b/sysdeps/mach/hurd/i386/init-first.c
@@ -19,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <assert.h>
+#include <ctype.h>
 #include <hurd.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -89,6 +89,9 @@ posixland_init (int argc, char **argv, char **envp)
   __getopt_clean_environment (envp);
 #endif
 
+  /* Initialize ctype data.  */
+  __ctype_init ();
+
 #if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS
   __libc_global_ctors ();
 #endif
diff --git a/sysdeps/mach/hurd/powerpc/init-first.c b/sysdeps/mach/hurd/powerpc/init-first.c
index 2047cac..48b9100 100644
--- a/sysdeps/mach/hurd/powerpc/init-first.c
+++ b/sysdeps/mach/hurd/powerpc/init-first.c
@@ -18,6 +18,7 @@
    02111-1307 USA.  */
 
 #include <assert.h>
+#include <ctype.h>
 #include <hurd.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -79,6 +80,9 @@ posixland_init (int argc, char **argv, char **envp)
   __getopt_clean_environment (__environ);
 #endif
 
+  /* Initialize ctype data.  */
+  __ctype_init ();
+
 #if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS
   __libc_global_ctors ();
 #endif
diff --git a/sysdeps/sh/init-first.c b/sysdeps/sh/init-first.c
index 1f3a821..b40333e 100644
--- a/sysdeps/sh/init-first.c
+++ b/sysdeps/sh/init-first.c
@@ -17,6 +17,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#include <ctype.h>
 #include <unistd.h>
 
 extern void __libc_init (int, char **, char **);
@@ -41,6 +42,9 @@ init (int *data)
   /* This is a hack to make the special getopt in GNU libc working.  */
   __getopt_clean_environment (envp);
 #endif
+
+  /* Initialize ctype data.  */
+  __ctype_init ();
 }
 
 #ifdef SHARED


GrÃÃe,
 Thomas

Attachment: pgp00000.pgp
Description: PGP signature


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