+2020-01-23 Alan Modra <amodra@gmail.com>
+
+ PR 25444
+ * elf.c (assign_file_positions_for_load_sections): Avoid divide
+ by zero when p_align is zero.
+
2020-01-22 Maxim Blinov <maxim.blinov@embecosm.com>
* bfd/elfnn-riscv.c (riscv_skip_prefix): New.
{
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);
+ {
+ /* Put meaningless p_offset for PT_LOAD segments
+ without file contents somewhere within the first
+ page, in an attempt to not point past EOF. */
+ bfd_size_type align = maxpagesize;
+ if (align < p->p_align)
+ align = p->p_align;
+ if (align < 1)
+ align = 1;
+ p->p_offset = off % align;
+ }
}
else
{