poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[COMMITTED] pickles: elf: add Elf32_Note and Elf32_Chdr types and other


From: Jose E. Marchesi
Subject: [COMMITTED] pickles: elf: add Elf32_Note and Elf32_Chdr types and other fixes
Date: Wed, 22 Dec 2021 15:01:32 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

2021-12-22  Jose E. Marchesi  <jemarch@gnu.org>

        * pickles/elf-64.pk (Elf64_Note): Add field _type.
        (Elf64_Chdr): Add constraint and comments.
        * pickles/elf-32.pk (Elf32_Note): New type.
        (Elf32_Chdr): Likewise.
---
 ChangeLog         |  7 +++++++
 pickles/elf-32.pk | 39 +++++++++++++++++++++++++++++++++++++++
 pickles/elf-64.pk | 11 ++++++++++-
 3 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 419ce235..b1e761f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2021-12-22  Jose E. Marchesi  <jemarch@gnu.org>
+
+       * pickles/elf-64.pk (Elf64_Note): Add field _type.
+       (Elf64_Chdr): Add constraint and comments.
+       * pickles/elf-32.pk (Elf32_Note): New type.
+       (Elf32_Chdr): Likewise.
+
 2021-12-22  Luca Saiu  <positron@gnu.org>
 
        * configure.ac (AC_JITTER_SUBPACKAGE): Rename to
diff --git a/pickles/elf-32.pk b/pickles/elf-32.pk
index 3b192c41..781a511b 100644
--- a/pickles/elf-32.pk
+++ b/pickles/elf-32.pk
@@ -76,3 +76,42 @@ type Elf32_Sym =
     Elf_Sym_Other_Info st_other;
     Elf_Half st_shndx;
   };
+
+/* ELF32 notes.  */
+
+type Elf32_Note =
+  struct
+  {
+    /* The first `namesz' bytes in `name' contain a NULL-terminated
+    character representation of the entry's owner or originator.  */
+    Elf_Word namesz;
+
+    /* The first `descsz' bytes in `desc' hold the note descriptor.
+       The ABI places no constraints on a descriptor's contents.  */
+    Elf_Word descsz;
+
+    /* This word gives the interpretation of the descriptor.  Each
+       originator controls its own types.  They must be non-negative.
+       The ABI does not define what descriptors mean.  */
+    Elf_Word _type;
+
+    byte[namesz] name;
+    byte[alignto (OFFSET, 4#B)];
+
+    byte[descsz] desc;
+    byte[alignto (OFFSET, 4#B)];
+  };
+
+/* ELF32 compressed section header.  */
+
+type Elf32_Chdr =
+  struct
+  {
+    /* This member specifies the compression algorithm.  */
+    Elf_Word ch_type : (ch_type == ELFCOMPRESS_ZLIB
+                        || (ch_type >= ELFCOMPRESS_LOOS && ch_type <= 
ELFCOMPRESS_HIOS)
+                        || (ch_type >= ELFCOMPRESS_LOPROC && ch_type <= 
ELFCOMPRESS_HIPROC));
+    /* Size and required alignment of the uncompressed data.  */
+    offset<Elf_Word,B> ch_size;
+    offset<Elf_Word,B> ch_addralign;
+  };
diff --git a/pickles/elf-64.pk b/pickles/elf-64.pk
index c77e8730..55abf57b 100644
--- a/pickles/elf-64.pk
+++ b/pickles/elf-64.pk
@@ -92,6 +92,11 @@ type Elf64_Note =
     The ABI places no constraints on a descriptor's contents.  */
     Elf64_Xword descsz;
 
+    /* This word gives the interpretation of the descriptor.  Each
+       originator controls its own types.  They must be non-negative.
+       The ABI does not define what descriptors mean.  */
+    Elf64_Xword _type;
+    
     byte[namesz] name;
     byte[alignto (OFFSET, 8#B)];
 
@@ -105,8 +110,12 @@ type Elf64_Note =
 type Elf64_Chdr =
   struct
   {
-    Elf_Word ch_type;
+    /* This member specifies the compression algorithm.  */
+    Elf_Word ch_type : (ch_type == ELFCOMPRESS_ZLIB
+                        || (ch_type >= ELFCOMPRESS_LOOS && ch_type <= 
ELFCOMPRESS_HIOS)
+                        || (ch_type >= ELFCOMPRESS_LOPROC && ch_type <= 
ELFCOMPRESS_HIPROC));
     Elf_Word ch_reserved;
+    /* Size and required alignment of the uncompressed data.  */
     offset<Elf64_Xword,B> ch_size;
     offset<Elf64_Xword,B> ch_addralign;
   };
-- 
2.11.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]