mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
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>
This commit is contained in:
committed by
Adhemerval Zanella
parent
f65ca70dea
commit
3020f72618
@ -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)
|
||||
|
Reference in New Issue
Block a user