libio: Fix oversized __io_vtables
Checks
Context |
Check |
Description |
redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
linaro-tcwg-bot/tcwg_glibc_build--master-arm |
success
|
Testing passed
|
redhat-pt-bot/TryBot-32bit |
success
|
Build for i686
|
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 |
warning
|
Patch is already merged
|
linaro-tcwg-bot/tcwg_glibc_check--master-arm |
warning
|
Patch is already merged
|
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 |
warning
|
Patch is already merged
|
Commit Message
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(-)
Comments
* Adam Jackson:
> 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>
And applied. Thanks!
Florian
@@ -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;