summaryrefslogtreecommitdiffstats
path: root/contrib/binutils
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2013-09-13 18:21:31 +0000
committeremaste <emaste@FreeBSD.org>2013-09-13 18:21:31 +0000
commitb61d028aaba1d450a22c74ca0b6864e4f42393a5 (patch)
tree543b031b9c8b643f5e16d7f63e6cffeffb4a11a2 /contrib/binutils
parent1b9dc8f60c0b501e17ab3dcdceb4fb2797485692 (diff)
downloadFreeBSD-src-b61d028aaba1d450a22c74ca0b6864e4f42393a5.zip
FreeBSD-src-b61d028aaba1d450a22c74ca0b6864e4f42393a5.tar.gz
Improve readelf notes output for Linux ELF files
Add four ELF note constants: - NT_FILE and NT_SIGINFO (core file notes output by recent Linux kernels) - NT_GNU_ABI_TAG (was incorrectly reported as NT_VERSION) - NT_GNU_BUILD_ID (used for locating standalone debug files) Approved by: re (kib)
Diffstat (limited to 'contrib/binutils')
-rw-r--r--contrib/binutils/binutils/readelf.c25
-rw-r--r--contrib/binutils/include/elf/common.h5
2 files changed, 30 insertions, 0 deletions
diff --git a/contrib/binutils/binutils/readelf.c b/contrib/binutils/binutils/readelf.c
index a70e3c3..a4adb78 100644
--- a/contrib/binutils/binutils/readelf.c
+++ b/contrib/binutils/binutils/readelf.c
@@ -9109,6 +9109,10 @@ get_note_type (unsigned e_type)
return _("NT_LWPSINFO (lwpsinfo_t structure)");
case NT_WIN32PSTATUS:
return _("NT_WIN32PSTATUS (win32_pstatus structure)");
+ case NT_FILE:
+ return _("NT_FILE");
+ case NT_SIGINFO:
+ return _("NT_SIGINFO");
default:
break;
}
@@ -9174,6 +9178,23 @@ get_freebsd_note_type (unsigned e_type)
}
static const char *
+get_gnu_note_type (unsigned e_type)
+{
+ static char buff[64];
+
+ switch (e_type)
+ {
+ case NT_GNU_ABI_TAG:
+ return _("NT_GNU_ABI_TAG");
+ case NT_GNU_BUILD_ID:
+ return _("NT_GNU_BUILD_ID");
+ }
+
+ snprintf (buff, sizeof(buff), _("Unknown GNU note type: (0x%08x)"), e_type);
+ return buff;
+}
+
+static const char *
get_netbsd_elfcore_note_type (unsigned e_type)
{
static char buff[64];
@@ -9254,6 +9275,10 @@ process_note (Elf_Internal_Note *pnote)
/* FreeBSD-specific core file notes. */
nt = get_freebsd_note_type (pnote->type);
+ else if (const_strneq (pnote->namedata, "GNU"))
+ /* GNU-specific notes */
+ nt = get_gnu_note_type (pnote->type);
+
else if (const_strneq (pnote->namedata, "NetBSD-CORE"))
/* NetBSD-specific core file notes. */
nt = get_netbsd_elfcore_note_type (pnote->type);
diff --git a/contrib/binutils/include/elf/common.h b/contrib/binutils/include/elf/common.h
index 92b8f4d..17ca0d5 100644
--- a/contrib/binutils/include/elf/common.h
+++ b/contrib/binutils/include/elf/common.h
@@ -388,8 +388,10 @@
#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */
#define NT_TASKSTRUCT 4 /* Contains copy of task struct */
#define NT_AUXV 6 /* Contains copy of Elfxx_auxv_t */
+#define NT_FILE 0x46494c45
#define NT_PRXFPREG 0x46e62b7f /* Contains a user_xfpregs_struct; */
/* note name must be "LINUX". */
+#define NT_SIGINFO 0x53494749
/* Note segments for core files on dir-style procfs systems. */
@@ -435,6 +437,9 @@
#define GNU_ABI_TAG_FREEBSD 3
#define GNU_ABI_TAG_NETBSD 4
+/* Values for GNU .note.gnu.build-id notes. Note name is "GNU"." */
+#define NT_GNU_BUILD_ID 3
+
/* Values for NetBSD .note.netbsd.ident notes. Note name is "NetBSD". */
#define NT_NETBSD_IDENT 1
OpenPOWER on IntegriCloud