aboutsummaryrefslogtreecommitdiff
path: root/bfd/bfd-in2.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-04-02 12:07:33 +1030
committerAlan Modra <amodra@gmail.com>2014-04-02 12:07:33 +1030
commit5979d6b69b20a8355ea94b75fad97415fce4788c (patch)
tree896462cf9849c42674901897808ad7c4108cd759 /bfd/bfd-in2.h
parentcf2a3e990524cb794c75e0493169736dee6a660c (diff)
downloadgdb-5979d6b69b20a8355ea94b75fad97415fce4788c.zip
gdb-5979d6b69b20a8355ea94b75fad97415fce4788c.tar.gz
gdb-5979d6b69b20a8355ea94b75fad97415fce4788c.tar.bz2
Handle VDSO section headers past end of page
When a VDSO gets large enough that it doesn't entirely fit in one page, but not so large that the part described by the program header exceeds one page, then gdb/BFD doesn't read the section headers and symbol table information. This patch cures that by passing the size of the vdso to BFD, and fixes a number of other issues in the BFD code. bfd/ * elfcode.h (bfd_from_remote_memory): Add "size" parameter. Consolidate code handling possible section headers past end of segment. Don't use p_align for page size guess, instead use minpagesize. Take note of ld.so clearing section headers when p_memsz > p_filesz. Handle file header specifying no section headers. Handle zero p_align throughout. Default loadbase to zero. Add comments. Rename contents_size to high_offset, and make it a bfd_vma. Delete unnecessary bfd_set_error calls. * bfd-in.h (bfd_elf_bfd_from_remote_memory): Update prototpe. * elf-bfd.h (struct elf_backend_data <elf_backend_from_remote_memory>): Likewise. (_bfd_elf32_bfd_from_remote_memory): Likewise. (_bfd_elf64_bfd_from_remote_memory): Likewise. * elf.c (bfd_elf_bfd_from_remote_memory): Adjust. * bfd-in2.h: Regnerate. gdb/ * symfile-mem.c (symbol_file_add_from_memory): Add size parameter. Pass to bfd_elf_bfd_from_remote_memory. Adjust all callers. (struct symbol_file_add_from_memory_args): Add size field. (find_vdso_size): New function. (add_vsyscall_page): Attempt to find vdso size.
Diffstat (limited to 'bfd/bfd-in2.h')
-rw-r--r--bfd/bfd-in2.h26
1 files changed, 14 insertions, 12 deletions
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index f08b578..8cfae51 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -687,19 +687,21 @@ extern int bfd_get_elf_phdrs
(bfd *abfd, void *phdrs);
/* 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. */
+ 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 non-zero, SIZE is the known extent of the
+ object. 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 a target with the word size and
+ byte order found in the remote memory. */
extern bfd *bfd_elf_bfd_from_remote_memory
- (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
+ (bfd *templ, bfd_vma ehdr_vma, size_t size, bfd_vma *loadbasep,
int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr,
bfd_size_type len));