objcopy/strip of IR files and is_strip_input

Alan Modra amodra@gmail.com
Tue Aug 12 06:11:02 GMT 2025


On Mon, Aug 11, 2025 at 06:11:42PM -0700, H.J. Lu wrote:
> On Mon, Aug 11, 2025 at 5:39 PM Alan Modra <amodra@gmail.com> wrote:
> > Yes, I can see your comment are with commit c2729c37f10a
> >   /* NB: Must keep .gnu.debuglto_* sections unless all GCC LTO sections
> >      will be removed to avoid undefined references to symbols in GCC LTO
> >      debug sections.  */
> >   if (!lto_sections_removed)
> >     find_section_list (".gnu.debuglto_*", true, SECTION_CONTEXT_KEEP);
> >
> > That doesn't make a great deal of sense to me.  Usually it is the
> > other way around.  ie. symbols in a non-debug section are referenced
> > by a debug section.  What symbols are being referenced in the
> > .gnu.debuglto sections and from where?
> 
> There are cross references between GCC code IR and GCC debug IR.
> If GCC debug IR is removed while GCC code IR is kept, we get undefined
> references to debug IR from code IR.

Isn't that a gcc bug?  Particularly since older versions of strip and
objcopy will remove .gnu.debuglto_.debug_* with --strip-debug.

-- 
Alan Modra


More information about the Binutils mailing list