summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann Gautier <yann.gautier@st.com>2026-06-24 19:54:14 +0200
committerYann Gautier <yann.gautier@st.com>2026-09-07 13:41:30 +0200
commit77f2dfc38a9d26809c0656e726d2e7511a5de559 (patch)
treee7c6a17941cc4fd9714890d058c3d9ba2f49a053
parentc2086457307204726be11ab4cbe55cb5013ea569 (diff)
downloadarm-trusted-firmware-77f2dfc38a9d26809c0656e726d2e7511a5de559.tar.gz
arm-trusted-firmware-77f2dfc38a9d26809c0656e726d2e7511a5de559.zip
refactor(compiler-rt): move compiler_rt to a lib
This allows a dedicated build, and avoid BL_FLAGS compilation flags. The code size does not increase, it has been checked on ST platforms: STM32MP13 and STM32MP25. Change-Id: I5ff3c40222770400a97dd4d451aeebc26fef4f2a Signed-off-by: Yann Gautier <yann.gautier@st.com>
-rw-r--r--Makefile11
-rw-r--r--lib/compiler-rt/compiler-rt.mk6
2 files changed, 11 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index d8fdad14f..67defe4d1 100644
--- a/Makefile
+++ b/Makefile
@@ -169,8 +169,6 @@ endif
################################################################################
# Common sources and include directories
################################################################################
-include lib/compiler-rt/compiler-rt.mk
-
# Allow overriding the timestamp, for example for reproducible builds, or to
# synchronize timestamps across multiple projects.
# This must be set to a C string (including quotes where applicable).
@@ -191,8 +189,7 @@ BL_COMMON_SOURCES += common/bl_common.c \
plat/common/plat_bl_common.c \
plat/common/plat_log_common.c \
plat/common/${ARCH}/plat_common.c \
- plat/common/${ARCH}/platform_helpers.S \
- ${COMPILER_RT_SRCS}
+ plat/common/${ARCH}/platform_helpers.S
ifeq ($($(ARCH)-cc-id),arm-clang)
BL_COMMON_SOURCES += lib/${ARCH}/armclang_printf.S
@@ -1017,6 +1014,12 @@ endif #(SPD)
include ${MAKE_HELPERS_DIRECTORY}cflags.mk
################################################################################
+# Include compiler-rt. It is built with MAKE_LIB so it must be included after
+# some macros are defined, especially BUILD_PLAT
+################################################################################
+include lib/compiler-rt/compiler-rt.mk
+
+################################################################################
# Build targets
################################################################################
diff --git a/lib/compiler-rt/compiler-rt.mk b/lib/compiler-rt/compiler-rt.mk
index 2b16504bf..0f9abde53 100644
--- a/lib/compiler-rt/compiler-rt.mk
+++ b/lib/compiler-rt/compiler-rt.mk
@@ -28,11 +28,11 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-COMPILER_RT_SRCS := lib/compiler-rt/builtins/popcountdi2.c \
+LIBCOMPILER_RT_SRCS := lib/compiler-rt/builtins/popcountdi2.c \
lib/compiler-rt/builtins/popcountsi2.c
ifeq (${ARCH},aarch32)
-COMPILER_RT_SRCS += lib/compiler-rt/builtins/arm/aeabi_ldivmod.S \
+LIBCOMPILER_RT_SRCS += lib/compiler-rt/builtins/arm/aeabi_ldivmod.S \
lib/compiler-rt/builtins/arm/aeabi_uldivmod.S \
lib/compiler-rt/builtins/arm/aeabi_memcpy.S \
lib/compiler-rt/builtins/arm/aeabi_memset.S \
@@ -42,3 +42,5 @@ COMPILER_RT_SRCS += lib/compiler-rt/builtins/arm/aeabi_ldivmod.S \
lib/compiler-rt/builtins/lshrdi3.c \
lib/compiler-rt/builtins/udivmoddi4.c
endif
+
+$(eval $(call MAKE_LIB,compiler_rt))