This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] libebl: Handle SYMTAB_SHNDX in ebl_dynamic_tag_name.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]