[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[COMMITTED] pickles: elf: fix definition of ELF notes
From: |
Jose E. Marchesi |
Subject: |
[COMMITTED] pickles: elf: fix definition of ELF notes |
Date: |
Wed, 22 Dec 2021 15:49:01 +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-common.pk (Elf_Note): New type.
* pickles/elf-64.pk (Elf64_Note): Delete.
* pickles/elf-32.pk (Elf32_Note): Likewise.
---
ChangeLog | 6 ++++++
pickles/elf-32.pk | 25 -------------------------
pickles/elf-64.pk | 25 -------------------------
pickles/elf-common.pk | 30 ++++++++++++++++++++++++++++++
4 files changed, 36 insertions(+), 50 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e080ca6a..ae53d74a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2021-12-22 Jose E. Marchesi <jemarch@gnu.org>
+ * pickles/elf-common.pk (Elf_Note): New type.
+ * pickles/elf-64.pk (Elf64_Note): Delete.
+ * pickles/elf-32.pk (Elf32_Note): Likewise.
+
+2021-12-22 Jose E. Marchesi <jemarch@gnu.org>
+
* pickles/elf-common.pk (elf_compress_algorithm_p): New function.
* pickles/elf-32.pk (Elf32_Chdr): Use elf_compress_algorithm_p in
constraint.
diff --git a/pickles/elf-32.pk b/pickles/elf-32.pk
index 33bbb568..690d780e 100644
--- a/pickles/elf-32.pk
+++ b/pickles/elf-32.pk
@@ -77,31 +77,6 @@ type Elf32_Sym =
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 =
diff --git a/pickles/elf-64.pk b/pickles/elf-64.pk
index 914c056e..1ac05dd8 100644
--- a/pickles/elf-64.pk
+++ b/pickles/elf-64.pk
@@ -79,31 +79,6 @@ type Elf64_Sym =
Elf64_Xword st_size;
};
-/* ELF64 notes. */
-
-type Elf64_Note =
- struct
- {
- /* The first `namesz' bytes in `name' contain a NULL-terminated
- character representation of the entry's owner or originator. */
- Elf64_Xword namesz;
-
- /* The first `descsz' bytes in `desc' hold the note descriptor.
- 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)];
-
- byte[descsz] desc;
- byte[alignto (OFFSET, 8#B)];
- };
-
/* Compressed section header, used in sections flagged with
SHF_COMPRESSED. */
diff --git a/pickles/elf-common.pk b/pickles/elf-common.pk
index 9766c1e0..57043ad3 100644
--- a/pickles/elf-common.pk
+++ b/pickles/elf-common.pk
@@ -344,3 +344,33 @@ type Elf_Hash_Table =
Elf_Word[nbucket] bucket;
Elf_Word[nchain] chain;
};
+
+/* ELF notes. */
+
+/* Note that the type below can be used for both ELF32 and ELF64
+ files. The SYSV ABI says that 64-bit notes must be aligned to 8
+ bytes, but binutils is known to generate 64-bit notes aligned to 4
+ bytes instead. */
+
+type Elf_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)];
+};
--
2.11.0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [COMMITTED] pickles: elf: fix definition of ELF notes,
Jose E. Marchesi <=