https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88627

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |MOVED

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
for binutils bfd based ld : bfd/elf.c has:
      /* If we have a .interp section, then create a PT_PHDR segment for
         the program headers and a PT_INTERP segment for the .interp
         section.  */
      s = bfd_get_section_by_name (abfd, ".interp");
...


gold has this (so that might be an issue):
  if (!parameters->options().relocatable() && !parameters->doing_static_link())
    {
      // There was a dynamic object in the link.  We need to create
      // some information for the dynamic linker.

      // Create the PT_PHDR segment which will hold the program
      // headers.
      if (!this->script_options_->saw_phdrs_clause())
        phdr_seg = this->make_output_segment(elfcpp::PT_PHDR, elfcpp::PF_R);


--- CUT ---
  // Now we have seen all the input files.
  const bool doing_static_link =
    (!input_objects->any_dynamic()
     && !parameters->options().output_is_position_independent());
  set_parameters_doing_static_link(doing_static_link);

Hmm, so gold is broken.  It only creates a PT_PHDR segment when there are
shared libraries present or the output is a (static) pie executable.

Please report it to binutils that gold does not add a PT_PHDR when
.interp/PT_INTERP exists but no shared library.

Reply via email to