This is an automated email from the ASF dual-hosted git repository. kasjer pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 4b292131e66f319f78c9ef6e93d526162450641a Author: Jerzy Kasenberg <[email protected]> AuthorDate: Sat May 23 16:05:36 2026 +0200 baselibc: Add option to disable memset and memcpy baselibc version of memcpy and memset are optimized for speed if compared to pure C code. However compiler provided version are more efficient. Additionally baselibc version for ARM copies data in revers direction which is allowed but may degrade performance when buffers are aligned but number of bytes to copy is not multiply of 4. Second case where this approach shows it's drawbacks is when memcpy is used to copy data from memory mapped QSPI flash when reading from the last byte is very inefficient. This just add option to drop baselibc version in favor of other (compiler provided or user provided). --- libc/baselibc/pkg.yml | 6 ++++++ libc/baselibc/syscfg.yml | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/libc/baselibc/pkg.yml b/libc/baselibc/pkg.yml index b8acd28eb..646dd61fa 100644 --- a/libc/baselibc/pkg.yml +++ b/libc/baselibc/pkg.yml @@ -37,5 +37,11 @@ pkg.cflags: pkg.cflags.BASELIBC_DEBUG_MALLOC: - -DDEBUG_MALLOC +pkg.ign_files.BASELIBC_NO_MEMCPY: + - memcpy.c + +pkg.ign_files.BASELIBC_NO_MEMSET: + - memset.c + pkg.lflags.!MCU_NATIVE: - -umain diff --git a/libc/baselibc/syscfg.yml b/libc/baselibc/syscfg.yml index d20e0a16f..6a39c9630 100644 --- a/libc/baselibc/syscfg.yml +++ b/libc/baselibc/syscfg.yml @@ -42,3 +42,17 @@ syscfg.defs: Set to 1 to enable extra debugging for malloc/free calls. This will e.g. assert on double-free. value: 0 + + BASELIBC_NO_MEMCPY: + description: > + Set to 1 to disable baselibc version of memcpy and let compiler + provide it's own which may be more efficient or user code + can have custom one. + value: 0 + + BASELIBC_NO_MEMSET: + description: > + Set to 1 to disable baselibc version of memset and let compiler + provide it's own which may be more efficient or user code + can have custom one. + value: 0
