This is the mail archive of the
mailing list for the binutils project.
Re: [binutils-gdb] Fix the linker so that it will not silently generate ELF binaries with invalid program headers. Fix
- From: Nick Clifton <nickc at redhat dot com>
- To: Alan Modra <amodra at gmail dot com>, "Maciej W. Rozycki" <macro at imgtec dot com>
- Cc: Nick Clifton <nickc at sourceware dot org>, binutils at sourceware dot org
- Date: Thu, 8 Dec 2016 12:14:49 +0000
- Subject: Re: [binutils-gdb] Fix the linker so that it will not silently generate ELF binaries with invalid program headers. Fix
- Authentication-results: sourceware.org; auth=none
- References: <email@example.com> <alpine.DEB.firstname.lastname@example.org> <20161208113238.GF10584@bubble.grove.modra.org>
> I think an equally valid and somewhat better fix would have been to not
> emit PT_PHDR when no PT_LOAD header covers the program headers. The
> reason I say that is because PT_PHDR is optional. A loader can read
> the program headers itself from file using info in the ELF header.
That would be nicer, but there is explicit code in _bfd_elf_map_sections_to_segments()
to create a PHDR segment whenever we create an INTERP segment. I assumed
that this was a requirement and hence could not be dropped. (I did not
explore why this was needed, I just assumed that I would break something,
probably the kernel, if I dropped the requirement).