From: Adam Jackson Date: Fri, 8 Sep 2023 19:55:19 +0000 (-0400) Subject: libio: Fix oversized __io_vtables X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92201f16cbcfd9eafe314ef6654be2ea7ba25675;p=thirdparty%2Fglibc.git libio: Fix oversized __io_vtables 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 Reviewed-by: Florian Weimer Tested-by: Florian Weimer (cherry picked from commit 8cb69e054386f980f9ff4d93b157861d72b2019e) --- diff --git a/libio/vtables.c b/libio/vtables.c index 1d8ad612e94..34f7e15f1c2 100644 --- a/libio/vtables.c +++ b/libio/vtables.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -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