Add support for NetBSD/sh3 core file sections. Merge multiple copies of auxv section creation into one function.
PR 24650 * elf.c (elfcore_make_auxv_note_section): New function. (elfcore_grok_note): Use it. (elfcore_grok_freebsd_note): Likewise. (elfcore_grok_openbsd_note): Likewise. (elfcore_grok_netbsd_note): Likewise. Plus add support for NT_NETBSDCORE_AUXV notes.
This commit is contained in:
parent
25ce02ee7b
commit
58e07198f3
@ -1,3 +1,13 @@
|
||||
2019-06-10 Christos Zoulas <christos@zoulas.com>
|
||||
|
||||
PR 24650
|
||||
* elf.c (elfcore_make_auxv_note_section): New function.
|
||||
(elfcore_grok_note): Use it.
|
||||
(elfcore_grok_freebsd_note): Likewise.
|
||||
(elfcore_grok_openbsd_note): Likewise.
|
||||
(elfcore_grok_netbsd_note): Likewise. Plus add support for
|
||||
NT_NETBSDCORE_AUXV notes.
|
||||
|
||||
2019-06-06 Sudakshina Das <sudi.das@arm.com>
|
||||
|
||||
* elfxx-aarch64.c (_bfd_aarch64_elf_link_setup_gnu_properties): Set
|
||||
|
86
bfd/elf.c
86
bfd/elf.c
@ -9236,6 +9236,23 @@ _bfd_elfcore_make_pseudosection (bfd *abfd,
|
||||
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
|
||||
@ -10177,18 +10194,7 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
|
||||
#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",
|
||||
@ -10434,18 +10440,7 @@ elfcore_grok_freebsd_note (bfd *abfd, Elf_Internal_Note *note)
|
||||
note);
|
||||
|
||||
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)
|
||||
@ -10509,17 +10504,24 @@ elfcore_grok_netbsd_note (bfd *abfd, Elf_Internal_Note *note)
|
||||
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);
|
||||
#ifdef NT_NETBSDCORE_AUXV
|
||||
case NT_NETBSDCORE_AUXV:
|
||||
/* NetBSD-specific Elf Auxiliary Vector data. */
|
||||
return elfcore_make_auxv_note_section (abfd, note, 4);
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* As of Jan 2002 there are no other machine-independent notes
|
||||
/* 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. */
|
||||
@ -10547,6 +10549,23 @@ elfcore_grok_netbsd_note (bfd *abfd, Elf_Internal_Note *note)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* On SuperH, PT_GETREGS == mach+3 and PT_GETFPREGS == mach+5.
|
||||
There's also old PT___GETREGS40 == mach + 1 for old reg
|
||||
structure which lacks GBR. */
|
||||
|
||||
case bfd_arch_sh:
|
||||
switch (note->type)
|
||||
{
|
||||
case NT_NETBSDCORE_FIRSTMACH+3:
|
||||
return elfcore_make_note_pseudosection (abfd, ".reg", note);
|
||||
|
||||
case NT_NETBSDCORE_FIRSTMACH+5:
|
||||
return elfcore_make_note_pseudosection (abfd, ".reg2", note);
|
||||
|
||||
default:
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* On all other arch's, PT_GETREGS == mach+1 and
|
||||
PT_GETFPREGS == mach+3. */
|
||||
|
||||
@ -10603,18 +10622,7 @@ elfcore_grok_openbsd_note (bfd *abfd, Elf_Internal_Note *note)
|
||||
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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user