This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [RFC PATCH] Enabling ld -r ELF .stab/.stabstr optimization
- From: Ian Lance Taylor <ian at airs dot com>
- To: Alan Modra <amodra at bigpond dot net dot au>
- Cc: Earl Chew <earl_chew at agilent dot com>, binutils at sources dot redhat dot com
- Date: 01 Oct 2002 08:38:01 -0700
- Subject: Re: [RFC PATCH] Enabling ld -r ELF .stab/.stabstr optimization
- References: <3D929521.60708@agilent.com><20021001173650.O25369@bubble.sa.bigpond.net.au>
Alan Modra <amodra@bigpond.net.au> writes:
> On Wed, Sep 25, 2002 at 10:03:29PM -0700, Earl Chew wrote:
> > Here is a patch to enable .stab/.stabstr optimization in the presence
> > of ld -r. This patch was generated against binutils-2.10.1 --- sorry
> > the baseline is a little dated, but that's what I'm running.
> >
> > * bfd/elflink.h (elf_link_add_object_symbols): optimize .stabstr
> > even if relocatable
> > * ld/ldlang.c (wild_doit): discard debugging sections that have
> > been marked SEC_EXCLUDE
>
> I'm a little nervous about this change, although I haven't thought of
> any particular problem. Suggestion: Modify ld so that -r sets
> link_info.traditional_format, and implement a -fno-traditional-format
> option. That way "ld -r" behaviour is unchanged unless you write
> "ld -r -fno-traditional-format". Oh, and cofflink.c should have a
> similar change to your elflink.h change.
I think that having -r imply -ftraditional-format would have other
unexpected effects. --traditional-format implies more things than
just optimizing .stabs sections.
Having -r optimize stabs sections will work poorly if the resulting
object is indeed linked with other objects, as opportunities for
optimizing stabs in the resulting executable between different -r
objects will be lost. This will hurt a certain style of building
large programs, in which each directory contributes a single .o file
built using -r.
Therefore I believe we do need a new option here, but I don't think it
should be related to --traditional-format. Instead, we need something
horrible like --optimize-stabs (the default for a final link) and
--no-optimize-stabs (the default for a relocateable link). Then
--traditional-format should imply --no-optimize-stabs.
Ian