diff options
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 86 |
1 files changed, 47 insertions, 39 deletions
@@ -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) { |