This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
egcs patch for glibc 2.1
- To: ernst dot molitor at uni-bonn dot de
- Subject: egcs patch for glibc 2.1
- From: hjl at lucon dot org (H.J. Lu)
- Date: Sat, 6 Dec 1997 15:06:26 -0800 (PST)
- Cc: libc-linux at gnu dot ai dot mit dot edu (GNU C Library), egcs at cygnus dot com
>
> Dear H. J. Lu,
>
> thank you very much for your latest patch to glibc-2; on my Linux box,
> with egcs--2.90.20 971201 (gcc2-970802 experimental), glibc-2
> compiled right out of the box after I had applied the patch,
> and until now, the system is up and fine.
>
This patch against egcs 971201 plus my glibc 2.1 patch will make
egcs to work again with glibc 2.1. I have tested it on both libc 5
and glibc 2.1. I think glibc 2.0 will be fine also.
BTW, there is a serious problem with 64bit sigset_t in glibc 2.1
and linux 2.1.71. It breaks all the old binaries which make system
calls with 32bit sigset_t. I think it should be fixed in the kernel
first.
Thanks.
--
H.J. Lu (hjl@gnu.org)
--
Sat Dec 6 14:58:17 1997 H.J. Lu (hjl@gnu.org)
* filebuf.cc (filebuf::open): Call _IO_file_open if
_G_HAVE_IO_FILE_OPEN is 1.
* libio.h (_IO_fpos64_t, _IO_off64_t): Defined if
_G_IO_IO_FILE_VERSION == 0x20001.
* libioP.h (_IO_file_open): New declaration.
* libio.h (_IO_FILE, _IO_stdin_, _IO_stdout_, _IO_stderr_,
_IO_seekoff, _IO_seekpos): Add support for libio in egcs 2.1.
* libioP.h (_IO_seekoff_t, _IO_seekpos_t, _IO_seek_t,
_IO_seekoff, _IO_seekpos, _IO_default_seekoff,
_IO_default_seekpos, _IO_default_seek, _IO_file_seekoff,
_IO_file_seek, _IO_str_seekoff, _IO_pos_BAD, _IO_pos_as_off,
_IO_pos_0): Ditto.
* streambuf.h (streamoff, streampos): Ditto.
Wed Dec 3 10:49:39 1997 H.J. Lu (hjl@gnu.org)
* streambuf.cc (streambuf::~streambuf): Don't delete _lock
for _IO_stdin/_IO_stdout/_IO_stderr.
Mon Nov 17 07:36:58 1997 H.J. Lu (hjl@gnu.org)
* gen-params (__extension__): Use only if gcc version >= 2.8.
Index: filebuf.cc
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libio/filebuf.cc,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 filebuf.cc
--- filebuf.cc 1997/08/26 00:21:27 1.1.1.1
+++ filebuf.cc 1997/11/24 18:58:01
@@ -111,6 +111,10 @@
posix_mode |= O_CREAT;
if (mode & (int)ios::noreplace)
posix_mode |= O_EXCL;
+#if _G_HAVE_IO_FILE_OPEN
+ return (filebuf*)_IO_file_open (this, filename, posix_mode, prot,
+ read_write, 0);
+#else
int fd = ::open(filename, posix_mode, prot);
if (fd < 0)
return NULL;
@@ -122,6 +126,7 @@
}
_IO_link_in(this);
return this;
+#endif
}
filebuf* filebuf::open(const char *filename, const char *mode)
Index: gen-params
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libio/gen-params,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 gen-params
--- gen-params 1997/12/02 17:24:27 1.1.1.5
+++ gen-params 1997/12/02 17:28:56
@@ -382,8 +382,10 @@
typedef unsigned int ${macro_prefix}uint32_t __attribute__((__mode__(__SI__)));
typedef int ${macro_prefix}int64_t __attribute__((__mode__(__DI__)));
typedef unsigned int ${macro_prefix}uint64_t __attribute__((__mode__(__DI__)));
+#if __GNUC__ > 2 || __GNUC_MINOR__ >= 8
__extension__ typedef long long ${macro_prefix}llong;
__extension__ typedef unsigned long long ${macro_prefix}ullong;
+#endif
#else
typedef $int16_t ${macro_prefix}int16_t;
typedef $uint16_t ${macro_prefix}uint16_t;
Index: libio.h
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libio/libio.h,v
retrieving revision 1.1.1.8
diff -u -r1.1.1.8 libio.h
--- libio.h 1997/12/02 17:24:31 1.1.1.8
+++ libio.h 1997/12/06 22:54:12
@@ -39,6 +39,10 @@
#define _IO_HAVE_ST_BLKSIZE _G_HAVE_ST_BLKSIZE
#define _IO_BUFSIZ _G_BUFSIZ
#define _IO_va_list _G_va_list
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+#define _IO_fpos64_t _G_fpos64_t
+#define _IO_off64_t _G_off64_t
+#endif
#ifdef _G_NEED_STDARG_H
/* This define avoids name pollution if we're using GNU stdarg.h */
@@ -220,7 +224,11 @@
int _fileno;
int _blksize;
+#ifdef _G_IO_IO_FILE_VERSION
+ _IO_off_t _old_offset;
+#else
_IO_off_t _offset;
+#endif
#define __HAVE_COLUMN /* temporary */
/* 1+column number of pbase(); 0 is unknown. */
@@ -233,12 +241,22 @@
#ifdef _IO_LOCK_T
_IO_LOCK_T _lock;
#endif
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+ _IO_off64_t _offset;
+ int _unused2[16]; /* Make sure we don't get into trouble again. */
+#endif
};
#ifndef __cplusplus
typedef struct _IO_FILE _IO_FILE;
#endif
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+#define _IO_stdin_ _IO_2_1_stdin_
+#define _IO_stdout_ _IO_2_1_stdout_
+#define _IO_stderr_ _IO_2_1_stderr_
+#endif
+
struct _IO_FILE_plus;
extern struct _IO_FILE_plus _IO_stdin_, _IO_stdout_, _IO_stderr_;
#define _IO_stdin ((_IO_FILE*)(&_IO_stdin_))
@@ -321,8 +339,13 @@
extern _IO_ssize_t _IO_padn __P ((_IO_FILE *, int, _IO_ssize_t));
extern _IO_size_t _IO_sgetn __P ((_IO_FILE *, void *, _IO_size_t));
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+extern _IO_fpos64_t _IO_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
+extern _IO_fpos64_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos64_t, int));
+#else
extern _IO_fpos_t _IO_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
extern _IO_fpos_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos_t, int));
+#endif
extern void _IO_free_backup_area __P ((_IO_FILE *));
Index: libioP.h
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libio/libioP.h,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 libioP.h
--- libioP.h 1997/12/02 17:24:31 1.1.1.4
+++ libioP.h 1997/12/02 17:28:57
@@ -138,8 +138,13 @@
(MODE==1), or the end of the file (MODE==2).
It matches the streambuf::seekoff virtual function.
It is also used for the ANSI fseek function. */
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+typedef _IO_fpos64_t (*_IO_seekoff_t) __P ((_IO_FILE *FP, _IO_off64_t OFF,
+ int DIR, int MODE));
+#else
typedef _IO_fpos_t (*_IO_seekoff_t) __P ((_IO_FILE *FP, _IO_off_t OFF,
int DIR, int MODE));
+#endif
#define _IO_SEEKOFF(FP, OFF, DIR, MODE) JUMP3 (__seekoff, FP, OFF, DIR, MODE)
/* The 'seekpos' hook also moves the stream position,
@@ -147,7 +152,11 @@
It matches the streambuf::seekpos virtual function.
It is also used for the ANSI fgetpos and fsetpos functions. */
/* The _IO_seek_cur and _IO_seek_end options are not allowed. */
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+typedef _IO_fpos64_t (*_IO_seekpos_t) __P ((_IO_FILE *, _IO_fpos64_t, int));
+#else
typedef _IO_fpos_t (*_IO_seekpos_t) __P ((_IO_FILE *, _IO_fpos_t, int));
+#endif
#define _IO_SEEKPOS(FP, POS, FLAGS) JUMP2 (__seekpos, FP, POS, FLAGS)
/* The 'setbuf' hook gives a buffer to the file.
@@ -196,7 +205,11 @@
It generalizes the Unix lseek(2) function.
It matches the streambuf::sys_seek virtual function, which is
specific to this implementation. */
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+typedef _IO_fpos64_t (*_IO_seek_t) __P ((_IO_FILE *, _IO_off64_t, int));
+#else
typedef _IO_fpos_t (*_IO_seek_t) __P ((_IO_FILE *, _IO_off_t, int));
+#endif
#define _IO_SYSSEEK(FP, OFFSET, MODE) JUMP2 (__seek, FP, OFFSET, MODE)
/* The 'sysclose' hook is used to finalize (close, finish up) an
@@ -260,8 +273,13 @@
/* Generic functions */
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+extern _IO_fpos64_t _IO_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
+extern _IO_fpos64_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos64_t, int));
+#else
extern _IO_fpos_t _IO_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
extern _IO_fpos_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos_t, int));
+#endif
extern void _IO_switch_to_main_get_area __P ((_IO_FILE *));
extern void _IO_switch_to_backup_area __P ((_IO_FILE *));
@@ -297,13 +315,24 @@
extern _IO_size_t _IO_default_xsputn __P ((_IO_FILE *, const void *,
_IO_size_t));
extern _IO_size_t _IO_default_xsgetn __P ((_IO_FILE *, void *, _IO_size_t));
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+extern _IO_fpos64_t _IO_default_seekoff __P ((_IO_FILE *,
+ _IO_off64_t, int, int));
+extern _IO_fpos64_t _IO_default_seekpos __P ((_IO_FILE *,
+ _IO_fpos64_t, int));
+#else
extern _IO_fpos_t _IO_default_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
extern _IO_fpos_t _IO_default_seekpos __P ((_IO_FILE *, _IO_fpos_t, int));
+#endif
extern _IO_ssize_t _IO_default_write __P ((_IO_FILE *, const void *,
_IO_ssize_t));
extern _IO_ssize_t _IO_default_read __P ((_IO_FILE *, void *, _IO_ssize_t));
extern int _IO_default_stat __P ((_IO_FILE *, void *));
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+extern _IO_fpos64_t _IO_default_seek __P ((_IO_FILE *, _IO_off64_t, int));
+#else
extern _IO_fpos_t _IO_default_seek __P ((_IO_FILE *, _IO_off_t, int));
+#endif
extern int _IO_default_sync __P ((_IO_FILE *));
#define _IO_default_close ((_IO_close_t) _IO_default_sync)
@@ -335,7 +364,13 @@
extern int _IO_file_doallocate __P ((_IO_FILE *));
extern _IO_FILE* _IO_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t));
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+extern _IO_fpos64_t _IO_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
+extern _IO_fpos64_t _IO_file_seek __P ((_IO_FILE *, _IO_off64_t, int));
+#else
extern _IO_fpos_t _IO_file_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
+extern _IO_fpos_t _IO_file_seek __P ((_IO_FILE *, _IO_off_t, int));
+#endif
extern _IO_size_t _IO_file_xsputn __P ((_IO_FILE *, const void *, _IO_size_t));
extern int _IO_file_stat __P ((_IO_FILE *, void *));
extern int _IO_file_close __P ((_IO_FILE *));
@@ -344,13 +379,14 @@
#define _IO_file_is_open(__fp) ((__fp)->_fileno >= 0)
extern void _IO_file_init __P ((_IO_FILE *));
extern _IO_FILE* _IO_file_attach __P ((_IO_FILE *, int));
+extern _IO_FILE* _IO_file_open __P ((_IO_FILE *, const char *, int, int,
+ int, int));
extern _IO_FILE* _IO_file_fopen __P ((_IO_FILE *, const char *, const char *));
extern _IO_ssize_t _IO_file_write __P ((_IO_FILE *, const void *,
_IO_ssize_t));
extern _IO_ssize_t _IO_file_read __P ((_IO_FILE *, void *, _IO_ssize_t));
extern int _IO_file_sync __P ((_IO_FILE *));
extern int _IO_file_close_it __P ((_IO_FILE *));
-extern _IO_fpos_t _IO_file_seek __P ((_IO_FILE *, _IO_off_t, int));
extern void _IO_file_finish __P ((_IO_FILE *, int));
/* Jumptable functions for proc_files. */
@@ -361,7 +397,11 @@
extern int _IO_str_underflow __P ((_IO_FILE *));
extern int _IO_str_overflow __P ((_IO_FILE *, int));
extern int _IO_str_pbackfail __P ((_IO_FILE *, int));
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+extern _IO_fpos64_t _IO_str_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int));
+#else
extern _IO_fpos_t _IO_str_seekoff __P ((_IO_FILE *, _IO_off_t, int, int));
+#endif
extern void _IO_str_finish __P ((_IO_FILE *, int));
/* Other strfile functions */
@@ -475,11 +515,19 @@
/* _IO_pos_BAD is an _IO_fpos_t value indicating error, unknown, or EOF. */
#ifndef _IO_pos_BAD
-# define _IO_pos_BAD ((_IO_fpos_t) -1)
+# if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+# define _IO_pos_BAD ((_IO_fpos64_t) -1)
+# else
+# define _IO_pos_BAD ((_IO_fpos_t) -1)
+# endif
#endif
/* _IO_pos_as_off converts an _IO_fpos_t value to an _IO_off_t value. */
#ifndef _IO_pos_as_off
-# define _IO_pos_as_off(__pos) ((_IO_off_t) (__pos))
+# if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+# define _IO_pos_as_off(__pos) ((_IO_off64_t) (__pos))
+# else
+# define _IO_pos_as_off(__pos) ((_IO_off_t) (__pos))
+# endif
#endif
/* _IO_pos_adjust adjust an _IO_fpos_t by some number of bytes. */
#ifndef _IO_pos_adjust
@@ -487,7 +535,11 @@
#endif
/* _IO_pos_0 is an _IO_fpos_t value indicating beginning of file. */
#ifndef _IO_pos_0
-# define _IO_pos_0 ((_IO_fpos_t) 0)
+# if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+# define _IO_pos_0 ((_IO_fpos64_t) 0)
+# else
+# define _IO_pos_0 ((_IO_fpos_t) 0)
+# endif
#endif
#ifdef __cplusplus
Index: streambuf.cc
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libio/streambuf.cc,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 streambuf.cc
--- streambuf.cc 1997/09/17 20:12:35 1.1.1.3
+++ streambuf.cc 1997/12/03 18:46:48
@@ -220,7 +220,8 @@
{
_IO_default_finish(this,0);
#ifdef _IO_MTSAFE_IO
- delete _lock;
+ if (this != _IO_stdin && this != _IO_stdout && this != _IO_stderr)
+ delete _lock;
#endif
}
Index: streambuf.h
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libio/streambuf.h,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 streambuf.h
--- streambuf.h 1997/10/01 19:55:55 1.1.1.3
+++ streambuf.h 1997/11/24 20:00:40
@@ -66,8 +66,13 @@
#undef open
#undef close
+#if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001
+typedef _IO_off64_t streamoff;
+typedef _IO_fpos64_t streampos;
+#else
typedef _IO_off_t streamoff;
typedef _IO_fpos_t streampos;
+#endif
typedef _IO_ssize_t streamsize;
typedef unsigned long __fmtflags;