[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[COMMITTED] pickles: elf: add definitions for ELF32 symbols
From: |
Jose E. Marchesi |
Subject: |
[COMMITTED] pickles: elf: add definitions for ELF32 symbols |
Date: |
Tue, 21 Dec 2021 14:15:37 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
2021-12-21 Jose E. Marchesi <jemarch@gnu.org>
* pickles/elf-32.pk (Elf32_Sym): New type.
* pickles/elf-common.pk (Elf_Sym_Info): Likewise.
(Elf_Sym_Other_Info): Likewise.
* pickles/elf-64.pk (Elf64_Sym): Use Elf_Sym_Info and
Elf_Sym_Other_Info.
---
ChangeLog | 8 ++++++++
pickles/elf-32.pk | 13 +++++++++++++
pickles/elf-64.pk | 25 ++-----------------------
pickles/elf-common.pk | 28 ++++++++++++++++++++++++++++
4 files changed, 51 insertions(+), 23 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ec72d83f..6eb3c910 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2021-12-21 Jose E. Marchesi <jemarch@gnu.org>
+ * pickles/elf-32.pk (Elf32_Sym): New type.
+ * pickles/elf-common.pk (Elf_Sym_Info): Likewise.
+ (Elf_Sym_Other_Info): Likewise.
+ * pickles/elf-64.pk (Elf64_Sym): Use Elf_Sym_Info and
+ Elf_Sym_Other_Info.
+
+2021-12-21 Jose E. Marchesi <jemarch@gnu.org>
+
* pickles/elf64.pk: New file.
* pickles/elf32.pk: Likewise.
* pickles/elf-common.pk: Likewise.
diff --git a/pickles/elf-32.pk b/pickles/elf-32.pk
index f6ff62ef..3b192c41 100644
--- a/pickles/elf-32.pk
+++ b/pickles/elf-32.pk
@@ -63,3 +63,16 @@ type Elf32_Rela =
Elf32_RelInfo r_info;
Elf_Sword r_addend;
};
+
+/* ELF32 symbol. */
+
+type Elf32_Sym =
+ struct
+ {
+ offset<Elf_Word,B> st_name;
+ Elf32_Addr st_value;
+ offset<Elf_Word,B> st_size;
+ Elf_Sym_Info st_info;
+ Elf_Sym_Other_Info st_other;
+ Elf_Half st_shndx;
+ };
diff --git a/pickles/elf-64.pk b/pickles/elf-64.pk
index 15763951..c77e8730 100644
--- a/pickles/elf-64.pk
+++ b/pickles/elf-64.pk
@@ -72,29 +72,8 @@ type Elf64_Sym =
struct
{
offset<Elf_Word,B> st_name;
- struct uint<8>
- {
- uint<4> st_bind;
- uint<4> st_type;
-
- method _print = void:
- {
- printf ("#<stb:%s,stt:%s>",
- elf_stb_names[st_bind], elf_stt_names[st_type]);
- }
- } st_info;
-
- struct uint<8>
- {
- uint<5>;
- uint<3> st_visibility;
-
- method _print = void:
- {
- print "#<stv:" + elf_stv_names[st_visibility] + ">";
- }
- } st_other;
-
+ Elf_Sym_Info st_info;
+ Elf_Sym_Other_Info st_other;
Elf_Half st_shndx;
Elf64_Addr st_value;
Elf64_Xword st_size;
diff --git a/pickles/elf-common.pk b/pickles/elf-common.pk
index 5fb68f5c..42ee1923 100644
--- a/pickles/elf-common.pk
+++ b/pickles/elf-common.pk
@@ -84,6 +84,34 @@ var STV_DEFAULT = 0,
var elf_stv_names =
["default", "internal", "hidden", "protected"];
+/* Types for ELF symbol information, including binding, type and
+ visibility. */
+
+type Elf_Sym_Info =
+ struct uint<8>
+ {
+ uint<4> st_bind;
+ uint<4> st_type;
+
+ method _print = void:
+ {
+ printf ("#<stb:%s,stt:%s>",
+ elf_stb_names[st_bind], elf_stt_names[st_type]);
+ }
+ };
+
+type Elf_Sym_Other_Info =
+ struct uint<8>
+ {
+ uint<5>;
+ uint<3> st_visibility;
+
+ method _print = void:
+ {
+ print "#<stv:" + elf_stv_names[st_visibility] + ">";
+ }
+ };
+
/* Compression algorithm identificators. */
var ELFCOMPRESS_ZLIB = 1,
--
2.11.0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [COMMITTED] pickles: elf: add definitions for ELF32 symbols,
Jose E. Marchesi <=