Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/gpl3/binutils/dist Teach me about the NetBSD-CORE E...
details: https://anonhg.NetBSD.org/src/rev/6f2c485f8e73
branches: trunk
changeset: 352381:6f2c485f8e73
user: christos <christos%NetBSD.org@localhost>
date: Wed Mar 29 15:28:42 2017 +0000
description:
Teach me about the NetBSD-CORE ELF AuxV note.
diffstat:
external/gpl3/binutils/dist/bfd/elf.c | 75 ++++++++++-------------
external/gpl3/binutils/dist/binutils/readelf.c | 9 ++-
external/gpl3/binutils/dist/include/elf/common.h | 1 +
3 files changed, 41 insertions(+), 44 deletions(-)
diffs (157 lines):
diff -r 72ac03986b50 -r 6f2c485f8e73 external/gpl3/binutils/dist/bfd/elf.c
--- a/external/gpl3/binutils/dist/bfd/elf.c Wed Mar 29 09:04:35 2017 +0000
+++ b/external/gpl3/binutils/dist/bfd/elf.c Wed Mar 29 15:28:42 2017 +0000
@@ -8741,6 +8741,22 @@
return elfcore_maybe_make_sect (abfd, name, sect);
}
+static bfd_boolean
+elfcore_make_auxv_note_section (bfd *abfd, Elf_Internal_Note *note,
+ size_t offs)
+{
+ asection *sect = bfd_make_section_anyway_with_flags (abfd, ".auxv",
+ SEC_HAS_CONTENTS);
+
+ if (sect == NULL)
+ return FALSE;
+ sect->size = note->descsz - offs;
+ sect->filepos = note->descpos + offs;
+ sect->alignment_power = 1 + bfd_get_arch_size (abfd) / 32;
+
+ return TRUE;
+}
+
/* prstatus_t exists on:
solaris 2.5+
linux 2.[01] + glibc
@@ -9461,18 +9477,7 @@
#endif
case NT_AUXV:
- {
- asection *sect = bfd_make_section_anyway_with_flags (abfd, ".auxv",
- SEC_HAS_CONTENTS);
-
- if (sect == NULL)
- return FALSE;
- sect->size = note->descsz;
- sect->filepos = note->descpos;
- sect->alignment_power = 1 + bfd_get_arch_size (abfd) / 32;
-
- return TRUE;
- }
+ return elfcore_make_auxv_note_section (abfd, note, 0);
case NT_FILE:
return elfcore_make_note_pseudosection (abfd, ".note.linuxcore.file",
@@ -9664,18 +9669,7 @@
return TRUE;
case NT_FREEBSD_PROCSTAT_AUXV:
- {
- asection *sect = bfd_make_section_anyway_with_flags (abfd, ".auxv",
- SEC_HAS_CONTENTS);
-
- if (sect == NULL)
- return FALSE;
- sect->size = note->descsz - 4;
- sect->filepos = note->descpos + 4;
- sect->alignment_power = 1 + bfd_get_arch_size (abfd) / 32;
-
- return TRUE;
- }
+ return elfcore_make_auxv_note_section (abfd, note, 4);
case NT_X86_XSTATE:
if (note->namesz == 8)
@@ -9721,6 +9715,7 @@
note);
}
+
static bfd_boolean
elfcore_grok_netbsd_note (bfd *abfd, Elf_Internal_Note *note)
{
@@ -9729,17 +9724,24 @@
if (elfcore_netbsd_get_lwpid (note, &lwp))
elf_tdata (abfd)->core->lwpid = lwp;
- if (note->type == NT_NETBSDCORE_PROCINFO)
- {
+ switch (note->type)
+ {
+ case NT_NETBSDCORE_PROCINFO:
/* NetBSD-specific core "procinfo". Note that we expect to
find this note before any of the others, which is fine,
since the kernel writes this note out first when it
creates a core file. */
-
return elfcore_grok_netbsd_procinfo (abfd, note);
- }
-
- /* As of Jan 2002 there are no other machine-independent notes
+
+ case NT_NETBSDCORE_AUXV:
+ /* NetBSD-specific Elf Auxiliary Vector data. */
+ return elfcore_make_auxv_note_section (abfd, note, 4);
+
+ default:
+ break;
+ }
+
+ /* As of March 2017 there are no other machine-independent notes
defined for NetBSD core files. If the note type is less
than the start of the machine-dependent note types, we don't
understand it. */
@@ -9837,18 +9839,7 @@
return elfcore_make_note_pseudosection (abfd, ".reg-xfp", note);
if (note->type == NT_OPENBSD_AUXV)
- {
- asection *sect = bfd_make_section_anyway_with_flags (abfd, ".auxv",
- SEC_HAS_CONTENTS);
-
- if (sect == NULL)
- return FALSE;
- sect->size = note->descsz;
- sect->filepos = note->descpos;
- sect->alignment_power = 1 + bfd_get_arch_size (abfd) / 32;
-
- return TRUE;
- }
+ return elfcore_make_auxv_note_section (abfd, note, 0);
if (note->type == NT_OPENBSD_WCOOKIE)
{
diff -r 72ac03986b50 -r 6f2c485f8e73 external/gpl3/binutils/dist/binutils/readelf.c
--- a/external/gpl3/binutils/dist/binutils/readelf.c Wed Mar 29 09:04:35 2017 +0000
+++ b/external/gpl3/binutils/dist/binutils/readelf.c Wed Mar 29 15:28:42 2017 +0000
@@ -15666,10 +15666,15 @@
{
static char buff[64];
- if (e_type == NT_NETBSDCORE_PROCINFO)
- {
+ switch (e_type)
+ {
+ case NT_NETBSDCORE_PROCINFO:
/* NetBSD core "procinfo" structure. */
return _("NetBSD procinfo structure");
+ case NT_NETBSDCORE_AUXV:
+ return _("NetBSD ELF auxiliary vector data");
+ default:
+ break;
}
/* As of Jan 2002 there are no other machine-independent notes
diff -r 72ac03986b50 -r 6f2c485f8e73 external/gpl3/binutils/dist/include/elf/common.h
--- a/external/gpl3/binutils/dist/include/elf/common.h Wed Mar 29 09:04:35 2017 +0000
+++ b/external/gpl3/binutils/dist/include/elf/common.h Wed Mar 29 15:28:42 2017 +0000
@@ -614,6 +614,7 @@
must start with "NetBSD-CORE". */
#define NT_NETBSDCORE_PROCINFO 1 /* Has a struct procinfo */
+#define NT_NETBSDCORE_AUXV 2 /* Has ELF Auxiliary vector */
#define NT_NETBSDCORE_FIRSTMACH 32 /* start of machdep note types */
Home |
Main Index |
Thread Index |
Old Index