public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/release/2.38/master] libio: Fix oversized __io_vtables
@ 2023-09-08 21:36 Florian Weimer
  0 siblings, 0 replies; only message in thread
From: Florian Weimer @ 2023-09-08 21:36 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=92201f16cbcfd9eafe314ef6654be2ea7ba25675

commit 92201f16cbcfd9eafe314ef6654be2ea7ba25675
Author: Adam Jackson <ajax@redhat.com>
Date:   Fri Sep 8 15:55:19 2023 -0400

    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 <ajax@redhat.com>
    Reviewed-by: Florian Weimer <fweimer@redhat.com>
    Tested-by: Florian Weimer <fweimer@redhat.com>
    (cherry picked from commit 8cb69e054386f980f9ff4d93b157861d72b2019e)

Diff:
---
 libio/vtables.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libio/vtables.c b/libio/vtables.c
index 1d8ad612e9..34f7e15f1c 100644
--- a/libio/vtables.c
+++ b/libio/vtables.c
@@ -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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-08 21:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-08 21:36 [glibc/release/2.38/master] libio: Fix oversized __io_vtables Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).