[PATCH] elf: Try not pointing empty PT_LOAD segment's offset past EOF
Alan Modra
amodra@gmail.com
Sun Dec 8 02:12:00 GMT 2019
On Sat, Dec 07, 2019 at 05:22:13PM +0100, Bálint Réczey wrote:
> diff --git a/bfd/elf.c b/bfd/elf.c
> index 1aa2603ee8..e1a9a02eec 100644
> --- a/bfd/elf.c
> +++ b/bfd/elf.c
> @@ -5752,7 +5752,12 @@ 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;
> + if (no_contents)
> + /* Try avoiding pointing past the EOF with this empty segment's
> + p_offset. */
> + p->p_offset = p->p_offset % maxpagesize;
> + else
> + p->p_offset = off;
> else
> {
> file_ptr adjust;
How did you test this patch? I suspect you are just leaving p_offset
at zero and therefore will cause failures on glibc systems.
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list