[PATCH u-boot v4 13/36] build: use thin archives instead of incremental linking

Tom Rini trini at konsulko.com
Tue May 25 02:55:26 CEST 2021


On Thu, May 20, 2021 at 01:24:02PM +0200, Marek Behún wrote:

> Currently we use incremental linking (ld -r) to link several object
> files from one directory into one built-in.o object file containing the
> linked code from that directory (and its subdirectories).
> 
> Linux has, some time ago, moved to thin archives instead.
> 
> Thin archives are archives (.a) that do not really contain the object
> files, only references to them.
> 
> Using thin archives instead of incremental linking
> - saves disk space
> - apparently works better with dead code elimination
> - makes things easier for LTO
> 
> The third point is the important one for us. With incremental linking
> there are several options how to do LTO, and that would unnecessarily
> complicate things.
> 
> We have to use the --whole-archive/--no-whole-archive linking option
> instead of --start-group/--end-group, otherwise linking may fail because
> of unresolved symbols, or the resulting binary will be unusable.
> 
> We also need to use the P flag for ar, otherwise final linking may fail.
> 
> Signed-off-by: Marek Behún <marek.behun at nic.cz>
> Reviewed-by: Simon Glass <sjg at chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210524/4de7a1cd/attachment.sig>


More information about the U-Boot mailing list