summaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-05-21 00:56:00 +0000
committerRoland McGrath <roland@gnu.org>2003-05-21 00:56:00 +0000
commitb839f0f0f960a704184ba4b84e2b560d3870c9cd (patch)
treeb60d7175ea15926f316a47b1fc913c869af5ac5e /bfd/elf.c
parent4568c9994ea8a181d7adc1224a791af08603c25b (diff)
downloadgdb-b839f0f0f960a704184ba4b84e2b560d3870c9cd.tar.gz
2003-05-19 Roland McGrath <roland@redhat.com>
* elf.c (bfd_elf_bfd_from_remote_memory): New function. * bfd-in.h: Declare it. * elfcode.h (NAME(_bfd_elf,bfd_from_remote_memory)): New function. * elf-bfd.h (struct elf_backend_data): New function pointer member elf_backend_bfd_from_remote_memory. (_bfd_elf32_bfd_from_remote_memory, _bfd_elf64_bfd_from_remote_memory): Declare them. * elfxx-target.h (elf_backend_bfd_from_remote_memory): New macro. (elfNN_bed): Add that to the initializer. 2003-05-15 Roland McGrath <roland@redhat.com> * elf.c (elfcore_grok_note): Grok NT_AUXV note, make ".auxv" section.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index fa4416d0b60..5e72eb05bf5 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -6884,6 +6884,20 @@ elfcore_grok_note (abfd, note)
#else
return TRUE;
#endif
+
+ case NT_AUXV:
+ {
+ asection *sect = bfd_make_section (abfd, ".auxv");
+
+ if (sect == NULL)
+ return FALSE;
+ sect->_raw_size = note->descsz;
+ sect->filepos = note->descpos;
+ sect->flags = SEC_HAS_CONTENTS;
+ sect->alignment_power = 1 + bfd_get_arch_size (abfd) / 32;
+
+ return TRUE;
+ }
}
}
@@ -7535,3 +7549,27 @@ _bfd_elf_section_offset (abfd, info, sec, offset)
return offset;
}
}
+
+/* Create a new BFD as if by bfd_openr. Rather than opening a file,
+ reconstruct an ELF file by reading the segments out of remote memory
+ based on the ELF file header at EHDR_VMA and the ELF program headers it
+ points to. If not null, *LOADBASEP is filled in with the difference
+ between the VMAs from which the segments were read, and the VMAs the
+ file headers (and hence BFD's idea of each section's VMA) put them at.
+
+ The function TARGET_READ_MEMORY is called to copy LEN bytes from the
+ remote memory at target address VMA into the local buffer at MYADDR; it
+ should return zero on success or an `errno' code on failure. TEMPL must
+ be a BFD for an ELF target with the word size and byte order found in
+ the remote memory. */
+
+bfd *
+bfd_elf_bfd_from_remote_memory (templ, ehdr_vma, loadbasep, target_read_memory)
+ bfd *templ;
+ bfd_vma ehdr_vma;
+ bfd_vma *loadbasep;
+ int (*target_read_memory) PARAMS ((bfd_vma vma, char *myaddr, int len));
+{
+ return (*get_elf_backend_data (templ)->elf_backend_bfd_from_remote_memory)
+ (templ, ehdr_vma, loadbasep, target_read_memory);
+}