From de1a9197af7f67a89f929dcadb8ceca8c3846b1c Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 30 Oct 2020 11:57:59 +0100 Subject: elf: Unify old and new format cache handling code in ld.so struct file_entry_new starts with the fields of struct file_entry, so the code can be shared if the size computation is made dynamic. Reviewed-by: Adhemerval Zanella --- sysdeps/generic/dl-cache.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'sysdeps/generic') diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h index 6b310e9..4ddd96b 100644 --- a/sysdeps/generic/dl-cache.h +++ b/sysdeps/generic/dl-cache.h @@ -59,8 +59,8 @@ */ struct file_entry { - int flags; /* This is 1 for an ELF library. */ - unsigned int key, value; /* String table indices. */ + int32_t flags; /* This is 1 for an ELF library. */ + uint32_t key, value; /* String table indices. */ }; struct cache_file @@ -77,8 +77,17 @@ struct cache_file struct file_entry_new { - int32_t flags; /* This is 1 for an ELF library. */ - uint32_t key, value; /* String table indices. */ + union + { + /* Fields shared with struct file_entry. */ + struct file_entry entry; + /* Also expose these fields directly. */ + struct + { + int32_t flags; /* This is 1 for an ELF library. */ + uint32_t key, value; /* String table indices. */ + }; + }; uint32_t osversion; /* Required OS version. */ uint64_t hwcap; /* Hwcap entry. */ }; -- cgit v1.1