mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 01:24:27 +00:00
fix(build): enforce single partition for LTO build
For example, build for PLAT=fvp SPD=spmd fails with a following error when LTO is enabled using GCC 13.2.1: aarch64-none-elf/bin/ld: /tmp/ccrG0Z8D.ltrans0.ltrans.o: in function `spmd_smc_forward': arm-trusted-firmware/services/std_svc/spmd/spmd_main.c:749:(.text+0xbe50): undefined reference to `rdist_ctx' aarch64-none-elf/bin/ld: arm-trusted-firmware/services/std_svc/spmd/spmd_main.c:749:(.text+0xbe58): undefined reference to `dist_ctx' collect2: error: ld returned 1 exit status Access to rdist_ctx and dist_ctx is defined using inline assembler like __asm__ volatile ("ldr %0, =rdist_ctx" : "=r" (v) : "X" (rdist_ctx)); Access assembler function definitions moved to a different ltrans then actual variables. Partitioner doesn't take into account defined and used symbols in inline assembler. Depending on compiler partitioner decision the same code builds for some platforms successfully. This is a known gcc problem 1. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57703 2. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46820 TF-A source code isn't that big and enforcing single partitioning will not affect build performance, but will fix problems with 'undefined references' related to inline assembler. Change-Id: I72955ab0318f72b588d3a246824f99a48a92d8ef Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
This commit is contained in:
parent
e5e9ccdb0c
commit
31f80efeef
1 changed files with 1 additions and 0 deletions
1
Makefile
1
Makefile
|
@ -325,6 +325,7 @@ else ifeq ($($(ARCH)-ld-id),gnu-gcc)
|
|||
ifeq ($(ENABLE_LTO),1)
|
||||
ifeq (${ARCH},aarch64)
|
||||
TF_LDFLAGS += -flto -fuse-linker-plugin
|
||||
TF_LDFLAGS += -flto-partition=one
|
||||
endif
|
||||
endif #(ENABLE_LTO)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue