u-boot-brain/arch
Marek Behún 958f2e57ef build: use thin archives instead of incremental linking
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@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-05-24 14:21:30 -04:00
..
arc lmb: move CONFIG_LMB in Kconfig 2021-04-22 14:09:45 -04:00
arm treewide: Convert macro and uses of __section(foo) to __section("foo") 2021-05-24 14:21:30 -04:00
m68k allow opting out of WATCHDOG_RESET() from timer interrupt 2021-04-28 10:05:13 +02:00
microblaze lmb: move CONFIG_LMB in Kconfig 2021-04-22 14:09:45 -04:00
mips treewide: Convert macro and uses of __section(foo) to __section("foo") 2021-05-24 14:21:30 -04:00
nds32 treewide: Convert macro and uses of __section(foo) to __section("foo") 2021-05-24 14:21:30 -04:00
nios2 common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
powerpc treewide: Convert macro and uses of __section(foo) to __section("foo") 2021-05-24 14:21:30 -04:00
riscv treewide: Convert macro and uses of __section(foo) to __section("foo") 2021-05-24 14:21:30 -04:00
sandbox build: use thin archives instead of incremental linking 2021-05-24 14:21:30 -04:00
sh lmb: move CONFIG_LMB in Kconfig 2021-04-22 14:09:45 -04:00
x86 treewide: Convert macro and uses of __section(foo) to __section("foo") 2021-05-24 14:21:30 -04:00
xtensa treewide: Convert macro and uses of __section(foo) to __section("foo") 2021-05-24 14:21:30 -04:00
.gitignore
Kconfig pytest: add sandbox test for "extension" command 2021-05-13 13:09:09 -04:00
u-boot-elf.lds arch: Add explicit linker script for u-boot-elf 2020-04-03 11:52:55 -04:00