aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdhemerval Zanella Netto <adhemerval.zanella@linaro.org>2022-12-27 18:11:43 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2023-03-27 13:57:55 -0300
commit3020f72618e4f1d7338cd42b8bc7b2813e961b5a (patch)
treed61cc39cb5aa140de5331cd1a2ba6ab796db0c81
parentf65ca70deaf38db4ca12458e74cefd8ad9063956 (diff)
downloadglibc-3020f72618e4f1d7338cd42b8bc7b2813e961b5a.zip
glibc-3020f72618e4f1d7338cd42b8bc7b2813e961b5a.tar.gz
glibc-3020f72618e4f1d7338cd42b8bc7b2813e961b5a.tar.bz2
libio: Remove the usage of __libc_IO_vtables
Instead of using a special ELF section along with a linker script directive to put the IO vtables within the RELRO section, the libio vtables are all moved to an array marked as data.relro (so linker will place in the RELRO segment without the need of extra directives). To avoid static linking namespace issues and including all vtable referenced objects, all required function pointers are set to weak alias. Checked on x86_64-linux-gnu, i686-linux-gnu, and aarch64-linux-gnu. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
-rw-r--r--Makerules24
-rw-r--r--elf/Makefile16
-rw-r--r--include/libc-symbols.h18
-rw-r--r--libio/Makefile2
-rw-r--r--libio/fileops.c81
-rw-r--r--libio/iofopncook.c60
-rw-r--r--libio/iopopen.c25
-rw-r--r--libio/libio-macros.sym7
-rw-r--r--libio/libioP.h136
-rw-r--r--libio/memstream.c32
-rw-r--r--libio/oldfileops.c23
-rw-r--r--libio/oldiopopen.c23
-rw-r--r--libio/stdio.c3
-rw-r--r--libio/strfile.h2
-rw-r--r--libio/strops.c24
-rw-r--r--libio/tst-vtables-interposed.c5
-rw-r--r--libio/vtables.c478
-rw-r--r--libio/wfileops.c79
-rw-r--r--libio/wmemstream.c32
-rw-r--r--libio/wstrops.c24
-rw-r--r--stdio-common/printf_buffer_as_file.c28
-rw-r--r--stdio-common/wprintf_buffer_as_file.c28
22 files changed, 637 insertions, 513 deletions
diff --git a/Makerules b/Makerules
index 57b3f09..16887cb 100644
--- a/Makerules
+++ b/Makerules
@@ -544,34 +544,10 @@ $(LINK.o) -shared -static-libgcc -Wl,-O1 $(sysdep-LDFLAGS) \
-L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)
endef
-ifeq (yes,$(use-default-link))
# If the linker is good enough, we can let it use its default linker script.
# In the long term the custom linker script will be removed.
shlib-lds =
shlib-lds-flags =
-else
-# binutils only position loadable notes into the first page for binaries,
-# not for shared objects
-# lld --verbose does not dump a linker script. Use -fuse-ld=bfd.
-$(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
- $(LINK.o) -shared -Wl,-O1 \
- -nostdlib -nostartfiles -fuse-ld=bfd \
- $(sysdep-LDFLAGS) $(rtld-LDFLAGS) $(LDFLAGS.so) \
- -Wl,--verbose 2>/dev/null | \
- sed > $@T \
- -e '/^=========/,/^=========/!d;/^=========/d' \
- -e 's@^.*\*(\.jcr).*$$@& \
- PROVIDE(__start___libc_IO_vtables = .);\
- __libc_IO_vtables : { *(__libc_IO_vtables) }\
- PROVIDE(__stop___libc_IO_vtables = .);\
- /DISCARD/ : { *(.gnu.glibc-stub.*) }@'
- test -s $@T
- mv -f $@T $@
-common-generated += shlib.lds
-
-shlib-lds = $(common-objpfx)shlib.lds
-shlib-lds-flags = -T $(shlib-lds)
-endif
define build-shlib
$(build-shlib-helper) -o $@ $(shlib-lds-flags) \
diff --git a/elf/Makefile b/elf/Makefile
index 4d0e04b..be6f2ca 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -595,23 +595,9 @@ $(objpfx)tst-relro-ldso.out: tst-relro-symbols.py $(..)/scripts/glibcelf.py \
$(objpfx)tst-relro-libc.out: tst-relro-symbols.py $(..)/scripts/glibcelf.py \
$(common-objpfx)libc.so
$(PYTHON) tst-relro-symbols.py $(common-objpfx)libc.so \
- --required=_IO_cookie_jumps \
--required=_IO_file_jumps \
- --required=_IO_file_jumps_maybe_mmap \
- --required=_IO_file_jumps_mmap \
- --required=_IO_mem_jumps \
- --required=_IO_printf_buffer_as_file_jumps \
- --required=_IO_proc_jumps \
- --required=_IO_str_jumps \
--required=_IO_wfile_jumps \
- --required=_IO_wfile_jumps_maybe_mmap \
- --required=_IO_wfile_jumps_mmap \
- --required=_IO_wmem_jumps \
- --required=_IO_wprintf_buffer_as_file_jumps \
- --required=_IO_wstr_jumps \
- --optional=_IO_old_cookie_jumps \
- --optional=_IO_old_file_jumps \
- --optional=_IO_old_proc_jumps \
+ --required=__io_vtables \
> $@ 2>&1; $(evaluate-test)
ifeq ($(run-built-tests),yes)
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 155781d..37c91bb 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -243,20 +243,26 @@ for linking")
This is only necessary when defining something in assembly, or playing
funny alias games where the size should be other than what the compiler
thinks it is. */
-#ifdef __ASSEMBLER__
-# define declare_object_symbol_alias(symbol, original, size) \
+#define declare_object_symbol_alias(symbol, original, size) \
declare_object_symbol_alias_1 (symbol, original, size)
+#ifdef __ASSEMBLER__
# define declare_object_symbol_alias_1(symbol, original, s_size) \
strong_alias (original, symbol) ASM_LINE_SEP \
.type C_SYMBOL_NAME (symbol), %object ASM_LINE_SEP \
.size C_SYMBOL_NAME (symbol), s_size ASM_LINE_SEP
#else /* Not __ASSEMBLER__. */
# ifdef HAVE_ASM_SET_DIRECTIVE
-# define declare_symbol_alias_1_alias(symbol, original) \
- ".set " __SYMBOL_PREFIX #symbol ", " __SYMBOL_PREFIX #original
+# define declare_object_symbol_alias_1(symbol, original, size) \
+ asm (".global " __SYMBOL_PREFIX # symbol "\n" \
+ ".type " __SYMBOL_PREFIX # symbol ", %object\n" \
+ ".set " __SYMBOL_PREFIX #symbol ", " __SYMBOL_PREFIX original "\n" \
+ ".size " __SYMBOL_PREFIX #symbol ", " #size "\n");
# else
-# define declare_symbol_alias_1_alias(symbol, original) \
- __SYMBOL_PREFIX #symbol " = " __SYMBOL_PREFIX #original
+# define declare_object_symbol_alias_1(symbol, original, size) \
+ asm (".global " __SYMBOL_PREFIX # symbol "\n" \
+ ".type " __SYMBOL_PREFIX # symbol ", %object\n" \
+ __SYMBOL_PREFIX #symbol " = " __SYMBOL_PREFIX original "\n" \
+ ".size " __SYMBOL_PREFIX #symbol ", " #size "\n");
# endif /* HAVE_ASM_SET_DIRECTIVE */
#endif /* __ASSEMBLER__ */
diff --git a/libio/Makefile b/libio/Makefile
index 52892a2..2877fec 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -51,6 +51,8 @@ routines := \
\
libc_fatal fmemopen oldfmemopen vtables
+gen-as-const-headers += libio-macros.sym
+
tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc \
tst_wprintf2 tst-widetext test-fmemopen tst-ext tst-ext2 \
tst-fgetws tst-ungetwc1 tst-ungetwc2 tst-swscanf tst-sscanf \
diff --git a/libio/fileops.c b/libio/fileops.c
index b75d748..58c9e98 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -815,7 +815,7 @@ _IO_new_file_sync (FILE *fp)
}
libc_hidden_ver (_IO_new_file_sync, _IO_file_sync)
-static int
+int
_IO_file_sync_mmap (FILE *fp)
{
if (fp->_IO_read_ptr != fp->_IO_read_end)
@@ -1109,7 +1109,7 @@ _IO_file_seekoff_mmap (FILE *fp, off64_t offset, int dir, int mode)
return offset;
}
-static off64_t
+off64_t
_IO_file_seekoff_maybe_mmap (FILE *fp, off64_t offset, int dir,
int mode)
{
@@ -1360,7 +1360,7 @@ _IO_file_xsgetn (FILE *fp, void *data, size_t n)
}
libc_hidden_def (_IO_file_xsgetn)
-static size_t
+size_t
_IO_file_xsgetn_mmap (FILE *fp, void *data, size_t n)
{
size_t have;
@@ -1405,7 +1405,7 @@ _IO_file_xsgetn_mmap (FILE *fp, void *data, size_t n)
return s - (char *) data;
}
-static size_t
+size_t
_IO_file_xsgetn_maybe_mmap (FILE *fp, void *data, size_t n)
{
/* We only get here if this is the first attempt to read something.
@@ -1428,76 +1428,3 @@ versioned_symbol (libc, _IO_new_file_seekoff, _IO_file_seekoff, GLIBC_2_1);
versioned_symbol (libc, _IO_new_file_underflow, _IO_file_underflow, GLIBC_2_1);
versioned_symbol (libc, _IO_new_file_write, _IO_file_write, GLIBC_2_1);
versioned_symbol (libc, _IO_new_file_xsputn, _IO_file_xsputn, GLIBC_2_1);
-
-const struct _IO_jump_t _IO_file_jumps libio_vtable =
-{
- JUMP_INIT_DUMMY,
- JUMP_INIT(finish, _IO_file_finish),
- JUMP_INIT(overflow, _IO_file_overflow),
- JUMP_INIT(underflow, _IO_file_underflow),
- JUMP_INIT(uflow, _IO_default_uflow),
- JUMP_INIT(pbackfail, _IO_default_pbackfail),
- JUMP_INIT(xsputn, _IO_file_xsputn),
- JUMP_INIT(xsgetn, _IO_file_xsgetn),
- JUMP_INIT(seekoff, _IO_new_file_seekoff),
- JUMP_INIT(seekpos, _IO_default_seekpos),
- JUMP_INIT(setbuf, _IO_new_file_setbuf),
- JUMP_INIT(sync, _IO_new_file_sync),
- JUMP_INIT(doallocate, _IO_file_doallocate),
- JUMP_INIT(read, _IO_file_read),
- JUMP_INIT(write, _IO_new_file_write),
- JUMP_INIT(seek, _IO_file_seek),
- JUMP_INIT(close, _IO_file_close),
- JUMP_INIT(stat, _IO_file_stat),
- JUMP_INIT(showmanyc, _IO_default_showmanyc),
- JUMP_INIT(imbue, _IO_default_imbue)
-};
-libc_hidden_data_def (_IO_file_jumps)
-
-const struct _IO_jump_t _IO_file_jumps_mmap libio_vtable =
-{
- JUMP_INIT_DUMMY,
- JUMP_INIT(finish, _IO_file_finish),
- JUMP_INIT(overflow, _IO_file_overflow),
- JUMP_INIT(underflow, _IO_file_underflow_mmap),
- JUMP_INIT(uflow, _IO_default_uflow),
- JUMP_INIT(pbackfail, _IO_default_pbackfail),
- JUMP_INIT(xsputn, _IO_new_file_xsputn),
- JUMP_INIT(xsgetn, _IO_file_xsgetn_mmap),
- JUMP_INIT(seekoff, _IO_file_seekoff_mmap),
- JUMP_INIT(seekpos, _IO_default_seekpos),
- JUMP_INIT(setbuf, (_IO_setbuf_t) _IO_file_setbuf_mmap),
- JUMP_INIT(sync, _IO_file_sync_mmap),
- JUMP_INIT(doallocate, _IO_file_doallocate),
- JUMP_INIT(read, _IO_file_read),
- JUMP_INIT(write, _IO_new_file_write),
- JUMP_INIT(seek, _IO_file_seek),
- JUMP_INIT(close, _IO_file_close_mmap),
- JUMP_INIT(stat, _IO_file_stat),
- JUMP_INIT(showmanyc, _IO_default_showmanyc),
- JUMP_INIT(imbue, _IO_default_imbue)
-};
-
-const struct _IO_jump_t _IO_file_jumps_maybe_mmap libio_vtable =
-{
- JUMP_INIT_DUMMY,
- JUMP_INIT(finish, _IO_file_finish),
- JUMP_INIT(overflow, _IO_file_overflow),
- JUMP_INIT(underflow, _IO_file_underflow_maybe_mmap),
- JUMP_INIT(uflow, _IO_default_uflow),
- JUMP_INIT(pbackfail, _IO_default_pbackfail),
- JUMP_INIT(xsputn, _IO_new_file_xsputn),
- JUMP_INIT(xsgetn, _IO_file_xsgetn_maybe_mmap),
- JUMP_INIT(seekoff, _IO_file_seekoff_maybe_mmap),
- JUMP_INIT(seekpos, _IO_default_seekpos),
- JUMP_INIT(setbuf, (_IO_setbuf_t) _IO_file_setbuf_mmap),
- JUMP_INIT(sync, _IO_new_file_sync),
- JUMP_INIT(doallocate, _IO_file_doallocate),
- JUMP_INIT(read, _IO_file_read),
- JUMP_INIT(write, _IO_new_file_write),
- JUMP_INIT(seek, _IO_file_seek),
- JUMP_INIT(close, _IO_file_close),
- JUMP_INIT(stat, _IO_file_stat),
- JUMP_INIT(showmanyc, _IO_default_showmanyc),
- JUMP_INIT(imbue, _IO_default_imbue)
-};
diff --git a/libio/iofopncook.c b/libio/iofopncook.c
index d6a06c5..5511c07 100644
--- a/libio/iofopncook.c
+++ b/libio/iofopncook.c
@@ -30,7 +30,7 @@
#include <shlib-compat.h>
#include <pointer_guard.h>
-static ssize_t
+ssize_t
_IO_cookie_read (FILE *fp, void *buf, ssize_t size)
{
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
@@ -43,7 +43,7 @@ _IO_cookie_read (FILE *fp, void *buf, ssize_t size)
return read_cb (cfile->__cookie, buf, size);
}
-static ssize_t
+ssize_t
_IO_cookie_write (FILE *fp, const void *buf, ssize_t size)
{
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
@@ -63,7 +63,7 @@ _IO_cookie_write (FILE *fp, const void *buf, ssize_t size)
return n;
}
-static off64_t
+off64_t
_IO_cookie_seek (FILE *fp, off64_t offset, int dir)
{
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
@@ -77,7 +77,7 @@ _IO_cookie_seek (FILE *fp, off64_t offset, int dir)
? _IO_pos_BAD : offset);
}
-static int
+int
_IO_cookie_close (FILE *fp)
{
struct _IO_cookie_file *cfile = (struct _IO_cookie_file *) fp;
@@ -91,7 +91,7 @@ _IO_cookie_close (FILE *fp)
}
-static off64_t
+off64_t
_IO_cookie_seekoff (FILE *fp, off64_t offset, int dir, int mode)
{
/* We must force the fileops code to always use seek to determine
@@ -100,31 +100,6 @@ _IO_cookie_seekoff (FILE *fp, off64_t offset, int dir, int mode)
return _IO_file_seekoff (fp, offset, dir, mode);
}
-
-static const struct _IO_jump_t _IO_cookie_jumps libio_vtable = {
- JUMP_INIT_DUMMY,
- JUMP_INIT(finish, _IO_file_finish),
- JUMP_INIT(overflow, _IO_file_overflow),
- JUMP_INIT(underflow, _IO_file_underflow),
- JUMP_INIT(uflow, _IO_default_uflow),
- JUMP_INIT(pbackfail, _IO_default_pbackfail),
- JUMP_INIT(xsputn, _IO_file_xsputn),
- JUMP_INIT(xsgetn, _IO_default_xsgetn),
- JUMP_INIT(seekoff, _IO_cookie_seekoff),
- JUMP_INIT(seekpos, _IO_default_seekpos),
- JUMP_INIT(setbuf, _IO_file_setbuf),
- JUMP_INIT(sync, _IO_file_sync),
- JUMP_INIT(doallocate, _IO_file_doallocate),
- JUMP_INIT(read, _IO_cookie_read),
- JUMP_INIT(write, _IO_cookie_write),
- JUMP_INIT(seek, _IO_cookie_seek),
- JUMP_INIT(close, _IO_cookie_close),
- JUMP_INIT(stat, _IO_default_stat),
- JUMP_INIT(showmanyc, _IO_default_showmanyc),
- JUMP_INIT(imbue, _IO_default_imbue),
-};
-
-
/* Copy the callbacks from SOURCE to *TARGET, with pointer
mangling. */
static void
@@ -209,7 +184,7 @@ versioned_symbol (libc, _IO_fopencookie, fopencookie, GLIBC_2_2);
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
-static off64_t
+off64_t
attribute_compat_text_section
_IO_old_cookie_seek (FILE *fp, off64_t offset, int dir)
{
@@ -226,29 +201,6 @@ _IO_old_cookie_seek (FILE *fp, off64_t offset, int dir)
return (ret == -1) ? _IO_pos_BAD : ret;
}
-static const struct _IO_jump_t _IO_old_cookie_jumps libio_vtable = {
- JUMP_INIT_DUMMY,
- JUMP_INIT(finish, _IO_file_finish),
- JUMP_INIT(overflow, _IO_file_overflow),
- JUMP_INIT(underflow, _IO_file_underflow),
- JUMP_INIT(uflow, _IO_default_uflow),
- JUMP_INIT(pbackfail, _IO_default_pbackfail),
- JUMP_INIT(xsputn, _IO_file_xsputn),
- JUMP_INIT(xsgetn, _IO_default_xsgetn),
- JUMP_INIT(seekoff, _IO_cookie_seekoff),
- JUMP_INIT(seekpos, _IO_default_seekpos),
- JUMP_INIT(setbuf, _IO_file_setbuf),
- JUMP_INIT(sync, _IO_file_sync),
- JUMP_INIT(doallocate, _IO_file_doallocate),
- JUMP_INIT(read, _IO_cookie_read),
- JUMP_INIT(write, _IO_cookie_write),
- JUMP_INIT(seek, _IO_old_cookie_seek),
- JUMP_INIT(close, _IO_cookie_close),
- JUMP_INIT(stat, _IO_default_stat),
- JUMP_INIT(showmanyc, _IO_default_showmanyc),
- JUMP_INIT(imbue, _IO_default_imbue),
-};
-
FILE *
attribute_compat_text_section
_IO_old_fopencookie (void *cookie, const char *mode,
diff --git a/libio/iopopen.c b/libio/iopopen.c
index d0545ad..a64033e 100644
--- a/libio/iopopen.c
+++ b/libio/iopopen.c
@@ -45,8 +45,6 @@ struct _IO_proc_file
};
typedef struct _IO_proc_file _IO_proc_file;
-static const struct _IO_jump_t _IO_proc_jumps;
-
static struct _IO_proc_file *proc_file_chain;
#ifdef _IO_MTSAFE_IO
@@ -297,29 +295,6 @@ _IO_new_proc_close (FILE *fp)
return wstatus;
}
-static const struct _IO_jump_t _IO_proc_jumps libio_vtable = {
- JUMP_INIT_DUMMY,
- JUMP_INIT(finish, _IO_new_file_finish),
- JUMP_INIT(overflow, _IO_new_file_overflow),
- JUMP_INIT(underflow, _IO_new_file_underflow),
- JUMP_INIT(uflow, _IO_default_uflow),
- JUMP_INIT(pbackfail, _IO_default_pbackfail),
- JUMP_INIT(xsputn, _IO_new_file_xsputn),
- JUMP_INIT(xsgetn, _IO_default_xsgetn),
- JUMP_INIT(seekoff, _IO_new_file_seekoff),
- JUMP_INIT(seekpos, _IO_default_seekpos),
- JUMP_INIT(setbuf, _IO_new_file_setbuf),
- JUMP_INIT(sync, _IO_new_file_sync),
- JUMP_INIT(doallocate, _IO_file_doallocate),
- JUMP_INIT(read, _IO_file_read),
- JUMP_INIT(write, _IO_new_file_write),
- JUMP_INIT(seek, _IO_file_seek),
- JUMP_INIT(close, _IO_new_proc_close),
- JUMP_INIT(stat, _IO_file_stat),
- JUMP_INIT(showmanyc, _IO_default_showmanyc),
- JUMP_INIT(imbue, _IO_default_imbue)
-};
-
strong_alias (_IO_new_popen, __new_popen)
versioned_symbol (libc, _IO_new_popen, _IO_popen, GLIBC_2_1);
versioned_symbol (libc, __new_popen, popen, GLIBC_2_1);
diff --git a/libio/libio-macros.sym b/libio/libio-macros.sym
new file mode 100644
index 0000000..cfb5cf2
--- /dev/null
+++ b/libio/libio-macros.sym
@@ -0,0 +1,7 @@
+#include <libioP.h>
+
+--
+
+IO_JUMP_T_SIZE sizeof (struct _IO_jump_t)
+IO_FILE_JUMPS_OFFSET sizeof (struct _IO_jump_t) * IO_FILE_JUMPS
+IO_WFILE_JUMPS_OFFSET sizeof (struct _IO_jump_t) * IO_WFILE_JUMPS
diff --git a/libio/libioP.h b/libio/libioP.h
index 80941b7..d777553 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -469,19 +469,68 @@ extern int _IO_default_sync (FILE *) __THROW;
extern int _IO_default_showmanyc (FILE *) __THROW;
extern void _IO_default_imbue (FILE *, void *) __THROW;
-extern const struct _IO_jump_t _IO_file_jumps;
-libc_hidden_proto (_IO_file_jumps)
-extern const struct _IO_jump_t _IO_file_jumps_mmap attribute_hidden;
-extern const struct _IO_jump_t _IO_file_jumps_maybe_mmap attribute_hidden;
-extern const struct _IO_jump_t _IO_wfile_jumps;
-libc_hidden_proto (_IO_wfile_jumps)
-extern const struct _IO_jump_t _IO_wfile_jumps_mmap attribute_hidden;
-extern const struct _IO_jump_t _IO_wfile_jumps_maybe_mmap attribute_hidden;
-extern const struct _IO_jump_t _IO_old_file_jumps attribute_hidden;
-extern const struct _IO_jump_t _IO_streambuf_jumps;
-extern const struct _IO_jump_t _IO_old_proc_jumps attribute_hidden;
-extern const struct _IO_jump_t _IO_str_jumps attribute_hidden;
-extern const struct _IO_jump_t _IO_wstr_jumps attribute_hidden;
+extern int __printf_buffer_as_file_overflow (FILE *fp, int ch);
+extern size_t __printf_buffer_as_file_xsputn (FILE *fp, const void *buf,
+ size_t len);
+extern wint_t __wprintf_buffer_as_file_overflow (FILE *fp, int ch);
+extern size_t __wprintf_buffer_as_file_xsputn (FILE *fp, const void *buf,
+ size_t len);
+
+enum
+{
+ IO_STR_JUMPS = 0,
+ IO_WSTR_JUMPS = 1,
+ IO_FILE_JUMPS = 2,
+ IO_FILE_JUMPS_MMAP = 3,
+ IO_FILE_JUMPS_MAYBE_MMAP = 4,
+ IO_WFILE_JUMPS = 5,
+ IO_WFILE_JUMPS_MMAP = 6,
+ IO_WFILE_JUMPS_MAYBE_MMAP = 7,
+ IO_COOKIE_JUMPS = 8,
+ IO_PROC_JUMPS = 9,
+ IO_MEM_JUMPS = 10,
+ IO_WMEM_JUMPS = 11,
+ IO_PRINTF_BUFFER_AS_FILE_JUMPS = 12,
+ IO_WPRINTF_BUFFER_AS_FILE_JUMPS = 13,
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
+ IO_OLD_FILE_JUMPS = 14,
+ IO_OLD_PROC_JUMPS = 15,
+ IO_OLD_COOKIED_JUMPS = 16,
+ IO_VTABLES_NUM = IO_OLD_COOKIED_JUMPS + 1,
+#elif SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
+ IO_OLD_COOKIED_JUMPS = 14,
+ IO_VTABLES_NUM = IO_OLD_COOKIED_JUMPS + 1,
+#else
+ IO_VTABLES_NUM = IO_WPRINTF_BUFFER_AS_FILE_JUMPS + 1
+#endif
+};
+#define IO_VTABLES_LEN (IO_VTABLES_NUM * sizeof (struct _IO_jump_t))
+
+extern const struct _IO_jump_t __io_vtables[] attribute_hidden;
+#define _IO_str_jumps (__io_vtables[IO_STR_JUMPS])
+#define _IO_wstr_jumps (__io_vtables[IO_WSTR_JUMPS])
+#define _IO_file_jumps (__io_vtables[IO_FILE_JUMPS])
+#define _IO_file_jumps_mmap (__io_vtables[IO_FILE_JUMPS_MMAP])
+#define _IO_file_jumps_maybe_mmap (__io_vtables[IO_FILE_JUMPS_MAYBE_MMAP])
+#define _IO_wfile_jumps (__io_vtables[IO_WFILE_JUMPS])
+#define _IO_wfile_jumps_mmap (__io_vtables[IO_WFILE_JUMPS_MMAP])
+#define _IO_wfile_jumps_maybe_mmap (__io_vtables[IO_WFILE_JUMPS_MAYBE_MMAP])
+#define _IO_cookie_jumps (__io_vtables[IO_COOKIE_JUMPS])
+#define _IO_proc_jumps (__io_vtables[IO_PROC_JUMPS])
+#define _IO_mem_jumps (__io_vtables[IO_MEM_JUMPS])
+#define _IO_wmem_jumps (__io_vtables[IO_WMEM_JUMPS])
+#define _IO_printf_buffer_as_file_jumps (__io_vtables[IO_PRINTF_BUFFER_AS_FILE_JUMPS])
+#define _IO_wprintf_buffer_as_file_jumps (__io_vtables[IO_WPRINTF_BUFFER_AS_FILE_JUMPS])
+#define _IO_old_file_jumps (__io_vtables[IO_OLD_FILE_JUMPS])
+#define _IO_old_proc_jumps (__io_vtables[IO_OLD_PROC_JUMPS])
+#define _IO_old_cookie_jumps (__io_vtables[IO_OLD_COOKIED_JUMPS])
+
+#ifdef SHARED
+# define libio_static_fn_required(name)
+#else
+# define libio_static_fn_required(name) __asm (".globl " #name);
+#endif
+
extern int _IO_do_write (FILE *, const char *, size_t);
libc_hidden_proto (_IO_do_write)
extern int _IO_new_do_write (FILE *, const char *, size_t);
@@ -593,6 +642,14 @@ extern void _IO_new_file_init_internal (struct _IO_FILE_plus *)
extern FILE* _IO_new_file_setbuf (FILE *, char *, ssize_t);
extern FILE* _IO_file_setbuf_mmap (FILE *, char *, ssize_t);
extern int _IO_new_file_sync (FILE *);
+extern int _IO_file_sync_mmap (FILE *) attribute_hidden;
+extern size_t _IO_file_xsgetn_maybe_mmap (FILE *fp, void *data, size_t n)
+ attribute_hidden;
+extern size_t _IO_file_xsgetn_mmap (FILE *fp, void *data, size_t n)
+ attribute_hidden;
+extern off64_t _IO_file_seekoff_maybe_mmap (FILE *fp, off64_t offset, int dir,
+ int mode)
+ attribute_hidden;
extern int _IO_new_file_underflow (FILE *);
extern int _IO_new_file_overflow (FILE *, int);
extern off64_t _IO_new_file_seekoff (FILE *, off64_t, int, int);
@@ -625,6 +682,10 @@ extern wint_t _IO_wfile_overflow (FILE *, wint_t);
libc_hidden_proto (_IO_wfile_overflow)
extern off64_t _IO_wfile_seekoff (FILE *, off64_t, int, int);
libc_hidden_proto (_IO_wfile_seekoff)
+extern wint_t _IO_wfile_underflow_maybe_mmap (FILE *fp)
+ attribute_hidden;
+extern wint_t _IO_wfile_underflow_mmap (FILE *fp)
+ attribute_hidden;
/* Jumptable functions for proc_files. */
extern FILE* _IO_proc_open (FILE *, const char *, const char *)
@@ -643,13 +704,41 @@ extern int _IO_str_overflow (FILE *, int) __THROW;
libc_hidden_proto (_IO_str_overflow)
extern int _IO_str_pbackfail (FILE *, int) __THROW;
libc_hidden_proto (_IO_str_pbackfail)
-extern off64_t _IO_str_seekoff (FILE *, off64_t, int, int) __THROW;
+extern off64_t _IO_str_seekoff (FILE *, off64_t, int, int) __THROW
+ ;
libc_hidden_proto (_IO_str_seekoff)
extern void _IO_str_finish (FILE *, int) __THROW;
+extern int _IO_str_chk_overflow (FILE *fp, int c) __THROW
+ attribute_hidden;
+
+/* Jumptable functions for fopencookie. */
+extern ssize_t _IO_cookie_read (FILE *fp, void *buf, ssize_t size)
+ attribute_hidden;
+extern ssize_t _IO_cookie_write (FILE *fp, const void *buf, ssize_t size)
+ attribute_hidden;
+extern off64_t _IO_cookie_seek (FILE *fp, off64_t offset, int dir)
+ attribute_hidden;
+extern int _IO_cookie_close (FILE *fp) attribute_hidden;
+extern off64_t _IO_cookie_seekoff (FILE *fp, off64_t offset, int dir, int mode)
+ attribute_hidden;
+extern off64_t _IO_old_cookie_seek (FILE *fp, off64_t offset, int dir)
+ attribute_hidden;
+
+/* Jumptable functions for obstack. */
+extern int __IO_obstack_overflow (FILE *fp, int c) attribute_hidden;
+extern size_t __IO_obstack_xsputn (FILE *fp, const void *data, size_t n)
+ attribute_hidden;
+
+/* Jumptable functions for open_{w}memstream. */
+extern int _IO_mem_sync (FILE* fp) __THROW attribute_hidden;
+extern void _IO_mem_finish (FILE* fp, int) __THROW attribute_hidden;
+extern int _IO_wmem_sync (FILE* fp) __THROW attribute_hidden;
+extern void _IO_wmem_finish (FILE* fp, int) __THROW attribute_hidden;
/* Other strfile functions */
struct _IO_strfile_;
extern ssize_t _IO_str_count (FILE *) __THROW;
+extern int _IO_strn_overflow (FILE *fp, int c) __THROW attribute_hidden;
/* And the wide character versions. */
extern void _IO_wstr_init_static (FILE *, wchar_t *, size_t, wchar_t *)
@@ -662,6 +751,10 @@ extern off64_t _IO_wstr_seekoff (FILE *, off64_t, int, int)
extern wint_t _IO_wstr_pbackfail (FILE *, wint_t) __THROW;
extern void _IO_wstr_finish (FILE *, int) __THROW;
+/* Helper functions. */
+int _IO_helper_overflow (FILE *s, int c);
+int _IO_whelper_overflow (FILE *s, int c);
+
/* Internal versions of v*printf that take an additional flags
parameter. */
extern int __vfprintf_internal (FILE *fp, const char *format, va_list ap,
@@ -895,14 +988,6 @@ _IO_acquire_lock_fct (FILE **p)
} while (0)
#endif
-/* Collect all vtables in a special section for vtable verification.
- These symbols cover the extent of this section. */
-symbol_set_declare (__libc_IO_vtables)
-
-/* libio vtables need to carry this attribute so that they pass
- validation. */
-#define libio_vtable __attribute__ ((section ("__libc_IO_vtables")))
-
#ifdef SHARED
/* If equal to &_IO_vtable_check (with pointer guard protection),
unknown vtable pointers are valid. This function pointer is solely
@@ -937,12 +1022,9 @@ void _IO_vtable_check (void) attribute_hidden;
static inline const struct _IO_jump_t *
IO_validate_vtable (const struct _IO_jump_t *vtable)
{
- /* Fast path: The vtable pointer is within the __libc_IO_vtables
- section. */
- uintptr_t section_length = __stop___libc_IO_vtables - __start___libc_IO_vtables;
uintptr_t ptr = (uintptr_t) vtable;
- uintptr_t offset = ptr - (uintptr_t) __start___libc_IO_vtables;
- if (__glibc_unlikely (offset >= section_length))
+ uintptr_t offset = ptr - (uintptr_t) &__io_vtables;
+ if (__glibc_unlikely (offset >= IO_VTABLES_LEN))
/* The vtable pointer is not in the expected section. Use the
slow path, which will terminate the process if necessary. */
_IO_vtable_check ();
diff --git a/libio/memstream.c b/libio/memstream.c
index ad5726b..90b42d1 100644
--- a/libio/memstream.c
+++ b/libio/memstream.c
@@ -29,34 +29,6 @@ struct _IO_FILE_memstream
};
-static int _IO_mem_sync (FILE* fp) __THROW;
-static void _IO_mem_finish (FILE* fp, int) __THROW;
-
-
-static const struct _IO_jump_t _IO_mem_jumps libio_vtable =
-{
- JUMP_INIT_DUMMY,
- JUMP_INIT (finish, _IO_mem_finish),
- JUMP_INIT (overflow, _IO_str_overflow),
- JUMP_INIT (underflow, _IO_str_underflow),
- JUMP_INIT (uflow, _IO_default_uflow),
- JUMP_INIT (pbackfail, _IO_str_pbackfail),
- JUMP_INIT (xsputn, _IO_default_xsputn),
- JUMP_INIT (xsgetn, _IO_default_xsgetn),
- JUMP_INIT (seekoff, _IO_str_seekoff),
- JUMP_INIT (seekpos, _IO_default_seekpos),
- JUMP_INIT (setbuf, _IO_default_setbuf),
- JUMP_INIT (sync, _IO_mem_sync),
- JUMP_INIT (doallocate, _IO_default_doallocate),
- JUMP_INIT (read, _IO_default_read),
- JUMP_INIT (write, _IO_default_write),
- JUMP_INIT (seek, _IO_default_seek),
- JUMP_INIT (close, _IO_default_close),
- JUMP_INIT (stat, _IO_default_stat),
- JUMP_INIT(showmanyc, _IO_default_showmanyc),
- JUMP_INIT(imbue, _IO_default_imbue)
-};
-
/* Open a stream that writes into a malloc'd buffer that is expanded as
necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
and the number of characters written on fflush or fclose. */
@@ -105,7 +77,7 @@ libc_hidden_def (__open_memstream)
weak_alias (__open_memstream, open_memstream)
-static int
+int
_IO_mem_sync (FILE *fp)
{
struct _IO_FILE_memstream *mp = (struct _IO_FILE_memstream *) fp;
@@ -123,7 +95,7 @@ _IO_mem_sync (FILE *fp)
}
-static void
+void
_IO_mem_finish (FILE *fp, int dummy)
{
struct _IO_FILE_memstream *mp = (struct _IO_FILE_memstream *) fp;
diff --git a/libio/oldfileops.c b/libio/oldfileops.c
index dd455a8..d6abbfd 100644
--- a/libio/oldfileops.c
+++ b/libio/oldfileops.c
@@ -716,29 +716,6 @@ _IO_old_file_xsputn (FILE *f, const void *data, size_t n)
return n - to_do;
}
-
-const struct _IO_jump_t _IO_old_file_jumps libio_vtable =
-{
- JUMP_INIT_DUMMY,
- JUMP_INIT(finish, _IO_old_file_finish),
- JUMP_INIT(overflow, _IO_old_file_overflow),
- JUMP_INIT(underflow, _IO_old_file_underflow),
- JUMP_INIT(uflow, _IO_default_uflow),
- JUMP_INIT(pbackfail, _IO_default_pbackfail),
- JUMP_INIT(xsputn, _IO_old_file_xsputn),
- JUMP_INIT(xsgetn, _IO_default_xsgetn),
- JUMP_INIT(seekoff, _IO_old_file_seekoff),
- JUMP_INIT(seekpos, _IO_default_seekpos),
- JUMP_INIT(setbuf, _IO_old_file_setbuf),
- JUMP_INIT(sync, _IO_old_file_sync),
- JUMP_INIT(doallocate, _IO_file_doallocate),
- JUMP_INIT(read, _IO_file_read),
- JUMP_INIT(write, _IO_old_file_write),
- JUMP_INIT(seek, _IO_file_seek),
- JUMP_INIT(close, _IO_file_close),
- JUMP_INIT(stat, _IO_file_stat)
-};
-
compat_symbol (libc, _IO_old_do_write, _IO_do_write, GLIBC_2_0);
compat_symbol (libc, _IO_old_file_attach, _IO_file_attach, GLIBC_2_0);
compat_symbol (libc, _IO_old_file_close_it, _IO_file_close_it, GLIBC_2_0);
diff --git a/libio/oldiopopen.c b/libio/oldiopopen.c
index aa5e379..b3eccc1 100644
--- a/libio/oldiopopen.c
+++ b/libio/oldiopopen.c
@@ -208,29 +208,6 @@ _IO_old_proc_close (FILE *fp)
return wstatus;
}
-const struct _IO_jump_t _IO_old_proc_jumps libio_vtable = {
- JUMP_INIT_DUMMY,
- JUMP_INIT(finish, _IO_old_file_finish),
- JUMP_INIT(overflow, _IO_old_file_overflow),
- JUMP_INIT(underflow, _IO_old_file_underflow),
- JUMP_INIT(uflow, _IO_default_uflow),
- JUMP_INIT(pbackfail, _IO_default_pbackfail),
- JUMP_INIT(xsputn, _IO_old_file_xsputn),
- JUMP_INIT(xsgetn, _IO_default_xsgetn),
- JUMP_INIT(seekoff, _IO_old_file_seekoff),
- JUMP_INIT(seekpos, _IO_default_seekpos),
- JUMP_INIT(setbuf, _IO_old_file_setbuf),
- JUMP_INIT(sync, _IO_old_file_sync),
- JUMP_INIT(doallocate, _IO_file_doallocate),
- JUMP_INIT(read, _IO_file_read),
- JUMP_INIT(write, _IO_old_file_write),
- JUMP_INIT(seek, _IO_file_seek),
- JUMP_INIT(close, _IO_old_proc_close),
- JUMP_INIT(stat, _IO_file_stat),
- JUMP_INIT(showmanyc, _IO_default_showmanyc),
- JUMP_INIT(imbue, _IO_default_imbue)
-};
-
strong_alias (_IO_old_popen, __old_popen)
compat_symbol (libc, _IO_old_popen, _IO_popen, GLIBC_2_0);
compat_symbol (libc, __old_popen, popen, GLIBC_2_0);
diff --git a/libio/stdio.c b/libio/stdio.c
index fd94b76..c7c1b85 100644
--- a/libio/stdio.c
+++ b/libio/stdio.c
@@ -33,3 +33,6 @@
FILE *stdin = (FILE *) &_IO_2_1_stdin_;
FILE *stdout = (FILE *) &_IO_2_1_stdout_;
FILE *stderr = (FILE *) &_IO_2_1_stderr_;
+
+libio_static_fn_required (_IO_file_open);
+libio_static_fn_required (_IO_file_doallocate);
diff --git a/libio/strfile.h b/libio/strfile.h
index c50b34a..f21100f 100644
--- a/libio/strfile.h
+++ b/libio/strfile.h
@@ -78,8 +78,6 @@ typedef struct
wchar_t overflow_buf[64];
} _IO_wstrnfile;
-extern const struct _IO_jump_t _IO_wstrn_jumps attribute_hidden;
-
/* Initialize an _IO_strfile SF to read from narrow string STRING, and
return the corresponding FILE object. It is not necessary to fclose
the FILE when it is no longer needed. */
diff --git a/libio/strops.c b/libio/strops.c
index b5c850b..6379a87 100644
--- a/libio/strops.c
+++ b/libio/strops.c
@@ -352,27 +352,3 @@ _IO_str_finish (FILE *fp, int dummy)
_IO_default_finish (fp, 0);
}
-
-const struct _IO_jump_t _IO_str_jumps libio_vtable =
-{
- JUMP_INIT_DUMMY,
- JUMP_INIT(finish, _IO_str_finish),
- JUMP_INIT(overflow, _IO_str_overflow),
- JUMP_INIT(underflow, _IO_str_underflow),
- JUMP_INIT(uflow, _IO_default_uflow),
- JUMP_INIT(pbackfail, _IO_str_pbackfail),
- JUMP_INIT(xsputn, _IO_default_xsputn),
- JUMP_INIT(xsgetn, _IO_default_xsgetn),
- JUMP_INIT(seekoff, _IO_str_seekoff),
- JUMP_INIT(seekpos, _IO_default_seekpos),
- JUMP_INIT(setbuf, _IO_default_setbuf),
- JUMP_INIT(sync, _IO_default_sync),
- JUMP_INIT(doallocate, _IO_default_doallocate),
- JUMP_INIT(read, _IO_default_read),
- JUMP_INIT(write, _IO_default_write),
- JUMP_INIT(seek, _IO_default_seek),
- JUMP_INIT(close, _IO_default_close),
- JUMP_INIT(stat, _IO_default_stat),
- JUMP_INIT(showmanyc, _IO_default_showmanyc),
- JUMP_INIT(imbue, _IO_default_imbue)
-};
diff --git a/libio/tst-vtables-interposed.c b/libio/tst-vtables-interposed.c
index 9068e53..e656f2b 100644
--- a/libio/tst-vtables-interposed.c
+++ b/libio/tst-vtables-interposed.c
@@ -21,7 +21,12 @@
/* Provide an interposed definition of the standard file handles with
our own vtable. stdout/stdin/stderr will not work as a result, but
a succesful test does not print anything, so this is fine. */
+#include "libioP.h"
+#undef _IO_file_jumps
#define _IO_file_jumps jumps
+#undef _IO_wfile_jumps
+extern const struct _IO_jump_t _IO_wfile_jumps;
+#define _IO_wfile_jumps _IO_wfile_jumps
#include "stdfiles.c"
static int
diff --git a/libio/vtables.c b/libio/vtables.c
index 5d5906a..3facd40 100644
--- a/libio/vtables.c
+++ b/libio/vtables.c
@@ -21,6 +21,472 @@
#include <stdio.h>
#include <ldsodefs.h>
#include <pointer_guard.h>
+#include <libio-macros.h>
+
+/* Both _IO_str_* and _IO_new_file functions are pulled into every link (from
+ stdio initialization). */
+#ifndef SHARED
+/* NB: the following directives do add pragma weak for _IO_default _* and
+ _IO_wdefault_* symbols to potentially avoid link failures, since they
+ are always used when the __io_vtables is used. */
+# pragma weak _IO_wstr_finish
+# pragma weak _IO_wstr_overflow
+# pragma weak _IO_wstr_pbackfail
+# pragma weak _IO_wstr_seekoff
+# pragma weak _IO_wstr_underflow
+
+# pragma weak _IO_file_close
+# pragma weak _IO_file_close_mmap
+# pragma weak _IO_file_doallocate
+# pragma weak _IO_file_finish
+# pragma weak _IO_file_jumps_alias
+# pragma weak _IO_file_overflow
+# pragma weak _IO_file_read
+# pragma weak _IO_file_seek
+# pragma weak _IO_file_seekoff_maybe_mmap
+# pragma weak _IO_file_seekoff_mmap
+# pragma weak _IO_file_setbuf
+# pragma weak _IO_file_setbuf_mmap
+# pragma weak _IO_file_setbuf_mmap
+# pragma weak _IO_file_stat
+# pragma weak _IO_file_sync
+# pragma weak _IO_file_sync_mmap
+# pragma weak _IO_file_underflow
+# pragma weak _IO_file_underflow_maybe_mmap
+# pragma weak _IO_file_underflow_mmap
+# pragma weak _IO_file_xsgetn
+# pragma weak _IO_file_xsgetn_maybe_mmap
+# pragma weak _IO_file_xsgetn_mmap
+# pragma weak _IO_file_xsputn
+
+# pragma weak _IO_wfile_overflow
+# pragma weak _IO_wfile_sync
+# pragma weak _IO_wfile_underflow
+# pragma weak _IO_wfile_underflow_maybe_mmap
+# pragma weak _IO_wfile_underflow_mmap
+# pragma weak _IO_wfile_doallocate
+# pragma weak _IO_wfile_jumps_alia
+# pragma weak _IO_wfile_seekoff
+# pragma weak _IO_wfile_xsputn
+
+# pragma weak _IO_new_proc_close
+
+# pragma weak _IO_cookie_close
+# pragma weak _IO_cookie_read
+# pragma weak _IO_cookie_seek
+# pragma weak _IO_cookie_seekoff
+# pragma weak _IO_cookie_write
+
+# pragma weak _IO_mem_finish
+# pragma weak _IO_mem_sync
+
+# pragma weak _IO_wmem_finish
+# pragma weak _IO_wmem_sync
+
+# pragma weak __printf_buffer_as_file_overflow
+# pragma weak __printf_buffer_as_file_xsputn
+
+# pragma weak __wprintf_buffer_as_file_overflow
+# pragma weak __wprintf_buffer_as_file_xsputn
+#endif
+
+const struct _IO_jump_t __io_vtables[IO_VTABLES_LEN] attribute_relro =
+{
+ /* _IO_str_jumps */
+ [IO_STR_JUMPS] =
+ {
+ JUMP_INIT_DUMMY,
+ JUMP_INIT (finish, _IO_str_finish),
+ JUMP_INIT (overflow, _IO_str_overflow),
+ JUMP_INIT (underflow, _IO_str_underflow),
+ JUMP_INIT (uflow, _IO_default_uflow),
+ JUMP_INIT (pbackfail, _IO_str_pbackfail),
+ JUMP_INIT (xsputn, _IO_default_xsputn),
+ JUMP_INIT (xsgetn, _IO_default_xsgetn),
+ JUMP_INIT (seekoff, _IO_str_seekoff),
+ JUMP_INIT (seekpos, _IO_default_seekpos),
+ JUMP_INIT (setbuf, _IO_default_setbuf),
+ JUMP_INIT (sync, _IO_default_sync),
+ JUMP_INIT (doallocate, _IO_default_doallocate),
+ JUMP_INIT (read, _IO_default_read),
+ JUMP_INIT (write, _IO_default_write),
+ JUMP_INIT (seek, _IO_default_seek),
+ JUMP_INIT (close, _IO_default_close),
+ JUMP_INIT (stat, _IO_default_stat),
+ JUMP_INIT (showmanyc, _IO_default_showmanyc),
+ JUMP_INIT (imbue, _IO_default_imbue)
+ },
+ /* _IO_wstr_jumps */
+ [IO_WSTR_JUMPS] = {
+ JUMP_INIT_DUMMY,
+ JUMP_INIT (finish, _IO_wstr_finish),
+ JUMP_INIT (overflow, (_IO_overflow_t) _IO_wstr_overflow),
+ JUMP_INIT (underflow, (_IO_underflow_t) _IO_wstr_underflow),
+ JUMP_INIT (uflow, (_IO_underflow_t) _IO_wdefault_uflow),
+ JUMP_INIT (pbackfail, (_IO_pbackfail_t) _IO_wstr_pbackfail),
+ JUMP_INIT (xsputn, _IO_wdefault_xsputn),
+ JUMP_INIT (xsgetn, _IO_wdefault_xsgetn),
+ JUMP_INIT (seekoff, _IO_wstr_seekoff),
+ JUMP_INIT (seekpos, _IO_default_seekpos),
+ JUMP_INIT (setbuf, _IO_default_setbuf),
+ JUMP_INIT (sync, _IO_default_sync),
+ JUMP_INIT (doallocate, _IO_wdefault_doallocate),
+ JUMP_INIT (read, _IO_default_read),
+ JUMP_INIT (write, _IO_default_write),
+ JUMP_INIT (seek, _IO_default_seek),
+ JUMP_INIT (close, _IO_default_close),
+ JUMP_INIT (stat, _IO_default_stat),
+ JUMP_INIT (showmanyc, _IO_default_showmanyc),
+ JUMP_INIT (imbue, _IO_default_imbue)
+ },
+ /* _IO_file_jumps */
+ [IO_FILE_JUMPS] = {
+ JUMP_INIT_DUMMY,
+ JUMP_INIT (finish, _IO_file_finish),
+ JUMP_INIT (overflow, _IO_file_overflow),
+ JUMP_INIT (underflow, _IO_file_underflow),
+ JUMP_INIT (uflow, _IO_default_uflow),
+ JUMP_INIT (pbackfail, _IO_default_pbackfail),
+ JUMP_INIT (xsputn, _IO_file_xsputn),
+ JUMP_INIT (xsgetn, _IO_file_xsgetn),
+ JUMP_INIT (seekoff, _IO_new_file_seekoff),
+ JUMP_INIT (seekpos, _IO_default_seekpos),
+ JUMP_INIT (setbuf, _IO_new_file_setbuf),
+ JUMP_INIT (sync, _IO_new_file_sync),
+ JUMP_INIT (doallocate, _IO_file_doallocate),
+ JUMP_INIT (read, _IO_file_read),
+ JUMP_INIT (write, _IO_new_file_write),
+ JUMP_INIT (seek, _IO_file_seek),
+ JUMP_INIT (close, _IO_file_close),
+ JUMP_INIT (stat, _IO_file_stat),
+ JUMP_INIT (showmanyc, _IO_default_showmanyc),
+ JUMP_INIT (imbue, _IO_default_imbue)
+ },
+ /* _IO_file_jumps_mmap */
+ [IO_FILE_JUMPS_MMAP] = {
+ JUMP_INIT_DUMMY,
+ JUMP_INIT (finish, _IO_file_finish),
+ JUMP_INIT (overflow, _IO_file_overflow),
+ JUMP_INIT (underflow, _IO_file_underflow_mmap),
+ JUMP_INIT (uflow, _IO_default_uflow),
+ JUMP_INIT (pbackfail, _IO_default_pbackfail),
+ JUMP_INIT (xsputn, _IO_new_file_xsputn),
+ JUMP_INIT (xsgetn, _IO_file_xsgetn_mmap),
+ JUMP_INIT (seekoff, _IO_file_seekoff_mmap),
+ JUMP_INIT (seekpos, _IO_default_seekpos),
+ JUMP_INIT (setbuf, (_IO_setbuf_t) _IO_file_setbuf_mmap),
+ JUMP_INIT (sync, _IO_file_sync_mmap),
+ JUMP_INIT (doallocate, _IO_file_doallocate),
+ JUMP_INIT (read, _IO_file_read),
+ JUMP_INIT (write, _IO_new_file_write),
+ JUMP_INIT (seek, _IO_file_seek),
+ JUMP_INIT (close, _IO_file_close_mmap),
+ JUMP_INIT (stat, _IO_file_stat),
+ JUMP_INIT (showmanyc, _IO_default_showmanyc),
+ JUMP_INIT (imbue, _IO_default_imbue)
+ },
+ /* _IO_file_jumps_maybe_mmap */
+ [IO_FILE_JUMPS_MAYBE_MMAP] = {
+ JUMP_INIT_DUMMY,
+ JUMP_INIT (finish, _IO_file_finish),
+ JUMP_INIT (overflow, _IO_file_overflow),
+ JUMP_INIT (underflow, _IO_file_underflow_maybe_mmap),
+ JUMP_INIT (uflow, _IO_default_uflow),
+ JUMP_INIT (pbackfail, _IO_default_pbackfail),
+ JUMP_INIT (xsputn, _IO_new_file_xsputn),
+ JUMP_INIT (xsgetn, _IO_file_xsgetn_maybe_mmap),
+ JUMP_INIT (seekoff, _IO_file_seekoff_maybe_mmap),
+ JUMP_INIT (seekpos, _IO_default_seekpos),
+ JUMP_INIT (setbuf, (_IO_setbuf_t) _IO_file_setbuf_mmap),
+ JUMP_INIT (sync, _IO_new_file_sync),
+ JUMP_INIT (doallocate, _IO_file_doallocate),
+ JUMP_INIT (read, _IO_file_read),
+ JUMP_INIT (write, _IO_new_file_write),
+ JUMP_INIT (seek, _IO_file_seek),
+ JUMP_INIT (close, _IO_file_close),
+ JUMP_INIT (stat, _IO_file_stat),
+ JUMP_INIT (showmanyc, _IO_default_showmanyc),
+ JUMP_INIT (imbue, _IO_default_imbue)
+ },
+ /* _IO_wfile_jumps */
+ [IO_WFILE_JUMPS] = {
+ JUMP_INIT_DUMMY,
+ JUMP_INIT (finish, _IO_new_file_finish),
+ JUMP_INIT (overflow, (_IO_overflow_t) _IO_wfile_overflow),
+ JUMP_INIT (underflow, (_IO_underflow_t) _IO_wfile_underflow),
+ JUMP_INIT (uflow, (_IO_underflow_t) _IO_wdefault_uflow),
+ JUMP_INIT (pbackfail, (_IO_pbackfail_t) _IO_wdefault_pbackfail),
+ JUMP_INIT (xsputn, _IO_wfile_xsputn),
+ JUMP_INIT (xsgetn, _IO_file_xsgetn),
+ JUMP_INIT (seekoff, _IO_wfile_seekoff),
+ JUMP_INIT (seekpos, _IO_default_seekpos),
+ JUMP_INIT (setbuf, _IO_new_file_setbuf),
+ JUMP_INIT (sync, (_IO_sync_t) _IO_wfile_sync),
+ JUMP_INIT (doallocate, _IO_wfile_doallocate),
+ JUMP_INIT (read, _IO_file_read),
+ JUMP_INIT (write, _IO_new_file_write),
+ JUMP_INIT (seek, _IO_file_seek),
+ JUMP_INIT (close, _IO_file_close),
+ JUMP_INIT (stat, _IO_file_stat),
+ JUMP_INIT (showmanyc, _IO_default_showmanyc),
+ JUMP_INIT (imbue, _IO_default_imbue)
+ },
+ /* _IO_wfile_jumps_mmap */
+ [IO_WFILE_JUMPS_MMAP] = {
+ JUMP_INIT_DUMMY,
+ JUMP_INIT (finish, _IO_new_file_finish),
+ JUMP_INIT (overflow, (_IO_overflow_t) _IO_wfile_overflow),
+ JUMP_INIT (underflow, (_IO_underflow_t) _IO_wfile_underflow_mmap),
+ JUMP_INIT (uflow, (_IO_underflow_t) _IO_wdefault_uflow),
+ JUMP_INIT (pbackfail, (_IO_pbackfail_t) _IO_wdefault_pbackfail),
+ JUMP_INIT (xsputn, _IO_wfile_xsputn),
+ JUMP_INIT (xsgetn, _IO_file_xsgetn),
+ JUMP_INIT (seekoff, _IO_wfile_seekoff),
+ JUMP_INIT (seekpos, _IO_default_seekpos),
+ JUMP_INIT (setbuf, _IO_file_setbuf_mmap),
+ JUMP_INIT (sync, (_IO_sync_t) _IO_wfile_sync),
+ JUMP_INIT (doallocate, _IO_wfile_doallocate),
+ JUMP_INIT (read, _IO_file_read),
+ JUMP_INIT (write, _IO_new_file_write),
+ JUMP_INIT (seek, _IO_file_seek),
+ JUMP_INIT (close, _IO_file_close_mmap),
+ JUMP_INIT (stat, _IO_file_stat),
+ JUMP_INIT (showmanyc, _IO_default_showmanyc),
+ JUMP_INIT (imbue, _IO_default_imbue)
+ },
+ /* _IO_wfile_jumps_maybe_mmap */
+ [IO_WFILE_JUMPS_MAYBE_MMAP] = {
+ JUMP_INIT_DUMMY,
+ JUMP_INIT (finish, _IO_new_file_finish),
+ JUMP_INIT (overflow, (_IO_overflow_t) _IO_wfile_overflow),
+ JUMP_INIT (underflow, (_IO_underflow_t) _IO_wfile_underflow_maybe_mmap),
+ JUMP_INIT (uflow, (_IO_underflow_t) _IO_wdefault_uflow),
+ JUMP_INIT (pbackfail, (_IO_pbackfail_t) _IO_wdefault_pbackfail),
+ JUMP_INIT (xsputn, _IO_wfile_xsputn),
+ JUMP_INIT (xsgetn, _IO_file_xsgetn),
+ JUMP_INIT (seekoff, _IO_wfile_seekoff),
+ JUMP_INIT (seekpos, _IO_default_seekpos),
+ JUMP_INIT (setbuf, _IO_file_setbuf_mmap),
+ JUMP_INIT (sync, (_IO_sync_t) _IO_wfile_sync),
+ JUMP_INIT (doallocate, _IO_wfile_doallocate),
+ JUMP_INIT (read, _IO_file_read),
+ JUMP_INIT (write, _IO_new_file_write),
+ JUMP_INIT (seek, _IO_file_seek),
+ JUMP_INIT (close, _IO_file_close),
+ JUMP_INIT (stat, _IO_file_stat),
+ JUMP_INIT (showmanyc, _IO_default_showmanyc),
+ JUMP_INIT (imbue, _IO_default_imbue)
+ },
+ /* _IO_cookie_jumps */
+ [IO_COOKIE_JUMPS] = {
+ JUMP_INIT_DUMMY,
+ JUMP_INIT (finish, _IO_file_finish),
+ JUMP_INIT (overflow, _IO_file_overflow),
+ JUMP_INIT (underflow, _IO_file_underflow),
+ JUMP_INIT (uflow, _IO_default_uflow),
+ JUMP_INIT (pbackfail, _IO_default_pbackfail),
+ JUMP_INIT (xsputn, _IO_file_xsputn),
+ JUMP_INIT (xsgetn, _IO_default_xsgetn),
+ JUMP_INIT (seekoff, _IO_cookie_seekoff),
+ JUMP_INIT (seekpos, _IO_default_seekpos),
+ JUMP_INIT (setbuf, _IO_file_setbuf),
+ JUMP_INIT (sync, _IO_file_sync),
+ JUMP_INIT (doallocate, _IO_file_doallocate),
+ JUMP_INIT (read, _IO_cookie_read),
+ JUMP_INIT (write, _IO_cookie_write),
+ JUMP_INIT (seek, _IO_cookie_seek),
+ JUMP_INIT (close, _IO_cookie_close),
+ JUMP_INIT (stat, _IO_default_stat),
+ JUMP_INIT (showmanyc, _IO_default_showmanyc),
+ JUMP_INIT (imbue, _IO_default_imbue),
+ },
+ /* _IO_proc_jumps */
+ [IO_PROC_JUMPS] = {
+ JUMP_INIT_DUMMY,
+ JUMP_INIT (finish, _IO_new_file_finish),
+ JUMP_INIT (overflow, _IO_new_file_overflow),
+ JUMP_INIT (underflow, _IO_new_file_underflow),
+ JUMP_INIT (uflow, _IO_default_uflow),
+ JUMP_INIT (pbackfail, _IO_default_pbackfail),
+ JUMP_INIT (xsputn, _IO_new_file_xsputn),
+ JUMP_INIT (xsgetn, _IO_default_xsgetn),
+ JUMP_INIT (seekoff, _IO_new_file_seekoff),
+ JUMP_INIT (seekpos, _IO_default_seekpos),
+ JUMP_INIT (setbuf, _IO_new_file_setbuf),
+ JUMP_INIT (sync, _IO_new_file_sync),
+ JUMP_INIT (doallocate, _IO_file_doallocate),
+ JUMP_INIT (read, _IO_file_read),
+ JUMP_INIT (write, _IO_new_file_write),
+ JUMP_INIT (seek, _IO_file_seek),
+ JUMP_INIT (close, _IO_new_proc_close),
+ JUMP_INIT (stat, _IO_file_stat),
+ JUMP_INIT (showmanyc, _IO_default_showmanyc),
+ JUMP_INIT (imbue, _IO_default_imbue)
+ },
+ /* _IO_mem_jumps */
+ [IO_MEM_JUMPS] = {
+ JUMP_INIT_DUMMY,
+ JUMP_INIT (finish, _IO_mem_finish),
+ JUMP_INIT (overflow, _IO_str_overflow),
+ JUMP_INIT (underflow, _IO_str_underflow),
+ JUMP_INIT (uflow, _IO_default_uflow),
+ JUMP_INIT (pbackfail, _IO_str_pbackfail),
+ JUMP_INIT (xsputn, _IO_default_xsputn),
+ JUMP_INIT (xsgetn, _IO_default_xsgetn),
+ JUMP_INIT (seekoff, _IO_str_seekoff),
+ JUMP_INIT (seekpos, _IO_default_seekpos),
+ JUMP_INIT (setbuf, _IO_default_setbuf),
+ JUMP_INIT (sync, _IO_mem_sync),
+ JUMP_INIT (doallocate, _IO_default_doallocate),
+ JUMP_INIT (read, _IO_default_read),
+ JUMP_INIT (write, _IO_default_write),
+ JUMP_INIT (seek, _IO_default_seek),
+ JUMP_INIT (close, _IO_default_close),
+ JUMP_INIT (stat, _IO_default_stat),
+ JUMP_INIT (showmanyc, _IO_default_showmanyc),
+ JUMP_INIT (imbue, _IO_default_imbue)
+ },
+ /* _IO_wmem_jumps */
+ [IO_WMEM_JUMPS] = {
+ JUMP_INIT_DUMMY,
+ JUMP_INIT (finish, _IO_wmem_finish),
+ JUMP_INIT (overflow, (_IO_overflow_t) _IO_wstr_overflow),
+ JUMP_INIT (underflow, (_IO_underflow_t) _IO_wstr_underflow),
+ JUMP_INIT (uflow, (_IO_underflow_t) _IO_wdefault_uflow),
+ JUMP_INIT (pbackfail, (_IO_pbackfail_t) _IO_wstr_pbackfail),
+ JUMP_INIT (xsputn, _IO_wdefault_xsputn),
+ JUMP_INIT (xsgetn, _IO_wdefault_xsgetn),
+ JUMP_INIT (seekoff, _IO_wstr_seekoff),
+ JUMP_INIT (seekpos, _IO_default_seekpos),
+ JUMP_INIT (setbuf, _IO_default_setbuf),
+ JUMP_INIT (sync, _IO_wmem_sync),
+ JUMP_INIT (doallocate, _IO_wdefault_doallocate),
+ JUMP_INIT (read, _IO_default_read),
+ JUMP_INIT (write, _IO_default_write),
+ JUMP_INIT (seek, _IO_default_seek),
+ JUMP_INIT (close, _IO_default_close),
+ JUMP_INIT (stat, _IO_default_stat),
+ JUMP_INIT (showmanyc, _IO_default_showmanyc),
+ JUMP_INIT (imbue, _IO_default_imbue)
+ },
+ [IO_PRINTF_BUFFER_AS_FILE_JUMPS] = {
+ JUMP_INIT_DUMMY,
+ JUMP_INIT (finish, NULL),
+ JUMP_INIT (overflow, __printf_buffer_as_file_overflow),
+ JUMP_INIT (underflow, NULL),
+ JUMP_INIT (uflow, NULL),
+ JUMP_INIT (pbackfail, NULL),
+ JUMP_INIT (xsputn, __printf_buffer_as_file_xsputn),
+ JUMP_INIT (xsgetn, NULL),
+ JUMP_INIT (seekoff, NULL),
+ JUMP_INIT (seekpos, NULL),
+ JUMP_INIT (setbuf, NULL),
+ JUMP_INIT (sync, NULL),
+ JUMP_INIT (doallocate, NULL),
+ JUMP_INIT (read, NULL),
+ JUMP_INIT (write, NULL),
+ JUMP_INIT (seek, NULL),
+ JUMP_INIT (close, NULL),
+ JUMP_INIT (stat, NULL),
+ JUMP_INIT (showmanyc, NULL),
+ JUMP_INIT (imbue, NULL)
+ },
+ [IO_WPRINTF_BUFFER_AS_FILE_JUMPS] = {
+ JUMP_INIT_DUMMY,
+ JUMP_INIT (finish, NULL),
+ JUMP_INIT (overflow, (_IO_overflow_t) __wprintf_buffer_as_file_overflow),
+ JUMP_INIT (underflow, NULL),
+ JUMP_INIT (uflow, NULL),
+ JUMP_INIT (pbackfail, NULL),
+ JUMP_INIT (xsputn, __wprintf_buffer_as_file_xsputn),
+ JUMP_INIT (xsgetn, NULL),
+ JUMP_INIT (seekoff, NULL),
+ JUMP_INIT (seekpos, NULL),
+ JUMP_INIT (setbuf, NULL),
+ JUMP_INIT (sync, NULL),
+ JUMP_INIT (doallocate, NULL),
+ JUMP_INIT (read, NULL),
+ JUMP_INIT (write, NULL),
+ JUMP_INIT (seek, NULL),
+ JUMP_INIT (close, NULL),
+ JUMP_INIT (stat, NULL),
+ JUMP_INIT (showmanyc, NULL),
+ JUMP_INIT (imbue, NULL)
+ },
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
+ /* _IO_old_file_jumps */
+ [IO_OLD_FILE_JUMPS] = {
+ JUMP_INIT_DUMMY,
+ JUMP_INIT (finish, _IO_old_file_finish),
+ JUMP_INIT (overflow, _IO_old_file_overflow),
+ JUMP_INIT (underflow, _IO_old_file_underflow),
+ JUMP_INIT (uflow, _IO_default_uflow),
+ JUMP_INIT (pbackfail, _IO_default_pbackfail),
+ JUMP_INIT (xsputn, _IO_old_file_xsputn),
+ JUMP_INIT (xsgetn, _IO_default_xsgetn),
+ JUMP_INIT (seekoff, _IO_old_file_seekoff),
+ JUMP_INIT (seekpos, _IO_default_seekpos),
+ JUMP_INIT (setbuf, _IO_old_file_setbuf),
+ JUMP_INIT (sync, _IO_old_file_sync),
+ JUMP_INIT (doallocate, _IO_file_doallocate),
+ JUMP_INIT (read, _IO_file_read),
+ JUMP_INIT (write, _IO_old_file_write),
+ JUMP_INIT (seek, _IO_file_seek),
+ JUMP_INIT (close, _IO_file_close),
+ JUMP_INIT (stat, _IO_file_stat)
+ },
+ /* _IO_old_proc_jumps */
+ [IO_OLD_PROC_JUMPS] = {
+ JUMP_INIT_DUMMY,
+ JUMP_INIT (finish, _IO_old_file_finish),
+ JUMP_INIT (overflow, _IO_old_file_overflow),
+ JUMP_INIT (underflow, _IO_old_file_underflow),
+ JUMP_INIT (uflow, _IO_default_uflow),
+ JUMP_INIT (pbackfail, _IO_default_pbackfail),
+ JUMP_INIT (xsputn, _IO_old_file_xsputn),
+ JUMP_INIT (xsgetn, _IO_default_xsgetn),
+ JUMP_INIT (seekoff, _IO_old_file_seekoff),
+ JUMP_INIT (seekpos, _IO_default_seekpos),
+ JUMP_INIT (setbuf, _IO_old_file_setbuf),
+ JUMP_INIT (sync, _IO_old_file_sync),
+ JUMP_INIT (doallocate, _IO_file_doallocate),
+ JUMP_INIT (read, _IO_file_read),
+ JUMP_INIT (write, _IO_old_file_write),
+ JUMP_INIT (seek, _IO_file_seek),
+ JUMP_INIT (close, _IO_old_proc_close),
+ JUMP_INIT (stat, _IO_file_stat),
+ JUMP_INIT (showmanyc, _IO_default_showmanyc),
+ JUMP_INIT (imbue, _IO_default_imbue)
+ },
+#endif
+
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
+ /* _IO_old_cookie_jumps */
+ [IO_OLD_COOKIED_JUMPS] = {
+ JUMP_INIT_DUMMY,
+ JUMP_INIT (finish, _IO_file_finish),
+ JUMP_INIT (overflow, _IO_file_overflow),
+ JUMP_INIT (underflow, _IO_file_underflow),
+ JUMP_INIT (uflow, _IO_default_uflow),
+ JUMP_INIT (pbackfail, _IO_default_pbackfail),
+ JUMP_INIT (xsputn, _IO_file_xsputn),
+ JUMP_INIT (xsgetn, _IO_default_xsgetn),
+ JUMP_INIT (seekoff, _IO_cookie_seekoff),
+ JUMP_INIT (seekpos, _IO_default_seekpos),
+ JUMP_INIT (setbuf, _IO_file_setbuf),
+ JUMP_INIT (sync, _IO_file_sync),
+ JUMP_INIT (doallocate, _IO_file_doallocate),
+ JUMP_INIT (read, _IO_cookie_read),
+ JUMP_INIT (write, _IO_cookie_write),
+ JUMP_INIT (seek, _IO_old_cookie_seek),
+ JUMP_INIT (close, _IO_cookie_close),
+ JUMP_INIT (stat, _IO_default_stat),
+ JUMP_INIT (showmanyc, _IO_default_showmanyc),
+ JUMP_INIT (imbue, _IO_default_imbue),
+ },
+#endif
+};
#ifdef SHARED
@@ -82,3 +548,15 @@ check_stdfiles_vtables (void)
IO_set_accept_foreign_vtables (&_IO_vtable_check);
}
#endif
+
+#define STR(s) XSTR(s)
+#define XSTR(s) #s
+
+#undef _IO_file_jumps
+#define _IO_file_jumps_alias "__io_vtables + " STR(IO_FILE_JUMPS_OFFSET)
+declare_object_symbol_alias (_IO_file_jumps, _IO_file_jumps_alias,
+ IO_JUMP_T_SIZE)
+#undef _IO_wfile_jumps
+#define _IO_wfile_jumps_alias "__io_vtables + " STR(IO_WFILE_JUMPS_OFFSET)
+declare_object_symbol_alias (_IO_wfile_jumps, _IO_wfile_jumps_alias,
+ IO_JUMP_T_SIZE)
diff --git a/libio/wfileops.c b/libio/wfileops.c
index cecea21..f16f6db 100644
--- a/libio/wfileops.c
+++ b/libio/wfileops.c
@@ -328,7 +328,7 @@ _IO_wfile_underflow (FILE *fp)
libc_hidden_def (_IO_wfile_underflow)
-static wint_t
+wint_t
_IO_wfile_underflow_mmap (FILE *fp)
{
struct _IO_codecvt *cd;
@@ -389,7 +389,7 @@ _IO_wfile_underflow_mmap (FILE *fp)
return WEOF;
}
-static wint_t
+wint_t
_IO_wfile_underflow_maybe_mmap (FILE *fp)
{
/* This is the first read attempt. Doing the underflow will choose mmap
@@ -1017,78 +1017,3 @@ _IO_wfile_xsputn (FILE *f, const void *data, size_t n)
return n - to_do;
}
libc_hidden_def (_IO_wfile_xsputn)
-
-
-const struct _IO_jump_t _IO_wfile_jumps libio_vtable =
-{
- JUMP_INIT_DUMMY,
- JUMP_INIT(finish, _IO_new_file_finish),
- JUMP_INIT(overflow, (_IO_overflow_t) _IO_wfile_overflow),
- JUMP_INIT(underflow, (_IO_underflow_t) _IO_wfile_underflow),
- JUMP_INIT(uflow, (_IO_underflow_t) _IO_wdefault_uflow),
- JUMP_INIT(pbackfail, (_IO_pbackfail_t) _IO_wdefault_pbackfail),
- JUMP_INIT(xsputn, _IO_wfile_xsputn),
- JUMP_INIT(xsgetn, _IO_file_xsgetn),
- JUMP_INIT(seekoff, _IO_wfile_seekoff),
- JUMP_INIT(seekpos, _IO_default_seekpos),
- JUMP_INIT(setbuf, _IO_new_file_setbuf),
- JUMP_INIT(sync, (_IO_sync_t) _IO_wfile_sync),
- JUMP_INIT(doallocate, _IO_wfile_doallocate),
- JUMP_INIT(read, _IO_file_read),
- JUMP_INIT(write, _IO_new_file_write),
- JUMP_INIT(seek, _IO_file_seek),
- JUMP_INIT(close, _IO_file_close),
- JUMP_INIT(stat, _IO_file_stat),
- JUMP_INIT(showmanyc, _IO_default_showmanyc),
- JUMP_INIT(imbue, _IO_default_imbue)
-};
-libc_hidden_data_def (_IO_wfile_jumps)
-
-
-const struct _IO_jump_t _IO_wfile_jumps_mmap libio_vtable =
-{
- JUMP_INIT_DUMMY,
- JUMP_INIT(finish, _IO_new_file_finish),
- JUMP_INIT(overflow, (_IO_overflow_t) _IO_wfile_overflow),
- JUMP_INIT(underflow, (_IO_underflow_t) _IO_wfile_underflow_mmap),
- JUMP_INIT(uflow, (_IO_underflow_t) _IO_wdefault_uflow),
- JUMP_INIT(pbackfail, (_IO_pbackfail_t) _IO_wdefault_pbackfail),
- JUMP_INIT(xsputn, _IO_wfile_xsputn),
- JUMP_INIT(xsgetn, _IO_file_xsgetn),
- JUMP_INIT(seekoff, _IO_wfile_seekoff),
- JUMP_INIT(seekpos, _IO_default_seekpos),
- JUMP_INIT(setbuf, _IO_file_setbuf_mmap),
- JUMP_INIT(sync, (_IO_sync_t) _IO_wfile_sync),
- JUMP_INIT(doallocate, _IO_wfile_doallocate),
- JUMP_INIT(read, _IO_file_read),
- JUMP_INIT(write, _IO_new_file_write),
- JUMP_INIT(seek, _IO_file_seek),
- JUMP_INIT(close, _IO_file_close_mmap),
- JUMP_INIT(stat, _IO_file_stat),
- JUMP_INIT(showmanyc, _IO_default_showmanyc),
- JUMP_INIT(imbue, _IO_default_imbue)
-};
-
-const struct _IO_jump_t _IO_wfile_jumps_maybe_mmap libio_vtable =
-{
- JUMP_INIT_DUMMY,
- JUMP_INIT(finish, _IO_new_file_finish),
- JUMP_INIT(overflow, (_IO_overflow_t) _IO_wfile_overflow),
- JUMP_INIT(underflow, (_IO_underflow_t) _IO_wfile_underflow_maybe_mmap),
- JUMP_INIT(uflow, (_IO_underflow_t) _IO_wdefault_uflow),
- JUMP_INIT(pbackfail, (_IO_pbackfail_t) _IO_wdefault_pbackfail),
- JUMP_INIT(xsputn, _IO_wfile_xsputn),
- JUMP_INIT(xsgetn, _IO_file_xsgetn),
- JUMP_INIT(seekoff, _IO_wfile_seekoff),
- JUMP_INIT(seekpos, _IO_default_seekpos),
- JUMP_INIT(setbuf, _IO_file_setbuf_mmap),
- JUMP_INIT(sync, (_IO_sync_t) _IO_wfile_sync),
- JUMP_INIT(doallocate, _IO_wfile_doallocate),
- JUMP_INIT(read, _IO_file_read),
- JUMP_INIT(write, _IO_new_file_write),
- JUMP_INIT(seek, _IO_file_seek),
- JUMP_INIT(close, _IO_file_close),
- JUMP_INIT(stat, _IO_file_stat),
- JUMP_INIT(showmanyc, _IO_default_showmanyc),
- JUMP_INIT(imbue, _IO_default_imbue)
-};
diff --git a/libio/wmemstream.c b/libio/wmemstream.c
index 6560d70..7b04b15 100644
--- a/libio/wmemstream.c
+++ b/libio/wmemstream.c
@@ -30,34 +30,6 @@ struct _IO_FILE_wmemstream
};
-static int _IO_wmem_sync (FILE* fp) __THROW;
-static void _IO_wmem_finish (FILE* fp, int) __THROW;
-
-
-static const struct _IO_jump_t _IO_wmem_jumps libio_vtable =
-{
- JUMP_INIT_DUMMY,
- JUMP_INIT (finish, _IO_wmem_finish),
- JUMP_INIT (overflow, (_IO_overflow_t) _IO_wstr_overflow),
- JUMP_INIT (underflow, (_IO_underflow_t) _IO_wstr_underflow),
- JUMP_INIT (uflow, (_IO_underflow_t) _IO_wdefault_uflow),
- JUMP_INIT (pbackfail, (_IO_pbackfail_t) _IO_wstr_pbackfail),
- JUMP_INIT (xsputn, _IO_wdefault_xsputn),
- JUMP_INIT (xsgetn, _IO_wdefault_xsgetn),
- JUMP_INIT (seekoff, _IO_wstr_seekoff),
- JUMP_INIT (seekpos, _IO_default_seekpos),
- JUMP_INIT (setbuf, _IO_default_setbuf),
- JUMP_INIT (sync, _IO_wmem_sync),
- JUMP_INIT (doallocate, _IO_wdefault_doallocate),
- JUMP_INIT (read, _IO_default_read),
- JUMP_INIT (write, _IO_default_write),
- JUMP_INIT (seek, _IO_default_seek),
- JUMP_INIT (close, _IO_default_close),
- JUMP_INIT (stat, _IO_default_stat),
- JUMP_INIT (showmanyc, _IO_default_showmanyc),
- JUMP_INIT (imbue, _IO_default_imbue)
-};
-
/* Open a stream that writes into a malloc'd buffer that is expanded as
necessary. *BUFLOC and *SIZELOC are updated with the buffer's location
and the number of characters written on fflush or fclose. */
@@ -105,7 +77,7 @@ open_wmemstream (wchar_t **bufloc, size_t *sizeloc)
}
-static int
+int
_IO_wmem_sync (FILE *fp)
{
struct _IO_FILE_wmemstream *mp = (struct _IO_FILE_wmemstream *) fp;
@@ -124,7 +96,7 @@ _IO_wmem_sync (FILE *fp)
}
-static void
+void
_IO_wmem_finish (FILE *fp, int dummy)
{
struct _IO_FILE_wmemstream *mp = (struct _IO_FILE_wmemstream *) fp;
diff --git a/libio/wstrops.c b/libio/wstrops.c
index 9c9d303..632fc12 100644
--- a/libio/wstrops.c
+++ b/libio/wstrops.c
@@ -361,27 +361,3 @@ _IO_wstr_finish (FILE *fp, int dummy)
_IO_wdefault_finish (fp, 0);
}
-
-const struct _IO_jump_t _IO_wstr_jumps libio_vtable =
-{
- JUMP_INIT_DUMMY,
- JUMP_INIT(finish, _IO_wstr_finish),
- JUMP_INIT(overflow, (_IO_overflow_t) _IO_wstr_overflow),
- JUMP_INIT(underflow, (_IO_underflow_t) _IO_wstr_underflow),
- JUMP_INIT(uflow, (_IO_underflow_t) _IO_wdefault_uflow),
- JUMP_INIT(pbackfail, (_IO_pbackfail_t) _IO_wstr_pbackfail),
- JUMP_INIT(xsputn, _IO_wdefault_xsputn),
- JUMP_INIT(xsgetn, _IO_wdefault_xsgetn),
- JUMP_INIT(seekoff, _IO_wstr_seekoff),
- JUMP_INIT(seekpos, _IO_default_seekpos),
- JUMP_INIT(setbuf, _IO_default_setbuf),
- JUMP_INIT(sync, _IO_default_sync),
- JUMP_INIT(doallocate, _IO_wdefault_doallocate),
- JUMP_INIT(read, _IO_default_read),
- JUMP_INIT(write, _IO_default_write),
- JUMP_INIT(seek, _IO_default_seek),
- JUMP_INIT(close, _IO_default_close),
- JUMP_INIT(stat, _IO_default_stat),
- JUMP_INIT(showmanyc, _IO_default_showmanyc),
- JUMP_INIT(imbue, _IO_default_imbue)
-};
diff --git a/stdio-common/printf_buffer_as_file.c b/stdio-common/printf_buffer_as_file.c
index 12b0e13..fe23797 100644
--- a/stdio-common/printf_buffer_as_file.c
+++ b/stdio-common/printf_buffer_as_file.c
@@ -48,7 +48,7 @@ __printf_buffer_as_file_switch_to_buffer (struct __printf_buffer_as_file *file)
/* Only a small subset of the vtable functions is implemented here,
following _IO_obstack_jumps. */
-static int
+int
__printf_buffer_as_file_overflow (FILE *fp, int ch)
{
struct __printf_buffer_as_file *file = (struct __printf_buffer_as_file *) fp;
@@ -72,7 +72,7 @@ __printf_buffer_as_file_overflow (FILE *fp, int ch)
return EOF;
}
-static size_t
+size_t
__printf_buffer_as_file_xsputn (FILE *fp, const void *buf, size_t len)
{
struct __printf_buffer_as_file *file = (struct __printf_buffer_as_file *) fp;
@@ -93,30 +93,6 @@ __printf_buffer_as_file_xsputn (FILE *fp, const void *buf, size_t len)
return 0;
}
-static const struct _IO_jump_t _IO_printf_buffer_as_file_jumps libio_vtable =
-{
- JUMP_INIT_DUMMY,
- JUMP_INIT(finish, NULL),
- JUMP_INIT(overflow, __printf_buffer_as_file_overflow),
- JUMP_INIT(underflow, NULL),
- JUMP_INIT(uflow, NULL),
- JUMP_INIT(pbackfail, NULL),
- JUMP_INIT(xsputn, __printf_buffer_as_file_xsputn),
- JUMP_INIT(xsgetn, NULL),
- JUMP_INIT(seekoff, NULL),
- JUMP_INIT(seekpos, NULL),
- JUMP_INIT(setbuf, NULL),
- JUMP_INIT(sync, NULL),
- JUMP_INIT(doallocate, NULL),
- JUMP_INIT(read, NULL),
- JUMP_INIT(write, NULL),
- JUMP_INIT(seek, NULL),
- JUMP_INIT(close, NULL),
- JUMP_INIT(stat, NULL),
- JUMP_INIT(showmanyc, NULL),
- JUMP_INIT(imbue, NULL)
-};
-
void
__printf_buffer_as_file_init (struct __printf_buffer_as_file *file,
struct __printf_buffer *next)
diff --git a/stdio-common/wprintf_buffer_as_file.c b/stdio-common/wprintf_buffer_as_file.c
index b2e5b5a..dbdb8cc 100644
--- a/stdio-common/wprintf_buffer_as_file.c
+++ b/stdio-common/wprintf_buffer_as_file.c
@@ -48,7 +48,7 @@ __wprintf_buffer_as_file_switch_to_buffer (struct __wprintf_buffer_as_file *file
/* Only a small subset of the vtable functions is implemented here,
following _IO_obstack_jumps. */
-static wint_t
+wint_t
__wprintf_buffer_as_file_overflow (FILE *fp, int ch)
{
struct __wprintf_buffer_as_file *file
@@ -75,7 +75,7 @@ __wprintf_buffer_as_file_overflow (FILE *fp, int ch)
return WEOF;
}
-static size_t
+size_t
__wprintf_buffer_as_file_xsputn (FILE *fp, const void *buf, size_t len)
{
struct __wprintf_buffer_as_file *file
@@ -97,30 +97,6 @@ __wprintf_buffer_as_file_xsputn (FILE *fp, const void *buf, size_t len)
return 0;
}
-static const struct _IO_jump_t _IO_wprintf_buffer_as_file_jumps libio_vtable =
-{
- JUMP_INIT_DUMMY,
- JUMP_INIT(finish, NULL),
- JUMP_INIT(overflow, (_IO_overflow_t) __wprintf_buffer_as_file_overflow),
- JUMP_INIT(underflow, NULL),
- JUMP_INIT(uflow, NULL),
- JUMP_INIT(pbackfail, NULL),
- JUMP_INIT(xsputn, __wprintf_buffer_as_file_xsputn),
- JUMP_INIT(xsgetn, NULL),
- JUMP_INIT(seekoff, NULL),
- JUMP_INIT(seekpos, NULL),
- JUMP_INIT(setbuf, NULL),
- JUMP_INIT(sync, NULL),
- JUMP_INIT(doallocate, NULL),
- JUMP_INIT(read, NULL),
- JUMP_INIT(write, NULL),
- JUMP_INIT(seek, NULL),
- JUMP_INIT(close, NULL),
- JUMP_INIT(stat, NULL),
- JUMP_INIT(showmanyc, NULL),
- JUMP_INIT(imbue, NULL)
-};
-
void
__wprintf_buffer_as_file_init (struct __wprintf_buffer_as_file *file,
struct __wprintf_buffer *next)