This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Zack Weinberg <zack@bitmover.com> writes: |> I spent a lot of time today bashing at this, but there is no easy fix. |> I guess this is just a "libio should be smaller" whine. Note that an |> awful lot of places in there know when a stream is wide; it seems to |> me that this ought to be hidden in the jump table. There's no reason |> why not to redirect _IO_setb instead of having _IO_setb and _IO_wsetb, |> for example. The wide stream stuff isn't actually that big. I was only able to reduce the size by about 8.3K by leaving out the wide stream support (see the attached patch for how I did that). The rest from libio is mostly the printf stuff that is pulled in by malloc. A much bigger problem is the gconv stuff, which is indirectly referenced in strtol via btowc. The biggest single object file that is included is regex.o, which is referenced by gconv_db.c. I don't see a way to reduce this. Andreas.
Index: libio/fileops.c
===================================================================
RCS file: /glibc/cvsfiles/libc/libio/fileops.c,v
retrieving revision 1.45
diff -u -a -r1.45 libio/fileops.c
--- libio/fileops.c 1999/08/18 23:05:01 1.45
+++ libio/fileops.c 1999/08/19 10:39:28
@@ -107,6 +107,9 @@
(_IO_IS_FILEBUF+_IO_NO_READS+_IO_NO_WRITES+_IO_TIED_PUT_GET)
+weak_extern(_IO_wdo_write)
+weak_extern(_IO_wsetb)
+
void
_IO_new_file_init (fp)
_IO_FILE *fp;
Index: libio/iofdopen.c
===================================================================
RCS file: /glibc/cvsfiles/libc/libio/iofdopen.c,v
retrieving revision 1.13
diff -u -a -r1.13 libio/iofdopen.c
--- libio/iofdopen.c 1999/07/06 15:40:20 1.13
+++ libio/iofdopen.c 1999/08/19 10:39:28
@@ -118,7 +118,7 @@
#ifdef _IO_MTSAFE_IO
new_f->fp.file._lock = &new_f->lock;
#endif
- _IO_no_init (&new_f->fp.file, 0, 0, &new_f->wd, &_IO_wfile_jumps);
+ _IO_no_init (&new_f->fp.file, 0, 0, &new_f->wd, NULL);
_IO_JUMPS (&new_f->fp) = &_IO_file_jumps;
_IO_file_init (&new_f->fp.file);
#if !_IO_UNIFIED_JUMPTABLES
Index: libio/iofopen.c
===================================================================
RCS file: /glibc/cvsfiles/libc/libio/iofopen.c,v
retrieving revision 1.13
diff -u -a -r1.13 libio/iofopen.c
--- libio/iofopen.c 1999/06/16 21:32:31 1.13
+++ libio/iofopen.c 1999/08/19 10:39:28
@@ -47,7 +47,7 @@
#ifdef _IO_MTSAFE_IO
new_f->fp.file._lock = &new_f->lock;
#endif
- _IO_no_init (&new_f->fp.file, 0, 0, &new_f->wd, &_IO_wfile_jumps);
+ _IO_no_init (&new_f->fp.file, 0, 0, &new_f->wd, NULL);
_IO_JUMPS (&new_f->fp) = &_IO_file_jumps;
_IO_file_init (&new_f->fp.file);
#if !_IO_UNIFIED_JUMPTABLES
Index: libio/iofopen64.c
===================================================================
RCS file: /glibc/cvsfiles/libc/libio/iofopen64.c,v
retrieving revision 1.7
diff -u -a -r1.7 libio/iofopen64.c
--- libio/iofopen64.c 1999/06/16 21:32:32 1.7
+++ libio/iofopen64.c 1999/08/19 10:39:28
@@ -48,7 +48,7 @@
#ifdef _IO_MTSAFE_IO
new_f->fp.file._lock = &new_f->lock;
#endif
- _IO_no_init (&new_f->fp.file, 0, 0, &new_f->wd, &_IO_wfile_jumps);
+ _IO_no_init (&new_f->fp.file, 0, 0, &new_f->wd, NULL);
_IO_JUMPS (&new_f->fp) = &_IO_file_jumps;
_IO_file_init (&new_f->fp.file);
#if !_IO_UNIFIED_JUMPTABLES
Index: libio/iofwide.c
===================================================================
RCS file: /glibc/cvsfiles/libc/libio/iofwide.c,v
retrieving revision 1.1
diff -u -a -r1.1 libio/iofwide.c
--- libio/iofwide.c 1999/06/16 22:05:02 1.1
+++ libio/iofwide.c 1999/08/19 10:39:28
@@ -136,6 +136,11 @@
# error "somehow determine this from LC_CTYPE"
#endif
+ /* Special case for file streams: avoid referencing _IO_wfile_ops if
+ no wide character functions are used at all. */
+ if (fp->_wide_data->_wide_vtable == NULL)
+ fp->_wide_data->_wide_vtable = &_IO_wfile_jumps;
+
/* From now on use the wide character callback functions. */
((struct _IO_FILE_plus *) fp)->vtable = fp->_wide_data->_wide_vtable;
}
Index: libio/iovdprintf.c
===================================================================
RCS file: /glibc/cvsfiles/libc/libio/iovdprintf.c,v
retrieving revision 1.6
diff -u -a -r1.6 libio/iovdprintf.c
--- libio/iovdprintf.c 1999/06/16 21:49:49 1.6
+++ libio/iovdprintf.c 1999/08/19 10:39:28
@@ -42,7 +42,7 @@
#ifdef _IO_MTSAFE_IO
tmpfil.file._lock = &lock;
#endif
- _IO_no_init (&tmpfil.file, 0, 0, &wd, &_IO_wfile_jumps);
+ _IO_no_init (&tmpfil.file, 0, 0, &wd, NULL);
_IO_JUMPS (&tmpfil.file) = &_IO_file_jumps;
_IO_file_init (&tmpfil.file);
#if !_IO_UNIFIED_JUMPTABLES
Index: libio/stdfiles.c
===================================================================
RCS file: /glibc/cvsfiles/libc/libio/stdfiles.c,v
retrieving revision 1.12
diff -u -a -r1.12 libio/stdfiles.c
--- libio/stdfiles.c 1999/06/16 21:57:43 1.12
+++ libio/stdfiles.c 1999/08/19 10:39:28
@@ -35,15 +35,13 @@
#ifdef _IO_MTSAFE_IO
#define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
- static struct _IO_wide_data _IO_wide_data_##FD \
- = { ._wide_vtable = &_IO_wfile_jumps }; \
+ static struct _IO_wide_data _IO_wide_data_##FD; \
struct _IO_FILE_plus NAME \
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD, &_IO_wide_data_##FD), \
&_IO_file_jumps};
#else
#define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
- static struct _IO_wide_data _IO_wide_data_##FD \
- = { ._wide_vtable = &_IO_wfile_jumps }; \
+ static struct _IO_wide_data _IO_wide_data_##FD; \
struct _IO_FILE_plus NAME \
= {FILEBUF_LITERAL(CHAIN, FLAGS, FD, &_IO_wide_data_##FD), \
&_IO_file_jumps};
Index: stdio-common/printf_fp.c
===================================================================
RCS file: /glibc/cvsfiles/libc/stdio-common/printf_fp.c,v
retrieving revision 1.34
diff -u -a -r1.34 stdio-common/printf_fp.c
--- stdio-common/printf_fp.c 1999/07/13 23:05:27 1.34
+++ stdio-common/printf_fp.c 1999/08/19 10:39:32
@@ -58,6 +58,7 @@
# undef putc
# define putc(c, f) (wide \
? _IO_putwc_unlocked (c, f) : _IO_putc_unlocked (c, f))
+weak_extern(__woverflow)
# define size_t _IO_size_t
# define FILE _IO_FILE
#else /* ! USE_IN_LIBIO */
Index: sysdeps/generic/printf_fphex.c
===================================================================
RCS file: /glibc/cvsfiles/libc/sysdeps/generic/printf_fphex.c,v
retrieving revision 1.4
diff -u -a -r1.4 sysdeps/generic/printf_fphex.c
--- sysdeps/generic/printf_fphex.c 1999/07/13 23:09:18 1.4
+++ sysdeps/generic/printf_fphex.c 1999/08/19 10:39:33
@@ -44,6 +44,7 @@
# undef putc
# define putc(c, f) (wide \
? _IO_putwc_unlocked (c, f) : _IO_putc_unlocked (c, f))
+weak_extern(__woverflow)
# define size_t _IO_size_t
# define FILE _IO_FILE
#else /* ! USE_IN_LIBIO */
-- Andreas Schwab "And now for something schwab@suse.de completely different." SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |