This is an automated email from the ASF dual-hosted git repository.

linguini pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new ba64b35806f include/string.h: mark memset and memcpy as used_code
ba64b35806f is described below

commit ba64b35806f0eecfaca5bc9ff48a64506a630a12
Author: raiden00pl <[email protected]>
AuthorDate: Fri Sep 19 11:46:05 2025 +0200

    include/string.h: mark memset and memcpy as used_code
    
    Mark memset and memcpy as used_code to fix issues with GCC LTO and CMake
    which throws many "undefined reference to memset" errors.
    used_code force the compiler to emit the memset symbol under LTO.
    
    Signed-off-by: raiden00pl <[email protected]>
---
 include/string.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/string.h b/include/string.h
index 1cfc1e04e56..f000a87e1c7 100644
--- a/include/string.h
+++ b/include/string.h
@@ -100,10 +100,10 @@ FAR void  *memrchr(FAR const void *s, int c, size_t n);
 FAR void  *rawmemchr(FAR const void *s, int c);
 FAR void  *memccpy(FAR void *s1, FAR const void *s2, int c, size_t n);
 int        memcmp(FAR const void *s1, FAR const void *s2, size_t n);
-FAR void  *memcpy(FAR void *dest, FAR const void *src, size_t n);
+FAR void  *memcpy(FAR void *dest, FAR const void *src, size_t n) used_code;
 FAR void  *mempcpy(FAR void *dest, FAR const void *src, size_t n);
 FAR void  *memmove(FAR void *dest, FAR const void *src, size_t count);
-FAR void  *memset(FAR void *s, int c, size_t n);
+FAR void  *memset(FAR void *s, int c, size_t n) used_code;
 FAR void  *memmem(FAR const void *haystack, size_t haystacklen,
                   FAR const void *needle, size_t needlelen);
 

Reply via email to