From 1d7105bb7398b4e34c0fd9c73077cb700d9e09ea Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 28 Sep 2023 08:32:17 -0700 Subject: [PATCH] libc/picolibc: Only enable malloc when required When malloc is included in the build, the heap initialization code will be pulled in even if the application doesn't actually use malloc. This increases the size of executables by a few hundred bytes and delays system startup. Select COMMON_LIBC_MALLOC only when applications indicate that they require malloc by setting REQUIRES_MALLOC. Signed-off-by: Keith Packard --- lib/libc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/Kconfig b/lib/libc/Kconfig index c80e4aa0ea80963..437a8424a409363 100644 --- a/lib/libc/Kconfig +++ b/lib/libc/Kconfig @@ -102,7 +102,7 @@ config PICOLIBC imply THREAD_LOCAL_STORAGE if ARCH_HAS_THREAD_LOCAL_STORAGE && TOOLCHAIN_SUPPORTS_THREAD_LOCAL_STORAGE select LIBC_ERRNO if THREAD_LOCAL_STORAGE select NEED_LIBC_MEM_PARTITION - imply COMMON_LIBC_MALLOC + select COMMON_LIBC_MALLOC if REQUIRES_MALLOC depends on !NATIVE_APPLICATION depends on PICOLIBC_SUPPORTED help