This is the mail archive of the
mailing list for the binutils project.
Re: The difference in behavior between ld and gold when processing "start group/end group" option
- From: "Nikola Ikonic" <Nikola dot Ikonic at rt-rk dot com>
- To: "Cary Coutant" <ccoutant at google dot com>, binutils at sourceware dot org
- Date: Thu, 05 Mar 2015 19:21:14 +0100
- Subject: Re: The difference in behavior between ld and gold when processing "start group/end group" option
- Authentication-results: sourceware.org; auth=none
Your reply made things clear for me. Thank you.
-------- 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 <email@example.com>
To: Nikola Ikonic <Nikola.Ikonic@rt-rk.com>, Binutils <firstname.lastname@example.org>, Petar Jovanovic <Petar.Jovanovic@rt-rk.com>
> 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.
> On Tue, Mar 3, 2015 at 3:16 PM, Alan Modra <email@example.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