This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

A libio patch for egcs 1.1/1.0.3a


> A general principle of library design is that code should not be duplicated,
> and this example shows why that is a good principle.  A cleaner solution
> would be for libstdc++ not to define the same symbols that libc does.
> 
> 

There are many versions for libc 5 for Linux. Some older ones
have bugs which will only affect libstdc++, not stdio. That is
why libstdc++ has to provide the fixed libio in order to support
those old Linux C libraries.

Here is a patch for libio in egcs 1.1/1.0.3. Please give it
a try and let me know what you get.

Ulrich, please consider putting it in egcs 1.1 if we want
to support libc 5 in egcs 1.1. I no longer have machines
running libc 5.

Thanks.


-- 
H.J. Lu (hjl@gnu.org)
----
Thu Jul 30 07:34:43 1998  H.J. Lu  (hjl@gnu.org)

	* config/linuxlibc1.mt (MT_CFLAGS): Add -D_G_STDIO_USES_LIBIO
	-D_G_HAVE_WEAK_SYMBOL.

	* genops.c: Add the proper weak alias if _G_STDIO_USES_LIBIO
	and _G_HAVE_WEAK_SYMBOL are defined.
	* iofclose.c: Likewise.
	* iofeof.c: Likewise.
	* ioferror.c: Likewise.
	* iogetc.c: Likewise.
	* ioputc.c: Likewise.
	* iovsprintf.c: Likewise.
	* iovsscanf.c: Likewise.

diff -x CVS -urp /home/work/misc/gnu/import/egcs/libio/config/linuxlibc1.mt ./config/linuxlibc1.mt
--- /home/work/misc/gnu/import/egcs/libio/config/linuxlibc1.mt	Tue Jul 14 08:07:34 1998
+++ ./config/linuxlibc1.mt	Thu Jul 30 09:30:06 1998
@@ -23,4 +23,4 @@ USER_INCLUDES=PlotFile.h SFile.h builtin
 	streambuf.h strfile.h strstream.h libio.h
 
 # A bad kludge
-MT_CFLAGS=-D_G_HAVE_MMAP
+MT_CFLAGS=-D_G_HAVE_MMAP -D_G_STDIO_USES_LIBIO -D_G_HAVE_WEAK_SYMBOL
diff -x CVS -urp /home/work/misc/gnu/import/egcs/libio/genops.c ./genops.c
--- /home/work/misc/gnu/import/egcs/libio/genops.c	Tue Jul 14 08:07:12 1998
+++ ./genops.c	Thu Jul 30 09:31:17 1998
@@ -937,6 +937,8 @@ __io_defs io_defs__;
 
 #ifdef weak_alias
 weak_alias (_IO_cleanup, _cleanup)
+#elif defined(_G_STDIO_USES_LIBIO) && defined(_G_HAVE_WEAK_SYMBOL)
+#pragma weak _cleanup = _IO_cleanup
 #endif
 
 #ifdef text_set_element
diff -x CVS -urp /home/work/misc/gnu/import/egcs/libio/iofclose.c ./iofclose.c
--- /home/work/misc/gnu/import/egcs/libio/iofclose.c	Thu Oct 16 08:30:23 1997
+++ ./iofclose.c	Thu Jul 30 09:31:25 1998
@@ -55,8 +55,6 @@ _IO_fclose (fp)
 
 #ifdef weak_alias
 weak_alias (_IO_fclose, fclose)
-#else
-#ifdef __linux__
+#elif defined(_G_STDIO_USES_LIBIO) && defined(_G_HAVE_WEAK_SYMBOL)
 #pragma weak fclose = _IO_fclose
-#endif
 #endif
diff -x CVS -urp /home/work/misc/gnu/import/egcs/libio/iofeof.c ./iofeof.c
--- /home/work/misc/gnu/import/egcs/libio/iofeof.c	Sat Sep  6 00:42:56 1997
+++ ./iofeof.c	Thu Jul 30 09:29:50 1998
@@ -40,4 +40,6 @@ _IO_feof (fp)
 
 #ifdef weak_alias
 weak_alias (_IO_feof, feof)
+#elif defined(_G_STDIO_USES_LIBIO) && defined(_G_HAVE_WEAK_SYMBOL)
+#pragma weak feof = _IO_feof
 #endif
diff -x CVS -urp /home/work/misc/gnu/import/egcs/libio/ioferror.c ./ioferror.c
--- /home/work/misc/gnu/import/egcs/libio/ioferror.c	Sat Sep  6 00:42:57 1997
+++ ./ioferror.c	Thu Jul 30 09:29:58 1998
@@ -40,4 +40,6 @@ _IO_ferror (fp)
 
 #ifdef weak_alias
 weak_alias (_IO_ferror, ferror)
+#elif defined(_G_STDIO_USES_LIBIO) && defined(_G_HAVE_WEAK_SYMBOL)
+#pragma weak ferror = _IO_ferror
 #endif
diff -x CVS -urp /home/work/misc/gnu/import/egcs/libio/iogetc.c ./iogetc.c
--- /home/work/misc/gnu/import/egcs/libio/iogetc.c	Sat Sep  6 00:43:15 1997
+++ ./iogetc.c	Thu Jul 30 09:29:32 1998
@@ -45,4 +45,6 @@ _IO_getc (fp)
 
 #ifdef weak_alias
 weak_alias (_IO_getc, getc)
+#elif defined(_G_STDIO_USES_LIBIO) && defined(_G_HAVE_WEAK_SYMBOL)
+#pragma weak getc = _IO_getc
 #endif
diff -x CVS -urp /home/work/misc/gnu/import/egcs/libio/ioputc.c ./ioputc.c
--- /home/work/misc/gnu/import/egcs/libio/ioputc.c	Sat Sep  6 00:43:25 1997
+++ ./ioputc.c	Thu Jul 30 09:29:41 1998
@@ -39,4 +39,6 @@ _IO_putc (c, fp)
 
 #ifdef weak_alias
 weak_alias (_IO_putc, putc)
+#elif defined(_G_STDIO_USES_LIBIO) && defined(_G_HAVE_WEAK_SYMBOL)
+#pragma weak putc = _IO_putc
 #endif
diff -x CVS -urp /home/work/misc/gnu/import/egcs/libio/iovsprintf.c ./iovsprintf.c
--- /home/work/misc/gnu/import/egcs/libio/iovsprintf.c	Thu Oct 16 08:30:23 1997
+++ ./iovsprintf.c	Thu Jul 30 09:31:34 1998
@@ -54,8 +54,6 @@ _IO_vsprintf (string, format, args)
 
 #ifdef weak_alias
 weak_alias (_IO_vsprintf, vsprintf)
-#else
-#ifdef __linux__
+#elif defined(_G_STDIO_USES_LIBIO) && defined(_G_HAVE_WEAK_SYMBOL)
 #pragma weak vsprintf = _IO_vsprintf
-#endif
 #endif
diff -x CVS -urp /home/work/misc/gnu/import/egcs/libio/iovsscanf.c ./iovsscanf.c
--- /home/work/misc/gnu/import/egcs/libio/iovsscanf.c	Wed Oct 22 18:17:55 1997
+++ ./iovsscanf.c	Thu Jul 30 09:31:44 1998
@@ -51,8 +51,7 @@ _IO_vsscanf (string, format, args)
 #ifdef weak_alias
 weak_alias (_IO_vsscanf, __vsscanf)
 weak_alias (_IO_vsscanf, vsscanf)
-#else
-#ifdef __linux__
+#elif defined(_G_STDIO_USES_LIBIO) && defined(_G_HAVE_WEAK_SYMBOL)
+#pragma weak __vsscanf = _IO_vsscanf
 #pragma weak vsscanf = _IO_vsscanf
-#endif
 #endif


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