@@ -18,10 +18,11 @@
#include <dlfcn.h>
#include <libioP.h>
#include <stdio.h>
#include <ldsodefs.h>
+#include <array_length.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). */
@@ -86,11 +87,11 @@
# 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 =
+const struct _IO_jump_t __io_vtables[] attribute_relro =
{
/* _IO_str_jumps */
[IO_STR_JUMPS] =
{
JUMP_INIT_DUMMY,
@@ -483,10 +484,12 @@ const struct _IO_jump_t __io_vtables[IO_VTABLES_LEN] attribute_relro =
JUMP_INIT (showmanyc, _IO_default_showmanyc),
JUMP_INIT (imbue, _IO_default_imbue),
},
#endif
};
+_Static_assert (array_length (__io_vtables) == IO_VTABLES_NUM,
+ "initializer count");
#ifdef SHARED
void (*IO_accept_foreign_vtables) (void) attribute_hidden;
IO_VTABLES_LEN is the size of the struct array in bytes, not the number of __IO_jump_t's in the array. Drops just under 384kb from .rodata on LP64 machines. Fixes: 3020f72618e ("libio: Remove the usage of __libc_IO_vtables") Signed-off-by: Adam Jackson <ajax@redhat.com> --- libio/vtables.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)