poke-devel
[Top][All Lists]
Advanced

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

[COMMITTED][POKE-ELF] elf-mach-mips: MIPS section flags, segment types a


From: Jose E. Marchesi
Subject: [COMMITTED][POKE-ELF] elf-mach-mips: MIPS section flags, segment types and Elf32_MIPS_RegInfo
Date: Mon, 30 Jan 2023 00:53:05 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

---
 elf-mach-mips.pk | 72 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 69 insertions(+), 3 deletions(-)

diff --git a/elf-mach-mips.pk b/elf-mach-mips.pk
index bc7f1af..5abd22e 100644
--- a/elf-mach-mips.pk
+++ b/elf-mach-mips.pk
@@ -508,6 +508,58 @@ elf_config.add_enum
             Elf_Config_UInt { value = ELF_SHT_MIPS_XHASH, name = "XHASH",
                               doc = "GNU style symbol hash table with xlat." 
}];
 
+/* MIPS section flags.  */
+
+var ELF_SHF_MIPS_GPRE = 0x1000_0000U,
+    ELF_SHF_MIPS_MERGE = 0x2000_0000U,
+    ELF_SHF_MIPS_ADDR = 0x4000_0000U,
+    ELF_SHF_MIPS_STRING = 0x8000_0000U,
+    ELF_SHF_MIPS_NOSTRIP = 0x0800_0000U,
+    ELF_SHF_MIPS_LOCAL = 0x0400_0000U,
+    ELF_SHF_MIPS_NAMES = 0x0200_0000U,
+    ELF_SHF_MIPS_NODUPES = 0x0100_0000U;
+
+elf_config.add_mask
+  :machine ELF_EM_MIPS
+  :class "section-flags"
+  :entries [Elf_Config_Mask { value = ELF_SHF_MIPS_GPRE, name = "gpre",
+                              doc = "This section must be in the global data 
area." },
+            Elf_Config_Mask { value = ELF_SHF_MIPS_MERGE, name = "merge",
+                              doc = "This section should be merged." },
+            Elf_Config_Mask { value = ELF_SHF_MIPS_ADDR, name = "addr",
+                              doc = "This section contains address data of 
size"
+                                    + " implied by section element size." },
+            Elf_Config_Mask { value = ELF_SHF_MIPS_STRING, name = "string",
+                              doc = "This section contains string data." },
+            Elf_Config_Mask { value = ELF_SHF_MIPS_NOSTRIP, name = "nostrip",
+                              doc = "This section may not be stripped." },
+            Elf_Config_Mask { value = ELF_SHF_MIPS_LOCAL, name = "local",
+                              doc = "This section is local to threads." },
+            Elf_Config_Mask { value = ELF_SHF_MIPS_NAMES, name = "names",
+                              doc = "Linker should generate implicit weak 
names for this section." },
+            Elf_Config_Mask { value = ELF_SHF_MIPS_NODUPES, name = "nodupes",
+                              doc = "Section contains text/data which may be 
replicated"
+                                    + " in other sections.  Linker should 
retain only one copy." }];
+
+/* MIPS segment types.  */
+
+var ELF_PT_MIPS_REGINFO = 0x7000_0000U,
+    ELF_PT_MIPS_RTPROC = 0x7000_0001U,
+    ELF_PT_MIPS_OPTIONS = 0x7000_0002U,
+    ELF_PT_MIPS_ABIFLAGS = 0x7000_0003U;
+
+elf_config.add_enum
+  :machine ELF_EM_MIPS
+  :class "segment-types"
+  :entries [Elf_Config_UInt { value = ELF_PT_MIPS_REGINFO, name = "reginfo",
+                              doc = "Register usage information.  Identifies 
one .reginfo section." },
+            Elf_Config_UInt { value = ELF_PT_MIPS_RTPROC, name = "rtproc",
+                              doc = "Runtime procedure table." },
+            Elf_Config_UInt { value = ELF_PT_MIPS_OPTIONS, name = "options",
+                              doc = ".MIPS.options section." },
+            Elf_Config_UInt { value = ELF_PT_MIPS_ABIFLAGS, name = "abiflags",
+                              doc = "Records ABI related flags." }];
+
 /* Values for the l_flags field of an Elf32_MIPS_Lib.  */
 
 var ELF_MIPS_LL_EXACT_MATCH = 0x0000_0001U,
@@ -532,7 +584,7 @@ elf_config.add_mask
             Elf_Config_Mask { value = ELF_MIPS_LL_DELTA, name = "delta",
                               doc = "Delta C++ stuff???" }];
 
-/* Sections of type SHT_MIPS_LIBLIST contain an array of the following
+/* Sections of type ELF_SHT_MIPS_LIBLIST contain an array of the following
    structure.  The sh_link field is the section index of the string table.
    The sh_info field is the number of entries in the section.  */
 
@@ -555,13 +607,13 @@ type Elf32_MIPS_Lib =
     }
   };
 
-/* Sections of type SHT_MIPS_CONFLICT contain arrays of indices into the 
.dynsym
+/* Sections of type ELF_SHT_MIPS_CONFLICT contain arrays of indices into the 
.dynsym
    section.  Each element of the array has the following type.  */
 
 type Elf32_MIPS_Conflict = uint<4>;
 type Elf64_MIPS_Conflict = uint<8>;
 
-/* Sections of type SHT_MIPS_GPTAB contain a single instance of an
+/* Sections of type ELF_SHT_MIPS_GPTAB contain a single instance of an
    Elf32_MIPS_Gptab_Entry, followed by zero or more Elf32_Gptab_Entry. */
 
 type Elf32_MIPS_Gptab_Header =
@@ -580,3 +632,17 @@ type Elf32_MIPS_Gptab_Entry =
     /* ... this many GP section bytes would be required.  */
     uint<32> gt_bytes;
   };
+
+/* Sections of type SHT_MIPS_REGINFO contain a single instance
+   of Elf32_MIPS_RegInfo.  */
+
+type Elf32_MIPS_RegInfo =
+  struct
+  {
+    /* Mask of general purpose registers used.  */
+    uint<32> ri_gprmask;
+    /* Mask of co-processor registers used.  */
+    uint<32>[4] ri_cprmask;
+    /* GP register value for this object file.  */
+    uint<32> ri_gp_value;
+  };
-- 
2.30.2




reply via email to

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