Message ID | 20210307042538.21229-19-marek.behun@nic.cz |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show |
Series | U-Boot LTO (Sandbox + Some ARM boards) | expand |
On Sun, Mar 7, 2021 at 12:26 PM Marek Behún <marek.behun@nic.cz> wrote: > > When building with LTO, move $(PLATFORM_LIBS) into the --start-group / > --end-group list. This should be --whole-archive > Otherwise some functions declared in assembly may not be resolved and > linking may fail. I am not sure if this is caused by we build these lib functions with -flto? > > Signed-off-by: Marek Behún <marek.behun@nic.cz> > --- > Makefile | 3 ++- > scripts/Makefile.spl | 3 ++- > 2 files changed, 4 insertions(+), 2 deletions(-) > Regards, Bin
On Tue, 9 Mar 2021 23:24:01 +0800 Bin Meng <bmeng.cn@gmail.com> wrote: > On Sun, Mar 7, 2021 at 12:26 PM Marek Behún <marek.behun@nic.cz> wrote: > > > > When building with LTO, move $(PLATFORM_LIBS) into the --start-group / > > --end-group list. > > This should be --whole-archive > > > Otherwise some functions declared in assembly may not be resolved and > > linking may fail. > > I am not sure if this is caused by we build these lib functions with -flto? It is caused by using thin archives, not LTO
diff --git a/Makefile b/Makefile index 4eee0c4196..0f538270d7 100644 --- a/Makefile +++ b/Makefile @@ -1782,8 +1782,9 @@ quiet_cmd_u-boot__ ?= LTO $@ -T u-boot.lds $(u-boot-init) \ -Wl,--start-group -Wl,--whole-archive \ $(u-boot-main) \ + $(PLATFORM_LIBS) \ -Wl,--no-whole-archive -Wl,--end-group \ - $(PLATFORM_LIBS) -Wl,-Map,u-boot.map; \ + -Wl,-Map,u-boot.map; \ $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) else quiet_cmd_u-boot__ ?= LD $@ diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index 6da5883442..d89917ca8e 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -428,8 +428,9 @@ quiet_cmd_u-boot-spl ?= LTO $@ -Wl,--start-group -Wl,--whole-archive \ $(patsubst $(obj)/%,%,$(u-boot-spl-main)) \ $(patsubst $(obj)/%,%,$(u-boot-spl-platdata)) \ + $(PLATFORM_LIBS) \ -Wl,--no-whole-archive -Wl,--end-group \ - $(PLATFORM_LIBS) -Wl,-Map,$(SPL_BIN).map -o $(SPL_BIN) \ + -Wl,-Map,$(SPL_BIN).map -o $(SPL_BIN) \ ) else quiet_cmd_u-boot-spl ?= LD $@
When building with LTO, move $(PLATFORM_LIBS) into the --start-group / --end-group list. Otherwise some functions declared in assembly may not be resolved and linking may fail. Signed-off-by: Marek Behún <marek.behun@nic.cz> --- Makefile | 3 ++- scripts/Makefile.spl | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)