diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/elf32-or1k.c | 55 |
2 files changed, 60 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 1e82b93..85277a1 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2018-12-08 Stafford Horne <shorne@gmail.com> + + * elf32-or1k.c (or1k_grok_prstatus): New function. + (or1k_grok_psinfo): Likewise. + 2018-12-07 H.J. Lu <hongjiu.lu@intel.com> * elf-properties.c (elf_find_and_remove_property): Add a diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c index a2b0ff1..8edd758 100644 --- a/bfd/elf32-or1k.c +++ b/bfd/elf32-or1k.c @@ -3226,6 +3226,58 @@ elf32_or1k_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) } +/* Implement elf_backend_grok_prstatus: + Support for core dump NOTE sections. */ +static bfd_boolean +or1k_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) +{ + int offset; + size_t size; + + switch (note->descsz) + { + default: + return FALSE; + + case 212: /* Linux/OpenRISC */ + /* pr_cursig */ + elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12); + + /* pr_pid */ + elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 24); + + /* pr_reg */ + offset = 72; + size = 132; + + break; + } + + /* Make a ".reg/999" section. */ + return _bfd_elfcore_make_pseudosection (abfd, ".reg", + size, note->descpos + offset); +} + +/* Implement elf_backend_grok_psinfo. */ +static bfd_boolean +or1k_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) +{ + switch (note->descsz) + { + default: + return FALSE; + + case 128: /* Linux/OpenRISC elf_prpsinfo */ + elf_tdata (abfd)->core->program + = _bfd_elfcore_strndup (abfd, note->descdata + 32, 16); + elf_tdata (abfd)->core->command + = _bfd_elfcore_strndup (abfd, note->descdata + 48, 80); + } + + return TRUE; +} + + #define ELF_ARCH bfd_arch_or1k #define ELF_MACHINE_CODE EM_OR1K #define ELF_TARGET_ID OR1K_ELF_DATA @@ -3269,4 +3321,7 @@ elf32_or1k_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) #define elf_backend_adjust_dynamic_symbol or1k_elf_adjust_dynamic_symbol #define elf_backend_finish_dynamic_symbol or1k_elf_finish_dynamic_symbol +#define elf_backend_grok_prstatus or1k_grok_prstatus +#define elf_backend_grok_psinfo or1k_grok_psinfo + #include "elf32-target.h" |