about summary refs log tree commit diff
path: root/libio/tst-vtables-interposed.c
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 /libio/tst-vtables-interposed.c
parentf65ca70deaf38db4ca12458e74cefd8ad9063956 (diff)
downloadglibc-3020f72618e4f1d7338cd42b8bc7b2813e961b5a.tar.gz
glibc-3020f72618e4f1d7338cd42b8bc7b2813e961b5a.tar.xz
glibc-3020f72618e4f1d7338cd42b8bc7b2813e961b5a.zip
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/tst-vtables-interposed.c')
-rw-r--r--libio/tst-vtables-interposed.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libio/tst-vtables-interposed.c b/libio/tst-vtables-interposed.c
index 9068e53b88..e656f2b203 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