From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90897 invoked by alias); 8 Jun 2017 09:15:51 -0000 Mailing-List: contact infinity-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: infinity-owner@sourceware.org Received: (qmail 82570 invoked by uid 89); 8 Jun 2017 09:15:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Linked, 18566 X-Spam-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 08 Jun 2017 09:15:43 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 38670C057FAF; Thu, 8 Jun 2017 09:15:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 38670C057FAF 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@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 38670C057FAF Received: from blade.nx (unknown [10.33.36.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id EDDD489C5A; Thu, 8 Jun 2017 09:15:45 +0000 (UTC) Received: from blade.com (localhost [127.0.0.1]) by blade.nx (Postfix) with ESMTP id AEB2481658FD; Thu, 8 Jun 2017 10:15:44 +0100 (BST) From: Gary Benson 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 Message-Id: <1496913338-22195-4-git-send-email-gbenson@redhat.com> In-Reply-To: <1496913338-22195-1-git-send-email-gbenson@redhat.com> References: <1496913338-22195-1-git-send-email-gbenson@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 08 Jun 2017 09:15:46 +0000 (UTC) X-IsSubscribed: yes X-SW-Source: 2017-q2/txt/msg00010.txt.bz2 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