diff options
author | Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> | 2022-12-27 18:11:43 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2023-03-27 13:57:55 -0300 |
commit | 3020f72618e4f1d7338cd42b8bc7b2813e961b5a (patch) | |
tree | d61cc39cb5aa140de5331cd1a2ba6ab796db0c81 /libio/wmemstream.c | |
parent | f65ca70deaf38db4ca12458e74cefd8ad9063956 (diff) | |
download | glibc-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>
Diffstat (limited to 'libio/wmemstream.c')
-rw-r--r-- | libio/wmemstream.c | 32 |
1 files changed, 2 insertions, 30 deletions
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; |