This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: The difference in behavior between ld and gold when processing "start group/end group" option


Your reply made things clear for me. Thank you.

Best regards,
            Nikola

-------- Original Message --------
Subject: Re: The difference in behavior between ld and gold when processing "start group/end group" option
Date: Wednesday, March 4, 2015 19:47 CET
From: Cary Coutant <ccoutant@google.com>
To: Nikola Ikonic <Nikola.Ikonic@rt-rk.com>, Binutils <binutils@sourceware.org>, Petar Jovanovic <Petar.Jovanovic@rt-rk.com>
References: <626f-54f5ed00-13-159dfd60@105572234><20150303231626.GA26435@bubble.grove.modra.org>



> Gold flattens the nested groups, by design:
>
> // Called by the bison parser to start a group.  If we are already in
> // a group, that means that this script was invoked within a
> // --start-group --end-group sequence on the command line, or that
> // this script was found in a GROUP of another script.  In that case,
> // we simply continue the existing group, rather than starting a new
> // one.  It is possible to construct a case in which this will do
> // something other than what would happen if we did a recursive group,
> // but it's hard to imagine why the different behaviour would be
> // useful for a real program.  Avoiding recursive groups is simpler
> // and more efficient.
>
> If you try to nest a --start-group option within another, you'll get
> an error, but if you use a script with a GROUP inside a --start-group,
> we simply flatten it.
>
> How much sympathy I have for builds that break because of this: none, sorry.
>
> -cary
>
>
> On Tue, Mar 3, 2015 at 3:16 PM, Alan Modra <amodra@gmail.com> wrote:
> > On Tue, Mar 03, 2015 at 06:19:45PM +0100, Nikola Ikonic wrote:
> >> Which of these linkers behave correctly?
> >
> > I would say, GNU ld.  The innermost group ought to be repeatedly
> > searched until no new objects are extracted from libraries, before
> > looking at any other input files.  GROUP ( libtest2.a libdummy.a )
> > ought to cause head_dummy.o to be extracted from libdummy.a then
> > test2.o from libtest2.a, before the linker considers libtest.a.
> >
> > --
> > Alan Modra
> > Australia Development Lab, IBM





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]