diff options
Diffstat (limited to 'libebl/eblobjnotetypename.c')
-rw-r--r-- | libebl/eblobjnotetypename.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/libebl/eblobjnotetypename.c b/libebl/eblobjnotetypename.c index db040d29..6b803cef 100644 --- a/libebl/eblobjnotetypename.c +++ b/libebl/eblobjnotetypename.c @@ -1,5 +1,5 @@ /* Return note type name. - Copyright (C) 2002, 2007, 2009, 2011, 2016 Red Hat, Inc. + Copyright (C) 2002, 2007, 2009, 2011, 2016, 2018 Red Hat, Inc. This file is part of elfutils. Written by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -39,6 +39,7 @@ const char * ebl_object_note_type_name (Ebl *ebl, const char *name, uint32_t type, + GElf_Word descsz, char *buf, size_t len) { const char *res = ebl->object_note_type_name (name, type, buf, len); @@ -78,19 +79,46 @@ ebl_object_note_type_name (Ebl *ebl, const char *name, uint32_t type, } } + if (strncmp (name, ELF_NOTE_GNU_BUILD_ATTRIBUTE_PREFIX, + strlen (ELF_NOTE_GNU_BUILD_ATTRIBUTE_PREFIX)) == 0) + { + /* GNU Build Attribute notes (ab)use the owner name to store + most of their data. Don't decode everything here. Just + the type.*/ + char *t = buf; + const char *gba = "GNU Build Attribute"; + int w = snprintf (t, len, "%s ", gba); + t += w; + len -= w; + if (type == NT_GNU_BUILD_ATTRIBUTE_OPEN) + snprintf (t, len, "OPEN"); + else if (type == NT_GNU_BUILD_ATTRIBUTE_FUNC) + snprintf (t, len, "FUNC"); + else + snprintf (t, len, "%x", type); + + return buf; + } + if (strcmp (name, "GNU") != 0) { + /* NT_VERSION is special, all data is in the name. */ + if (descsz == 0 && type == NT_VERSION) + return "VERSION"; + snprintf (buf, len, "%s: %" PRIu32, gettext ("<unknown>"), type); return buf; } + /* And finally all the "GNU" note types. */ static const char *knowntypes[] = { #define KNOWNSTYPE(name) [NT_##name] = #name - KNOWNSTYPE (VERSION), + KNOWNSTYPE (GNU_ABI_TAG), KNOWNSTYPE (GNU_HWCAP), KNOWNSTYPE (GNU_BUILD_ID), KNOWNSTYPE (GNU_GOLD_VERSION), + KNOWNSTYPE (GNU_PROPERTY_TYPE_0), }; /* Handle standard names. */ |