public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH] libebl: Handle SYMTAB_SHNDX in ebl_dynamic_tag_name.
Date: Fri, 16 Mar 2018 18:45:00 -0000	[thread overview]
Message-ID: <1521225893-31274-1-git-send-email-mark@klomp.org> (raw)

SYMTAB_SHNDX was introduced when elf.h was imported, but not yet handled
in ebl_dynamic_tag_name. Handle it and add an eu_static_assert to make
sure stdtags always contains DT_NUM entries.

https://sourceware.org/bugzilla/show_bug.cgi?id=22976

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 libebl/ChangeLog           | 6 ++++++
 libebl/ebldynamictagname.c | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/libebl/ChangeLog b/libebl/ChangeLog
index de325ab..b4e9049 100644
--- a/libebl/ChangeLog
+++ b/libebl/ChangeLog
@@ -1,3 +1,9 @@
+2018-03-16  Mark Wielaard  <mark@klomp.org>
+
+	* ebldynamictagname.c (ebl_dynamic_tag_name): Add SYMTAB_SHNDX to
+	stdtags. Add a eu_static_assert to make sure stdtags contains all
+	DT_NUM entries.
+
 2018-02-21  Mark Wielaard  <mark@klomp.org>
 
 	* eblcheckreloctargettype.c (ebl_check_reloc_target_type): Accept
diff --git a/libebl/ebldynamictagname.c b/libebl/ebldynamictagname.c
index 3aaccd0..5622fc3 100644
--- a/libebl/ebldynamictagname.c
+++ b/libebl/ebldynamictagname.c
@@ -34,6 +34,7 @@
 #include <inttypes.h>
 #include <stdio.h>
 #include <libeblP.h>
+#include "system.h"
 
 
 const char *
@@ -53,8 +54,9 @@ ebl_dynamic_tag_name (Ebl *ebl, int64_t tag, char *buf, size_t len)
 	      "RELENT", "PLTREL", "DEBUG", "TEXTREL", "JMPREL", "BIND_NOW",
 	      "INIT_ARRAY", "FINI_ARRAY", "INIT_ARRAYSZ", "FINI_ARRAYSZ",
 	      "RUNPATH", "FLAGS", "ENCODING", "PREINIT_ARRAY",
-	      "PREINIT_ARRAYSZ"
+	      "PREINIT_ARRAYSZ", "SYMTAB_SHNDX"
 	    };
+	  eu_static_assert (sizeof (stdtags) / sizeof (const char *) == DT_NUM);
 
 	  res = stdtags[tag];
 	}
-- 
1.8.3.1

                 reply	other threads:[~2018-03-16 18:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1521225893-31274-1-git-send-email-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=elfutils-devel@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).