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.
+2019-12-13 Alan Modra <amodra@gmail.com>
+
+ 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.
+
2019-12-12 Alan Modra <amodra@gmail.com>
* libbfd.c (bfd_get): Don't cast result of bfd_get_8.
|| (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;