]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/blob - src/patches/glibc-2.38/0013-libio-Fix-oversized-__io_vtables.patch
glibc: Import latest patches from upstream
[people/stevee/ipfire-2.x.git] / src / patches / glibc-2.38 / 0013-libio-Fix-oversized-__io_vtables.patch
1 From 92201f16cbcfd9eafe314ef6654be2ea7ba25675 Mon Sep 17 00:00:00 2001
2 From: Adam Jackson <ajax@redhat.com>
3 Date: Fri, 8 Sep 2023 15:55:19 -0400
4 Subject: [PATCH 13/44] libio: Fix oversized __io_vtables
5
6 IO_VTABLES_LEN is the size of the struct array in bytes, not the number
7 of __IO_jump_t's in the array. Drops just under 384kb from .rodata on
8 LP64 machines.
9
10 Fixes: 3020f72618e ("libio: Remove the usage of __libc_IO_vtables")
11 Signed-off-by: Adam Jackson <ajax@redhat.com>
12 Reviewed-by: Florian Weimer <fweimer@redhat.com>
13 Tested-by: Florian Weimer <fweimer@redhat.com>
14 (cherry picked from commit 8cb69e054386f980f9ff4d93b157861d72b2019e)
15 ---
16 libio/vtables.c | 5 ++++-
17 1 file changed, 4 insertions(+), 1 deletion(-)
18
19 diff --git a/libio/vtables.c b/libio/vtables.c
20 index 1d8ad612e9..34f7e15f1c 100644
21 --- a/libio/vtables.c
22 +++ b/libio/vtables.c
23 @@ -20,6 +20,7 @@
24 #include <libioP.h>
25 #include <stdio.h>
26 #include <ldsodefs.h>
27 +#include <array_length.h>
28 #include <pointer_guard.h>
29 #include <libio-macros.h>
30
31 @@ -88,7 +89,7 @@
32 # pragma weak __wprintf_buffer_as_file_xsputn
33 #endif
34
35 -const struct _IO_jump_t __io_vtables[IO_VTABLES_LEN] attribute_relro =
36 +const struct _IO_jump_t __io_vtables[] attribute_relro =
37 {
38 /* _IO_str_jumps */
39 [IO_STR_JUMPS] =
40 @@ -485,6 +486,8 @@ const struct _IO_jump_t __io_vtables[IO_VTABLES_LEN] attribute_relro =
41 },
42 #endif
43 };
44 +_Static_assert (array_length (__io_vtables) == IO_VTABLES_NUM,
45 + "initializer count");
46
47 #ifdef SHARED
48
49 --
50 2.39.2
51