diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 4 | ||||
-rw-r--r-- | bfd/elf64-ppc.c | 46 |
2 files changed, 48 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bd4b4f2..8c39564 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,9 @@ 2003-10-29 Alan Modra <amodra@bigpond.net.au> + * elf64-ppc.c (elf_backend_grok_prstatus): Define. + (elf_backend_grok_psinfo): Define. + (ppc64_elf_grok_prstatus, ppc64_elf_grok_psinfo): New functions. + * elf.c (_bfd_elfcore_make_pseudosection): Allow multiple sections with the same name. (elfcore_grok_lwpstatus): Likewise. diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 564a616..283f633 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -2,6 +2,7 @@ Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. Written by Linus Nordberg, Swox AB <info@swox.com>, based on elf32-ppc.c by Ian Lance Taylor. + Largely rewritten by Alan Modra <amodra@bigpond.net.au> This file is part of BFD, the Binary File Descriptor library. @@ -77,6 +78,8 @@ static bfd_reloc_status_type ppc64_elf_unhandled_reloc #define bfd_elf64_bfd_link_hash_table_free ppc64_elf_link_hash_table_free #define elf_backend_object_p ppc64_elf_object_p +#define elf_backend_grok_prstatus ppc64_elf_grok_prstatus +#define elf_backend_grok_psinfo ppc64_elf_grok_psinfo #define elf_backend_create_dynamic_sections ppc64_elf_create_dynamic_sections #define elf_backend_copy_indirect_symbol ppc64_elf_copy_indirect_symbol #define elf_backend_check_relocs ppc64_elf_check_relocs @@ -2372,6 +2375,45 @@ ppc64_elf_object_p (bfd *abfd) return TRUE; } +/* Support for core dump NOTE sections. */ + +static bfd_boolean +ppc64_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) +{ + size_t offset, raw_size; + + if (note->descsz != 504) + return FALSE; + + /* 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 + 32); + + /* pr_reg */ + offset = 112; + raw_size = 384; + + /* Make a ".reg/999" section. */ + return _bfd_elfcore_make_pseudosection (abfd, ".reg", + raw_size, note->descpos + offset); +} + +static bfd_boolean +ppc64_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) +{ + if (note->descsz != 136) + return FALSE; + + elf_tdata (abfd)->core_program + = _bfd_elfcore_strndup (abfd, note->descdata + 40, 16); + elf_tdata (abfd)->core_command + = _bfd_elfcore_strndup (abfd, note->descdata + 56, 80); + + return TRUE; +} + /* Merge backend specific data from an object file to the output object file when linking. */ @@ -5012,7 +5054,7 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) r_symndx = ELF64_R_SYM (rel->r_info); if (!get_sym_h (&h, &sym, &sym_sec, NULL, &local_syms, - r_symndx, ibfd)) + r_symndx, ibfd)) goto error_ret; if (rel->r_offset == offset) @@ -5088,7 +5130,7 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) { p->count -= 1; if (p->count == 0) - *pp = p->next; + *pp = p->next; break; } pp = &p->next; |