* A static, none thread patch
@ 1999-07-29 10:33 H.J. Lu
1999-07-29 23:34 ` Ulrich Drepper
0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 1999-07-29 10:33 UTC (permalink / raw)
To: Ulrich Drepper; +Cc: GNU C Library
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')
{
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: A static, none thread patch
1999-07-29 10:33 A static, none thread patch H.J. Lu
@ 1999-07-29 23:34 ` Ulrich Drepper
1999-07-30 7:35 ` H.J. Lu
0 siblings, 1 reply; 4+ messages in thread
From: Ulrich Drepper @ 1999-07-29 23:34 UTC (permalink / raw)
To: GNU C Library
I have added the patch except for this:
> * elf/dl-load.c (_dl_init_paths): Set up rtld_search_dirs only
> if necessary.
If there are no system dirs something is wrong.
> Check SHARED instead of PIC.
I won't add this isolated patch. And I'm still not convinced it's
really necesary.
And HJ: Please finally learn that I do read the mailing list and don't
send me the patches twice.
--
---------------. drepper at gnu.org ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com `------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: A static, none thread patch
1999-07-29 23:34 ` Ulrich Drepper
@ 1999-07-30 7:35 ` H.J. Lu
1999-07-30 7:57 ` Roland McGrath
0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 1999-07-30 7:35 UTC (permalink / raw)
To: drepper; +Cc: GNU C Library
>
> I have added the patch except for this:
>
I'd like to see them in 2.1.2 branch. I cannot use 2.2 for ia64. I
need a known working, stable C library for ia64.
> > * elf/dl-load.c (_dl_init_paths): Set up rtld_search_dirs only
> > if necessary.
>
> If there are no system dirs something is wrong.
As I said, I got it when I configured glibc as static only on ia32.
I got
----trusted-dirs.h---
#define SYSTEM_DIRS \
""
#define SYSTEM_DIRS_LEN \
0
#define SYSTEM_DIRS_MAX_LEN 0
----
Maybe it is due to there is no run-time linker configured.
>
> > Check SHARED instead of PIC.
>
> I won't add this isolated patch. And I'm still not convinced it's
> really necesary.
>
I will see if it is needed for ia64 when everything is there.
Thanks.
H.J.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: A static, none thread patch
1999-07-30 7:35 ` H.J. Lu
@ 1999-07-30 7:57 ` Roland McGrath
0 siblings, 0 replies; 4+ messages in thread
From: Roland McGrath @ 1999-07-30 7:57 UTC (permalink / raw)
To: H.J. Lu; +Cc: drepper, GNU C Library
> > > * elf/dl-load.c (_dl_init_paths): Set up rtld_search_dirs only
> > > if necessary.
> >
> > If there are no system dirs something is wrong.
>
> As I said, I got it when I configured glibc as static only on ia32.
> I got
This is the bug. If you are building the elf subdir at all, even
static-only, you need a definition for this (for libdl.a to use).
The right fix is probably just to move the default-rpath definition
in Makeconfig out of the $(build-shared) conditional, since it's in fact
needed any time elf/ is built whether shared or static.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1999-07-30 7:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-29 10:33 A static, none thread patch H.J. Lu
1999-07-29 23:34 ` Ulrich Drepper
1999-07-30 7:35 ` H.J. Lu
1999-07-30 7:57 ` Roland McGrath
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).