aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2003-10-29 13:06:06 +0000
committerAlan Modra <amodra@gmail.com>2003-10-29 13:06:06 +0000
commitd37c89e56f2026dc78241aaef59fc25e33c413fa (patch)
tree2393c21ac3bfad3bf40cd1a05901781c17496ba0 /bfd/elf64-ppc.c
parent62f3bb11d41badd612de87166d7916729e875e04 (diff)
downloadgdb-d37c89e56f2026dc78241aaef59fc25e33c413fa.zip
gdb-d37c89e56f2026dc78241aaef59fc25e33c413fa.tar.gz
gdb-d37c89e56f2026dc78241aaef59fc25e33c413fa.tar.bz2
* elf64-ppc.c (elf_backend_grok_prstatus): Define.
(elf_backend_grok_psinfo): Define. (ppc64_elf_grok_prstatus, ppc64_elf_grok_psinfo): New functions.
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r--bfd/elf64-ppc.c46
1 files changed, 44 insertions, 2 deletions
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;