[PATCH 2/3] mbedtls: Add compiler-rt subset into the MbedTLS build
Raymond Mao
raymond.mao at linaro.org
Fri Jun 20 17:10:09 CEST 2025
Add compiler-rt subset into the MbedTLS build for Clang to solve the
link error due to missing '__udivti3' when RSA_PUBLIC_KEY_PARSER_MBEDTLS
is selected.
Fixes: 13de8483388c ("mbedtls: add mbedtls into the build system")
Signed-off-by: Raymond Mao <raymond.mao at linaro.org>
---
lib/mbedtls/Makefile | 10 ++++++++++
lib/mbedtls/port/compiler-rt/lib/builtins/int_types.h | 1 +
2 files changed, 11 insertions(+)
diff --git a/lib/mbedtls/Makefile b/lib/mbedtls/Makefile
index c5b445bd85c..80cccf13d5f 100644
--- a/lib/mbedtls/Makefile
+++ b/lib/mbedtls/Makefile
@@ -11,6 +11,16 @@ obj-$(CONFIG_$(PHASE_)SHA1_MBEDTLS) += sha1.o
obj-$(CONFIG_$(PHASE_)SHA256_MBEDTLS) += sha256.o
obj-$(CONFIG_$(PHASE_)SHA512_MBEDTLS) += sha512.o
+# Clang compiler-rt
+ifdef CONFIG_CC_IS_CLANG
+# Built-in macros for int128 or 64bit target will enable CRT_HAS_128BIT
+CLANG_RT_LIB_DIR = port/compiler-rt/lib/builtins
+obj-$(CONFIG_$(PHASE_)RSA_PUBLIC_KEY_PARSER_MBEDTLS) += \
+ $(CLANG_RT_LIB_DIR)/udivti3.o
+obj-$(CONFIG_$(PHASE_)RSA_PUBLIC_KEY_PARSER_MBEDTLS) += \
+ $(CLANG_RT_LIB_DIR)/udivmodti4.o
+endif
+
# x509 libraries
obj-$(CONFIG_$(PHASE_)ASYMMETRIC_PUBLIC_KEY_MBEDTLS) += \
public_key.o
diff --git a/lib/mbedtls/port/compiler-rt/lib/builtins/int_types.h b/lib/mbedtls/port/compiler-rt/lib/builtins/int_types.h
index 48862f36421..6f290574c1f 100644
--- a/lib/mbedtls/port/compiler-rt/lib/builtins/int_types.h
+++ b/lib/mbedtls/port/compiler-rt/lib/builtins/int_types.h
@@ -16,6 +16,7 @@
#ifndef INT_TYPES_H
#define INT_TYPES_H
+#include <linux/types.h>
#include "int_endianness.h"
// si_int is defined in Linux sysroot's asm-generic/siginfo.h
--
2.25.1
More information about the U-Boot
mailing list