summaryrefslogtreecommitdiff
path: root/libebl
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2016-02-12 15:04:00 +0100
committerMark Wielaard <mjw@redhat.com>2016-02-15 23:51:20 +0100
commit6e723c787212aae2589ad3c000bd38dd21b12095 (patch)
tree80be73067f66ec913e65092ed90efe4cf0388499 /libebl
parent8bc1423bdc6f0790a669a43ce1604763a3e55587 (diff)
downloadelfutils-6e723c787212aae2589ad3c000bd38dd21b12095.tar.gz
libebl: Don't assume ELF notes are "GNU" when unknown, recognize "Go" notes.
We used to assume any unknown ELF note provider name was "GNU" and didn't recognize any of the "Go" provider types. We now check the provider name explictly in ebl_object_note_type_name and recognize the following Go note names: PKGLIST, ABIHASH, DEPS and BUILDID. But there is no attempt yet in ebl_object_note to decode the description of these notes. https://bugzilla.redhat.com/show_bug.cgi?id=1295951 Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'libebl')
-rw-r--r--libebl/ChangeLog6
-rw-r--r--libebl/eblobjnotetypename.c35
2 files changed, 40 insertions, 1 deletions
diff --git a/libebl/ChangeLog b/libebl/ChangeLog
index aa3d6867..26a4f941 100644
--- a/libebl/ChangeLog
+++ b/libebl/ChangeLog
@@ -1,3 +1,9 @@
+2016-02-12 Mark Wielaard <mjw@redhat.com>
+
+ * eblobjnotetypename.c (ebl_object_note_type_name): Check name is
+ "Go" and use new goknowntypes then. Otherwise check name is not
+ "GNU" and return "unknown".
+
2016-01-09 Mark Wielaard <mjw@redhat.com>
* eblobjnote.c (ebl_object_note): Add brackets around if statement
diff --git a/libebl/eblobjnotetypename.c b/libebl/eblobjnotetypename.c
index 8e2e329b..db040d29 100644
--- a/libebl/eblobjnotetypename.c
+++ b/libebl/eblobjnotetypename.c
@@ -1,5 +1,5 @@
/* Return note type name.
- Copyright (C) 2002, 2007, 2009, 2011 Red Hat, Inc.
+ Copyright (C) 2002, 2007, 2009, 2011, 2016 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -51,6 +51,39 @@ ebl_object_note_type_name (Ebl *ebl, const char *name, uint32_t type,
return buf;
}
+#define ELF_NOTE_GOPKGLIST 1
+#define ELF_NOTE_GOABIHASH 2
+#define ELF_NOTE_GODEPS 3
+#define ELF_NOTE_GOBUILDID 4
+
+ static const char *goknowntypes[] =
+ {
+#define KNOWNSTYPE(name) [ELF_NOTE_GO##name] = #name
+ KNOWNSTYPE (PKGLIST),
+ KNOWNSTYPE (ABIHASH),
+ KNOWNSTYPE (DEPS),
+ KNOWNSTYPE (BUILDID),
+#undef KNOWNSTYPE
+ };
+
+ if (strcmp (name, "Go") == 0)
+ {
+ if (type < sizeof (goknowntypes) / sizeof (goknowntypes[0])
+ && goknowntypes[type] != NULL)
+ return goknowntypes[type];
+ else
+ {
+ snprintf (buf, len, "%s: %" PRIu32, gettext ("<unknown>"), type);
+ return buf;
+ }
+ }
+
+ if (strcmp (name, "GNU") != 0)
+ {
+ snprintf (buf, len, "%s: %" PRIu32, gettext ("<unknown>"), type);
+ return buf;
+ }
+
static const char *knowntypes[] =
{
#define KNOWNSTYPE(name) [NT_##name] = #name