public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: luca.boccassi@gmail.com
Cc: elfutils-devel@sourceware.org, Luca Boccassi <bluca@debian.org>
Subject: [PATCH 2/2] readelf: add pretty printing for FDO Dlopen Metadata note
Date: Fri, 31 May 2024 14:36:12 +0200	[thread overview]
Message-ID: <20240531123939.481611-3-mark@klomp.org> (raw)
In-Reply-To: <20240531123939.481611-1-mark@klomp.org>

From: Luca Boccassi <bluca@debian.org>

The node ID and the string format are now fixed, even if the content
of the string might change, it will still be a string.

     * libebl/eblobjnote.c (ebl_object_note): Handle both type
     being NT_FDO_PACKAGING_METADATA or NT_FDO_DLOPEN_METADATA when
     name is "FDO".
     * libebl/eblobjnotetypename.c (ebl_object_note_type_name): Handle
     "FDO" name and type NT_FDO_DLOPEN_METADATA.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
 libebl/eblobjnote.c         | 9 +++++++--
 libebl/eblobjnotetypename.c | 3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/libebl/eblobjnote.c b/libebl/eblobjnote.c
index 1ba5d8b32354..ad3f49de3456 100644
--- a/libebl/eblobjnote.c
+++ b/libebl/eblobjnote.c
@@ -288,9 +288,14 @@ ebl_object_note (Ebl *ebl, uint32_t namesz, const char *name, uint32_t type,
       if (descsz == 0 && type == NT_VERSION)
 	return;
 
-      if (strcmp ("FDO", name) == 0 && type == NT_FDO_PACKAGING_METADATA
+      if (strcmp ("FDO", name) == 0
 	  && descsz > 0 && desc[descsz - 1] == '\0')
-	printf("    Packaging Metadata: %.*s\n", (int) descsz, desc);
+	{
+	  if (type == NT_FDO_PACKAGING_METADATA)
+	    printf("    Packaging Metadata: %.*s\n", (int) descsz, desc);
+	  else if (type == NT_FDO_DLOPEN_METADATA)
+	    printf("    Dlopen  Metadata: %.*s\n", (int) descsz, desc);
+	}
 
       /* Everything else should have the "GNU" owner name.  */
       if (strcmp ("GNU", name) != 0)
diff --git a/libebl/eblobjnotetypename.c b/libebl/eblobjnotetypename.c
index 473a1f2f2fd4..79ff010a37d8 100644
--- a/libebl/eblobjnotetypename.c
+++ b/libebl/eblobjnotetypename.c
@@ -104,6 +104,9 @@ ebl_object_note_type_name (Ebl *ebl, const char *name, uint32_t type,
       if (strcmp (name, "FDO") == 0 && type == NT_FDO_PACKAGING_METADATA)
 	return "FDO_PACKAGING_METADATA";
 
+      if (strcmp (name, "FDO") == 0 && type == NT_FDO_DLOPEN_METADATA)
+	return "FDO_DLOPEN_METADATA";
+
       if (strcmp (name, "GNU") != 0)
 	{
 	  /* NT_VERSION is special, all data is in the name.  */
-- 
2.45.1


  parent reply	other threads:[~2024-05-31 12:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10 21:58 [PATCH] " luca.boccassi
2024-05-14 21:18 ` Mark Wielaard
2024-05-30 10:45   ` Luca Boccassi
2024-05-31 12:36     ` Mark Wielaard
2024-05-31 12:36       ` [PATCH 1/2] libelf: Sync elf.h from glibc Mark Wielaard
2024-05-31 12:36       ` Mark Wielaard [this message]
2024-05-31 12:43       ` [PATCH] readelf: add pretty printing for FDO Dlopen Metadata note Luca Boccassi

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=20240531123939.481611-3-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=bluca@debian.org \
    --cc=elfutils-devel@sourceware.org \
    --cc=luca.boccassi@gmail.com \
    /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).