This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Another libio patch
- To: drepper at gnu dot ai dot mit dot edu (Ulrich Drepper)
- Subject: Another libio patch
- From: hjl at lucon dot org (H.J. Lu)
- Date: Fri, 10 Oct 1997 15:09:11 -0700 (PDT)
- Cc: egcs at cygnus dot com
Hi,
Please discard my previous libio patch. This patch should
fix both glibc 2 and libc 5. Please let me know the result
on libc 5.3.12 on linux/x86.
Thanks.
--
H.J. Lu (hjl@gnu.ai.mit.edu)
---
Thu Oct 9 07:08:41 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
* libio.h (_IO_LOCK_T): Handle glibc 2 when _IO_MTSAFE_IO is
not defined.
* filedoalloc.c (_IO_file_doallocate): Don't call
_IO_cleanup_registration_needed if __linux__ is defined.
* iofclose.c (fclose): Make it weak alias of _IO_fclose if
__ELF__ is defined.
* iovsprintf.c (vsprintf): Make it weak alias of _IO_vsprintf
if __ELF__ is defined.
* iovsscanf.c (vsscanf): Make it weak alias of _IO_vsscanf if
__ELF__ is defined.
* config/linuxlibc1.mt (MT_CFLAGS): Defined as -D_G_HAVE_MMAP.
(IO_OBJECTS): Add filedoalloc.o fileops.o genops.o iofclose.o
iovsprintf.o iovsscanf.o strops.o.
Index: libio/filedoalloc.c
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libio/filedoalloc.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 filedoalloc.c
--- filedoalloc.c 1997/09/08 01:01:01 1.1.1.2
+++ filedoalloc.c 1997/10/09 19:47:37
@@ -75,7 +75,7 @@
char *p;
struct stat st;
-#ifndef _LIBC
+#if !defined(_LIBC) && !defined(__linux__)
/* If _IO_cleanup_registration_needed is non-zero, we should call the
function it points to. This is to make sure _IO_cleanup gets called
on exit. We call it from _IO_file_doallocate, since that is likely
Index: libio/iofclose.c
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libio/iofclose.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 iofclose.c
--- iofclose.c 1997/09/08 01:01:02 1.1.1.2
+++ iofclose.c 1997/10/09 19:02:33
@@ -55,4 +55,8 @@
#ifdef weak_alias
weak_alias (_IO_fclose, fclose)
+#else
+#ifdef __ELF__
+#pragma weak fclose = _IO_fclose
+#endif
#endif
Index: libio/iovsprintf.c
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libio/iovsprintf.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 iovsprintf.c
--- iovsprintf.c 1997/09/08 01:01:05 1.1.1.2
+++ iovsprintf.c 1997/10/09 19:03:52
@@ -54,4 +54,8 @@
#ifdef weak_alias
weak_alias (_IO_vsprintf, vsprintf)
+#else
+#ifdef __ELF__
+#pragma weak vsprintf = _IO_vsprintf
+#endif
#endif
Index: libio/iovsscanf.c
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libio/iovsscanf.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 iovsscanf.c
--- iovsscanf.c 1997/09/08 01:01:05 1.1.1.2
+++ iovsscanf.c 1997/10/09 19:03:29
@@ -51,4 +51,8 @@
#ifdef weak_alias
weak_alias (_IO_vsscanf, __vsscanf)
weak_alias (_IO_vsscanf, vsscanf)
+#else
+#ifdef __ELF__
+#pragma weak vsscanf = _IO_vsscanf
+#endif
#endif
Index: libio/libio.h
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libio/libio.h,v
retrieving revision 1.1.1.6
diff -u -r1.1.1.6 libio.h
--- libio.h 1997/10/09 17:31:37 1.1.1.6
+++ libio.h 1997/10/10 21:53:01
@@ -157,15 +157,17 @@
# endif
#else
/* XXX This will go away as soon as comthread is finished. */
-# ifdef __linux__
+# if defined __GLIBC__ && __GLIBC__ >= 2
+# define _IO_LOCK_T void *
+# else
+# ifdef __linux__
struct _IO_lock_t {
void *ptr;
short int field1;
short int field2;
};
-# define _IO_LOCK_T struct _IO_lock_t
-# else
-typedef void _IO_lock_t;
+# define _IO_LOCK_T struct _IO_lock_t
+# endif
# endif
#endif
Index: libio/config/linuxlibc1.mt
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libio/config/linuxlibc1.mt,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 linuxlibc1.mt
--- linuxlibc1.mt 1997/10/09 17:31:39 1.1.1.3
+++ linuxlibc1.mt 1997/10/09 19:38:44
@@ -9,7 +9,9 @@
LIBIO_INCLUDE=
# We have those in libc.a.
-IO_OBJECTS=iogetc.o ioputc.o iofeof.o ioferror.o
+IO_OBJECTS=iogetc.o ioputc.o iofeof.o ioferror.o \
+ filedoalloc.o fileops.o genops.o iofclose.o \
+ iovsprintf.o iovsscanf.o strops.o
STDIO_WRAP_OBJECTS=
OSPRIM_OBJECTS=
STDIO_OBJECTS=
@@ -19,3 +21,6 @@
indstream.h iomanip.h iostream.h istream.h ostream.h \
parsestream.h pfstream.h procbuf.h stdiostream.h stream.h \
streambuf.h strfile.h strstream.h
+
+# A bad kludge
+MT_CFLAGS=-D_G_HAVE_MMAP