This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
A new libio patch for linux
- To: steve at moonglade dot com (Steven J. Madsen)
- Subject: A new libio patch for linux
- From: hjl at lucon dot org (H.J. Lu)
- Date: Fri, 10 Oct 1997 13:41:05 -0700 (PDT)
- Cc: egcs at cygnus dot com, drepper at gnu dot ai dot mit dot edu (Ulrich Drepper)
>
> On Thu, Oct 09, 1997 at 02:38:20PM -0700, Richard Henderson wrote:
> > Would other people verify that this works for them wrt linux
> > libc5 and libstdc++? It works for me on trivial tests on
> > Linux/Alpha, RH 4.2 vintage + binutils 2.8.1. It build for
> > me on an i686 down the way, but I didn't install it.
>
> I'm running Linux x86 2.1.57, libc 5.4.39. This patch:
>
Here is a new libio patch for linux. It should work for libc 5.3.12
or above. Please give it a try if you use libc 5.3.12. Please let me
know the result.
The patch doesn't look very elegant. But it should work. As for
glibc before 2.0.5c, like linux/alpha, I don't have any solution
except for upgrading to glibc 2.0.5c. Ulrich, linux/alpha will
my glibc 2.0.5c patches for __longjmp.c and linuxthreads.
Thanks.
H.J.
---
Thu Oct 9 07:08:41 1997 H.J. Lu (hjl@gnu.ai.mit.edu)
* Makefile.in (empty.c): New target for an empty C file.
(libio.a): Also depend on empty.o. If $(LIBIO_OBJECTS) is
empty, create libio.a with empty.o.
* configure.in (EXTRA_DISTCLEAN): New. set to dummy.c.
* 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/Makefile.in
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libio/Makefile.in,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 Makefile.in
--- Makefile.in 1997/10/01 19:55:50 1.1.1.5
+++ Makefile.in 1997/10/01 20:39:15
@@ -73,10 +73,14 @@
$(LIBIO_OBJECTS): $(_G_CONFIG_H)
-libio.a: $(_G_CONFIG_H) $(LIBIO_OBJECTS)
+libio.a: $(_G_CONFIG_H) $(LIBIO_OBJECTS) empty.o
-rm -rf libio.a
- $(AR) $(AR_FLAGS) libio.a $(LIBIO_OBJECTS)
+ $(AR) $(AR_FLAGS) libio.a $(LIBIO_OBJECTS) \
+ `test x = x"$(LIBIO_OBJECTS)" && echo empty.o`
$(RANLIB) libio.a
+
+empty.c: Makefile
+ echo '/* empty file */' > empty.c
libiostream.a: $(_G_CONFIG_H) $(LIBIOSTREAM_DEP)
-rm -rf libiostream.a
Index: libio/configure.in
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libio/configure.in,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 configure.in
--- configure.in 1997/10/01 19:55:51 1.1.1.4
+++ configure.in 1997/10/01 20:59:54
@@ -82,6 +82,7 @@
XCINCLUDES='-I. -I$(srcdir)'
XCXXINCLUDES='-I. -I$(srcdir)'
MOSTLYCLEAN='*.o pic stamp-picdir core iostream.list'
+EXTRA_DISTCLEAN=dummy.c
DISTCLEAN='config.status Makefile *~ Make.pack target-mkfrag multilib.out'
CLEAN='_G_config.h *.a'
INFO_FILES=iostream
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/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