From e21a7867713c87d0b0698254685d414d811d72b2 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Sun, 3 Nov 2019 11:20:23 +0100 Subject: Avoid zero-length array at the end of struct link_map [BZ #25097] l_audit ends up as an internal array with _rtld_global, and GCC 10 warns about this. This commit does not change the layout of _rtld_global, so it is suitable for backporting. Future changes could allocate more of the audit state dynamically and remove it from always-allocated data structures, to optimize the common case of inactive auditing. Change-Id: Ic911100730f9124d4ea977ead8e13cee64b84d45 --- include/link.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'include/link.h') diff --git a/include/link.h b/include/link.h index 1184201..be52b97 100644 --- a/include/link.h +++ b/include/link.h @@ -325,16 +325,18 @@ struct link_map size_t l_relro_size; unsigned long long int l_serial; - - /* Audit information. This array apparent must be the last in the - structure. Never add something after it. */ - struct auditstate - { - uintptr_t cookie; - unsigned int bindflags; - } l_audit[0]; }; +/* Information used by audit modules. For most link maps, this data + immediate follows the link map in memory. For the dynamic linker, + it is allocated separately. See link_map_audit_state in + . */ +struct auditstate +{ + uintptr_t cookie; + unsigned int bindflags; +}; + #if __ELF_NATIVE_CLASS == 32 # define symbind symbind32 -- cgit v1.1