From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Behun Date: Sat, 6 Mar 2021 22:20:26 +0100 Subject: [RFC PATCH u-boot 01/12] build: use thin archives instead of incremental linking In-Reply-To: <20210305133728.GX1310@bill-the-cat> References: <20210303041211.26945-1-marek.behun@nic.cz> <20210303041211.26945-2-marek.behun@nic.cz> <20210304191701.1c8c4052@nic.cz> <20210305133728.GX1310@bill-the-cat> Message-ID: <20210306222026.439ab7e1@nic.cz> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Fri, 5 Mar 2021 08:37:28 -0500 Tom Rini wrote: > On Fri, Mar 05, 2021 at 09:34:42PM +0800, Bin Meng wrote: > > Hi Marek, > > > > On Fri, Mar 5, 2021 at 2:17 AM Marek Behun wrote: > > > > > > On Thu, 4 Mar 2021 18:57:11 +0800 > > > Bin Meng wrote: > > > > > > > Hi Marek, > > > > > > > > On Wed, Mar 3, 2021 at 12:13 PM Marek Beh?n wrote: > > > > > > > > > > Using thin archives instead of incremental linking > > > > > - saves disk space > > > > > - works better with dead code elimination > > > > > - prepares for potential LTO > > > > > > > > The commit message is a little bit confusing. This commit actually > > > > does 2 things: don't do incremental linking (using --whole-archive), > > > > and use thin archive (passing T to ar). I believe they are for > > > > different purposes, so we cannot say "using thin archives instead of > > > > incremental linking". > > > > > - -Wl,--start-group $(patsubst $(obj)/%,%,$(u-boot-spl-main)) \ > > > > > - $(patsubst $(obj)/%,%,$(u-boot-spl-platdata)) -Wl,--end-group \ > > > > > + -Wl,--whole-archive $(patsubst $(obj)/%,%,$(u-boot-spl-main)) -Wl,--no-whole-archive \ > > > > > + -Wl,--start-group $(patsubst $(obj)/%,%,$(u-boot-spl-platdata)) -Wl,--end-group \ > > > > > > > > u-boot-spl-platdata is still within --start-group, --end-group, is > > > > this intentional? > > > > > > I confess that I did not really study these options, I have made these > > > changes according to old LTO patches for Linux. But you are right that > > > it does not make sense. I have fixed this for the next version of this > > > patch. > > > > > > > Is P required to make everything work? > > > > > > It is not. Removed in next version. > > > > I did more investigation on this. > > > > The Linux kernel specially added P to ar, in below commit: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9a6cfca4f4130444 > > > > So it looks like we should keep P here? > > > > But I don't get the point of switching to thin archives. Based on my > > experiment, LTO does not rely on thin archives. The Linux kernel did > > not introduce thin archives for LTO. > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a5967db9af51a84f > > So technically it would just be part of dealing with the backlog of > kbuild-resync to take it in this series I guess. > It seems the P flag is needed for ar, otherwise final linking may fail, for example for nokia rx51. Since Linux uses this as well I am just gonna put it there.