[binutils-gdb] Fix the linker so that it will not silently generate ELF binaries with invalid program headers. Fix

Nick Clifton nickc@redhat.com
Thu Dec 8 12:14:00 GMT 2016


Hi Alan,

> 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).

Cheers
  Nick



More information about the Binutils mailing list