This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC 3/5] Support ELF Infinity notes
- From: Gary Benson <gbenson at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: infinity at sourceware dot org
- Date: Thu, 8 Jun 2017 10:15:36 +0100
- Subject: [RFC 3/5] Support ELF Infinity notes
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=gbenson at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 38670C057FAF
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 38670C057FAF
- References: <1496913338-22195-1-git-send-email-gbenson@redhat.com>
This commit adds support for Infinity notes in ELF .note.infinity
sections. A list of found notes is built and its head pointer stored
as infinity_note_head in struct elf_obj_tdata.
bfd/ChangeLog:
* elf-bfd.h (struct elf_infinity_note): New structure.
(struct elf_obj_tdata): Add new field infinity_note_head.
* elf.c (elfobj_grok_gnu_infinity): New function.
(elfobj_grok_gnu_note): Call the above.
---
bfd/ChangeLog | 7 +++++++
bfd/elf-bfd.h | 14 ++++++++++++++
bfd/elf.c | 23 +++++++++++++++++++++++
3 files changed, 44 insertions(+)
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index af377ee..9da3d53 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1694,6 +1694,15 @@ struct sdt_note
bfd_byte data[1];
};
+/* An Infinity note. */
+struct elf_infinity_note
+{
+ struct elf_infinity_note *next;
+ bfd_vma fileoffset;
+ size_t size;
+ bfd_byte data[0];
+};
+
/* tdata information grabbed from an elf core file. */
struct core_elf_obj_tdata
{
@@ -1856,6 +1865,11 @@ struct elf_obj_tdata
in the list. */
struct sdt_note *sdt_note_head;
+ /* Linked list containing information about every Infinity note
+ found in the object file. Each note corresponds to one entry
+ in the list. */
+ struct elf_infinity_note *infinity_note_head;
+
Elf_Internal_Shdr **group_sect_ptr;
int num_group;
diff --git a/bfd/elf.c b/bfd/elf.c
index 18b4bbe..420773e 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -9756,6 +9756,26 @@ elfobj_grok_gnu_build_id (bfd *abfd, Elf_Internal_Note *note)
}
static bfd_boolean
+elfobj_grok_gnu_infinity (bfd *abfd, Elf_Internal_Note *note)
+{
+ struct elf_infinity_note *cur;
+
+ if (note->descsz == 0)
+ return FALSE;
+
+ cur = bfd_alloc (abfd, sizeof (struct elf_infinity_note) + note->descsz);
+
+ cur->next = elf_tdata (abfd)->infinity_note_head;
+ cur->fileoffset = note->descpos;
+ cur->size = note->descsz;
+ memcpy (cur->data, note->descdata, note->descsz);
+
+ elf_tdata (abfd)->infinity_note_head = cur;
+
+ return TRUE;
+}
+
+static bfd_boolean
elfobj_grok_gnu_note (bfd *abfd, Elf_Internal_Note *note)
{
switch (note->type)
@@ -9768,6 +9788,9 @@ elfobj_grok_gnu_note (bfd *abfd, Elf_Internal_Note *note)
case NT_GNU_BUILD_ID:
return elfobj_grok_gnu_build_id (abfd, note);
+
+ case NT_GNU_INFINITY:
+ return elfobj_grok_gnu_infinity (abfd, note);
}
}
--
1.8.3.1