diff options
author | Alan Modra <amodra@gmail.com> | 2019-12-13 16:14:57 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2019-12-13 21:23:15 +1030 |
commit | 0bc3450e220a4fb29f931ada84b546ce8993e85e (patch) | |
tree | fa87940fb2889586fdedaf475172f47bb12a2529 /bfd/elf.c | |
parent | c7ff3609c188d15692b5db53d4292fbabce8171a (diff) | |
download | gdb-0bc3450e220a4fb29f931ada84b546ce8993e85e.zip gdb-0bc3450e220a4fb29f931ada84b546ce8993e85e.tar.gz gdb-0bc3450e220a4fb29f931ada84b546ce8993e85e.tar.bz2 |
Set no file contents PT_LOAD p_offset to first page
PR 25237
* elf.c (assign_file_positions_for_load_sections): Attempt to
keep meaningless p_offset for PT_LOAD segments without file
contents within file size.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -5752,7 +5752,15 @@ assign_file_positions_for_load_sections (bfd *abfd, || (p->p_type == PT_NOTE && bfd_get_format (abfd) == bfd_core)) { if (!m->includes_filehdr && !m->includes_phdrs) - p->p_offset = off; + { + p->p_offset = off; + if (no_contents) + /* Put meaningless p_offset for PT_LOAD segments + without file contents somewhere within the first + page, in an attempt to not point past EOF. */ + p->p_offset = off % (p->p_align > maxpagesize + ? p->p_align : maxpagesize); + } else { file_ptr adjust; |