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

--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
Thanks for the detailed analysis.  Indeed

  /* Mark sections as preserved that are required by to be preserved
     sections.  */
  for (i = 1; i < shnum; ++i)
    {
...
      if (sh_type == SHT_SYMTAB)
        {
          /* Mark strings sections of copied symtabs.  */
          if (pfnret[i - 1] == 0)
            pfnret[sh_link - 1] = 0;
        }
    }

so it conditionally preserves sh_link of SHT_SYMTAB.

I think we need to iterate this loop.  And maybe always preserve the symtab
since we keep exported symbols of preserved sections, we're currently lucky
here because .debug_info always contains a relocation to .debug_abbrev.
Probably good enough...

Reply via email to