]> sourceware.org Git - glibc.git/commitdiff
libio: Fix oversized __io_vtables
authorAdam Jackson <ajax@redhat.com>
Fri, 8 Sep 2023 19:55:19 +0000 (15:55 -0400)
committerFlorian Weimer <fweimer@redhat.com>
Fri, 8 Sep 2023 21:00:04 +0000 (23:00 +0200)
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>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Tested-by: Florian Weimer <fweimer@redhat.com>
libio/vtables.c

index 1d8ad612e94ecf81c6320779f5d9bc44cf7cc9ea..34f7e15f1c25d6007b59019d184c25751bc4ae3b 100644 (file)
@@ -20,6 +20,7 @@
 #include <libioP.h>
 #include <stdio.h>
 #include <ldsodefs.h>
+#include <array_length.h>
 #include <pointer_guard.h>
 #include <libio-macros.h>
 
@@ -88,7 +89,7 @@
 # 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] =
@@ -485,6 +486,8 @@ const struct _IO_jump_t __io_vtables[IO_VTABLES_LEN] attribute_relro =
   },
 #endif
 };
+_Static_assert (array_length (__io_vtables) == IO_VTABLES_NUM,
+                "initializer count");
 
 #ifdef SHARED
 
This page took 0.045618 seconds and 5 git commands to generate.