From: Gary Benson <gbenson@redhat.com>
To: gdb-patches@sourceware.org
Cc: infinity@sourceware.org
Subject: [RFC 3/5] Support ELF Infinity notes
Date: Thu, 08 Jun 2017 09:15:00 -0000 [thread overview]
Message-ID: <1496913338-22195-4-git-send-email-gbenson@redhat.com> (raw)
In-Reply-To: <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
next prev parent reply other threads:[~2017-06-08 9:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-08 9:15 [RFC 0/5] New proc_service functionality for Infinity Gary Benson
2017-06-08 9:15 ` [RFC 2/5] Add NT_GNU_INFINITY Gary Benson
2017-06-08 9:15 ` Gary Benson [this message]
2017-06-08 9:15 ` [RFC 1/5] Add FS_BASE and GS_BASE to DWARF register table on amd64 Gary Benson
2017-06-08 9:24 ` [RFC 5/5] Implement Infinity proc_service functions in GDB Gary Benson
2017-06-08 9:24 ` [RFC 4/5] Declare Infinity proc_service functions in gdb_proc_service.h Gary Benson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1496913338-22195-4-git-send-email-gbenson@redhat.com \
--to=gbenson@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=infinity@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).