This is the mail archive of the libc-hacker@sourceware.cygnus.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]

A static, none thread patch


While working on ia64 which is static only and has no threads, the
patch here is needed. You can verify it by doing

# .../configure  --prefix=/usr --disable-profile --disable-shared --disable-sanity-checks --disable-versioning -without-pic-default --enable-static-nss --enable-add-ons=crypt

on ia32.

BTW, I cannot do cvs check out. I got

cvs [checkout aborted]: connect to glibc.cygnus.com:2401 failed: Connection refused

Any ideas?

Thanks.


-- 
H.J. Lu (hjl@gnu.org)
---
Thu Jul 29 10:20:53 1999  H.J. Lu  <hjl@gnu.org>

	* sysdeps/generic/bits/libc-lock.h (__libc_cleanup_end): New.

	* libio/iofputs.c (fputs_unlocked): Weak aliase if _IO_MTSAFE_IO
	is not defined.
	* libio/iofgets.c (fgets_unlocked): Likewise.
	* libio/iofread.c (fread_unlocked): Likewise.
	* libio/iofwrite.c (fwrite_unlocked): Likewise.

	* malloc/malloc.c (ptmalloc_init): Make sure __libc_pagesize is
	initiailized.

	* elf/dl-load.c (_dl_init_paths): Set up rtld_search_dirs only
	if necessary.
	Check SHARED instead of PIC.

Index: sysdeps/generic/bits/libc-lock.h
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/sysdeps/generic/bits/libc-lock.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 libc-lock.h
--- sysdeps/generic/bits/libc-lock.h	1997/11/06 17:04:25	1.1.1.1
+++ sysdeps/generic/bits/libc-lock.h	1999/07/29 06:42:52
@@ -90,6 +90,8 @@
 /* End critical region with cleanup.  */
 #define __libc_cleanup_region_end(DOIT)
 
+/* Sometimes we have to exit the block in the middle.  */
+#define __libc_cleanup_end(DOIT)
 
 /* We need portable names for some of the functions.  */
 #define __libc_mutex_unlock
Index: libio/iofputs.c
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/libio/iofputs.c,v
retrieving revision 1.1.1.3
diff -u -p -r1.1.1.3 iofputs.c
--- libio/iofputs.c	1998/06/13 18:30:45	1.1.1.3
+++ libio/iofputs.c	1999/07/29 07:07:25
@@ -48,3 +48,7 @@ _IO_fputs (str, fp)
 #ifdef weak_alias
 weak_alias (_IO_fputs, fputs)
 #endif
+
+#ifndef _IO_MTSAFE_IO
+weak_alias (_IO_fputs, fputs_unlocked)
+#endif
Index: libio/iofgets.c
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/libio/iofgets.c,v
retrieving revision 1.1.1.5
diff -u -p -r1.1.1.5 iofgets.c
--- libio/iofgets.c	1998/11/09 16:02:25	1.1.1.5
+++ libio/iofgets.c	1999/07/29 07:09:09
@@ -65,3 +65,7 @@ _IO_fgets (buf, n, fp)
 #ifdef weak_alias
 weak_alias (_IO_fgets, fgets)
 #endif
+
+#ifndef _IO_MTSAFE_IO
+weak_alias (_IO_fgets, fgets_unlocked)
+#endif
Index: libio/iofread.c
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/libio/iofread.c,v
retrieving revision 1.1.1.4
diff -u -p -r1.1.1.4 iofread.c
--- libio/iofread.c	1998/11/13 23:44:17	1.1.1.4
+++ libio/iofread.c	1999/07/29 07:09:43
@@ -48,3 +48,7 @@ _IO_fread (buf, size, count, fp)
 #ifdef weak_alias
 weak_alias (_IO_fread, fread)
 #endif
+
+#ifndef _IO_MTSAFE_IO
+weak_alias (_IO_fread, fread_unlocked)
+#endif
Index: libio/iofwrite.c
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/libio/iofwrite.c,v
retrieving revision 1.1.1.4
diff -u -p -r1.1.1.4 iofwrite.c
--- libio/iofwrite.c	1998/07/15 00:17:53	1.1.1.4
+++ libio/iofwrite.c	1999/07/29 07:11:07
@@ -53,3 +53,7 @@ _IO_fwrite (buf, size, count, fp)
 #ifdef weak_alias
 weak_alias (_IO_fwrite, fwrite)
 #endif
+
+#ifndef _IO_MTSAFE_IO
+weak_alias (_IO_fwrite, fwrite_unlocked)
+#endif
Index: malloc/malloc.c
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/malloc/malloc.c,v
retrieving revision 1.1.1.24
diff -u -p -r1.1.1.24 malloc.c
--- malloc/malloc.c	1999/07/28 16:45:14	1.1.1.24
+++ malloc/malloc.c	1999/07/29 15:54:21
@@ -1663,7 +1663,6 @@ ptmalloc_init __MALLOC_P((void))
   /* Initialize the pthreads interface. */
   if (__pthread_initialize != NULL)
     __pthread_initialize();
-  __libc_pagesize = __getpagesize();
 #endif
   mutex_init(&main_arena.mutex);
   mutex_init(&list_lock);
@@ -1671,6 +1670,9 @@ ptmalloc_init __MALLOC_P((void))
   tsd_setspecific(arena_key, (Void_t *)&main_arena);
   thread_atfork(ptmalloc_lock_all, ptmalloc_unlock_all, ptmalloc_init_all);
 #endif /* !defined NO_THREADS */
+#ifdef _LIBC
+  __libc_pagesize = __getpagesize();
+#endif
 #if defined _LIBC || defined MALLOC_HOOKS
   if((s = getenv("MALLOC_TRIM_THRESHOLD_")))
     mALLOPt(M_TRIM_THRESHOLD, atoi(s));
Index: elf/dl-load.c
===================================================================
RCS file: /work/cvs/gnu/glibc-2.1/elf/dl-load.c,v
retrieving revision 1.1.1.41
diff -u -p -r1.1.1.41 dl-load.c
--- elf/dl-load.c	1999/06/27 01:13:39	1.1.1.41
+++ elf/dl-load.c	1999/07/29 16:58:43
@@ -500,7 +500,7 @@ _dl_init_paths (const char *llp)
   const char *strp;
   struct r_search_path_elem *pelem, **aelem;
   size_t round_size;
-#ifdef PIC
+#ifdef SHARED
   struct link_map *l;
 #endif
 
@@ -518,52 +518,58 @@ _dl_init_paths (const char *llp)
   if (rtld_search_dirs == NULL)
     _dl_signal_error (ENOMEM, NULL, "cannot create search path array");
 
-  round_size = ((2 * sizeof (struct r_search_path_elem) - 1
-		 + ncapstr * sizeof (enum r_dir_status))
-		/ sizeof (struct r_search_path_elem));
-
-  rtld_search_dirs[0] = (struct r_search_path_elem *)
-    malloc ((sizeof (system_dirs) / sizeof (system_dirs[0]) - 1)
-	    * round_size * sizeof (struct r_search_path_elem));
-  if (rtld_search_dirs[0] == NULL)
-    _dl_signal_error (ENOMEM, NULL, "cannot create cache for search path");
-
-  pelem = all_dirs = rtld_search_dirs[0];
-  strp = system_dirs;
-  idx = 0;
-
-  do
+  if (sizeof (system_dirs) / sizeof (system_dirs[0]) > 1)
     {
-      size_t cnt;
-
-      *aelem++ = pelem;
-
-      pelem->what = "system search path";
-      pelem->where = NULL;
-
-      pelem->dirname = strp;
-      pelem->dirnamelen = system_dirs_len[idx];
-      strp += system_dirs_len[idx] + 1;
-
-      if (pelem->dirname[0] != '/')
-	for (cnt = 0; cnt < ncapstr; ++cnt)
-	  pelem->status[cnt] = existing;
-      else
-	for (cnt = 0; cnt < ncapstr; ++cnt)
-	  pelem->status[cnt] = unknown;
-
-      pelem->next = (++idx == (sizeof (system_dirs_len)
-			       / sizeof (system_dirs_len[0]))
-		     ? NULL : (pelem + round_size));
-
-      pelem += round_size;
+      round_size = ((2 * sizeof (struct r_search_path_elem) - 1
+      		     + ncapstr * sizeof (enum r_dir_status))
+		    / sizeof (struct r_search_path_elem));
+
+      rtld_search_dirs[0] = (struct r_search_path_elem *)
+      	malloc ((sizeof (system_dirs) / sizeof (system_dirs[0]) - 1)
+		* round_size * sizeof (struct r_search_path_elem));
+      if (rtld_search_dirs[0] == NULL)
+	_dl_signal_error (ENOMEM, NULL, "cannot create cache for search path");
+
+      pelem = all_dirs = rtld_search_dirs[0];
+      strp = system_dirs;
+      idx = 0;
+
+      do
+	{
+	  size_t cnt;
+
+	  *aelem++ = pelem;
+
+	  pelem->what = "system search path";
+	  pelem->where = NULL;
+
+	  pelem->dirname = strp;
+	  pelem->dirnamelen = system_dirs_len[idx];
+	  strp += system_dirs_len[idx] + 1;
+
+	  if (pelem->dirname[0] != '/')
+	    for (cnt = 0; cnt < ncapstr; ++cnt)
+	      pelem->status[cnt] = existing;
+	  else
+	    for (cnt = 0; cnt < ncapstr; ++cnt)
+	      pelem->status[cnt] = unknown;
+
+	  pelem->next = (++idx == (sizeof (system_dirs_len)
+	  			  / sizeof (system_dirs_len[0]))
+			 ? NULL : (pelem + round_size));
+
+	  pelem += round_size;
+	}
+      while (idx < sizeof (system_dirs_len)
+		   / sizeof (system_dirs_len[0]));
     }
-  while (idx < sizeof (system_dirs_len) / sizeof (system_dirs_len[0]));
+  else
+    rtld_search_dirs[0] = NULL;
 
   max_dirnamelen = SYSTEM_DIRS_MAX_LEN;
   *aelem = NULL;
 
-#ifdef PIC
+#ifdef SHARED
   /* This points to the map of the main object.  */
   l = _dl_loaded;
   if (l != NULL)
@@ -580,7 +586,7 @@ _dl_init_paths (const char *llp)
       else
 	l->l_rpath_dirs = NULL;
     }
-#endif	/* PIC */
+#endif	/* SHARED */
 
   if (llp != NULL && *llp != '\0')
     {

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