about summary refs log tree commit diff
path: root/sysdeps/generic/dl-cache.h
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-10-30 11:57:59 +0100
committerFlorian Weimer <fweimer@redhat.com>2020-10-30 14:12:14 +0100
commitde1a9197af7f67a89f929dcadb8ceca8c3846b1c (patch)
treee25480719444dc92f17d84f2e407a5c0c6b3078d /sysdeps/generic/dl-cache.h
parentcb3a749a22a55645dc6a52659eea765300623f98 (diff)
downloadglibc-de1a9197af7f67a89f929dcadb8ceca8c3846b1c.tar.gz
glibc-de1a9197af7f67a89f929dcadb8ceca8c3846b1c.tar.xz
glibc-de1a9197af7f67a89f929dcadb8ceca8c3846b1c.zip
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  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/generic/dl-cache.h')
-rw-r--r--sysdeps/generic/dl-cache.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h
index 6b310e9e15..4ddd96b005 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.	 */
 };