Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions libs/libc/libc.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,16 @@
# define LIBC_BUILD_STRRCHR
#endif

#if ((!defined(CONFIG_LIBC_PREVENT_STPCPY_USER) && !defined(__KERNEL__)) || \
(!defined(CONFIG_LIBC_PREVENT_STPCPY_KERNEL) && defined(__KERNEL__)))
# define LIBC_BUILD_STPCPY
#endif

#if ((!defined(CONFIG_LIBC_PREVENT_STPNCPY_USER) && !defined(__KERNEL__)) || \
(!defined(CONFIG_LIBC_PREVENT_STPNCPY_KERNEL) && defined(__KERNEL__)))
# define LIBC_BUILD_STPNCPY
#endif

#ifdef CONFIG_MM_KASAN
# define ARCH_LIBCFUN(x) arch_##x
#else
Expand Down
60 changes: 60 additions & 0 deletions libs/libc/machine/risc-v/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,70 @@ if(CONFIG_RISCV_MEMSET)
list(APPEND SRCS arch_memset.S)
endif()

if(CONFIG_RISCV_MEMMOVE)
list(APPEND SRCS arch_memmove.S)
endif()

if(CONFIG_RISCV_MEMCMP)
list(APPEND SRCS arch_memcmp.S)
endif()

if(CONFIG_RISCV_MEMCHR)
list(APPEND SRCS arch_memchr.S)
endif()

if(CONFIG_RISCV_STRCMP)
list(APPEND SRCS arch_strcmp.S)
endif()

if(CONFIG_RISCV_STRLEN)
list(APPEND SRCS arch_strlen.S)
endif()

if(CONFIG_RISCV_STRNLEN)
list(APPEND SRCS arch_strnlen.S)
endif()

if(CONFIG_RISCV_STRCPY)
list(APPEND SRCS arch_strcpy.S)
endif()

if(CONFIG_RISCV_STRNCPY)
list(APPEND SRCS arch_strncpy.S)
endif()

if(CONFIG_RISCV_STPCPY)
list(APPEND SRCS arch_stpcpy.S)
endif()

if(CONFIG_RISCV_STPNCPY)
list(APPEND SRCS arch_stpncpy.S)
endif()

if(CONFIG_RISCV_STRCHR)
list(APPEND SRCS arch_strchr.S)
endif()

if(CONFIG_RISCV_STRCHRNUL)
list(APPEND SRCS arch_strchrnul.S)
endif()

if(CONFIG_RISCV_STRRCHR)
list(APPEND SRCS arch_strrchr.S)
endif()

if(CONFIG_RISCV_STRNCMP)
list(APPEND SRCS arch_strncmp.S)
endif()

if(CONFIG_RISCV_STRLCPY)
list(APPEND SRCS arch_strlcpy.S)
endif()

if(CONFIG_RISCV_STRCAT)
list(APPEND SRCS arch_strcat.S)
endif()

if(CONFIG_ARCH_SETJMP_H)
list(APPEND SRCS arch_setjmp.S)
endif()
Expand Down
134 changes: 134 additions & 0 deletions libs/libc/machine/risc-v/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,22 @@ config RISCV_STRING_FUNCTION
depends on ARCH_TOOLCHAIN_GNU
select RISCV_MEMCPY
select RISCV_MEMSET
select RISCV_MEMMOVE
select RISCV_MEMCMP
select RISCV_MEMCHR
select RISCV_STRCMP
select RISCV_STRLEN
select RISCV_STRNLEN
select RISCV_STRCPY
select RISCV_STRNCPY
select RISCV_STPCPY
select RISCV_STPNCPY
select RISCV_STRCHR
select RISCV_STRCHRNUL
select RISCV_STRRCHR
select RISCV_STRNCMP
select RISCV_STRCAT
select RISCV_STRLCPY

config RISCV_MEMCPY
bool "Enable optimized memcpy() for RISC-V"
Expand All @@ -26,6 +41,30 @@ config RISCV_MEMSET
---help---
Enable optimized RISC-V specific memset() library function

config RISCV_MEMMOVE
bool "Enable optimized memmove() for RISC-V"
default n
select LIBC_ARCH_MEMMOVE
depends on ARCH_TOOLCHAIN_GNU
---help---
Enable optimized RISC-V specific memmove() library function

config RISCV_MEMCMP
bool "Enable optimized memcmp() for RISC-V"
default n
select LIBC_ARCH_MEMCMP
depends on ARCH_TOOLCHAIN_GNU
---help---
Enable optimized RISC-V specific memcmp() library function

config RISCV_MEMCHR
bool "Enable optimized memchr() for RISC-V"
default n
select LIBC_ARCH_MEMCHR
depends on ARCH_TOOLCHAIN_GNU
---help---
Enable optimized RISC-V specific memchr() library function

config RISCV_STRCMP
bool "Enable optimized strcmp() for RISC-V"
default n
Expand All @@ -34,3 +73,98 @@ config RISCV_STRCMP
---help---
Enable optimized RISC-V specific strcmp() library function

config RISCV_STRLEN
bool "Enable optimized strlen() for RISC-V"
default n
select LIBC_ARCH_STRLEN
depends on ARCH_TOOLCHAIN_GNU
---help---
Enable optimized RISC-V specific strlen() library function

config RISCV_STRNLEN
bool "Enable optimized strnlen() for RISC-V"
default n
select LIBC_ARCH_STRNLEN
depends on ARCH_TOOLCHAIN_GNU
---help---
Enable optimized RISC-V specific strnlen() library function

config RISCV_STRCPY
bool "Enable optimized strcpy() for RISC-V"
default n
select LIBC_ARCH_STRCPY
depends on ARCH_TOOLCHAIN_GNU
---help---
Enable optimized RISC-V specific strcpy() library function

config RISCV_STRNCPY
bool "Enable optimized strncpy() for RISC-V"
default n
select LIBC_ARCH_STRNCPY
depends on ARCH_TOOLCHAIN_GNU
---help---
Enable optimized RISC-V specific strncpy() library function

config RISCV_STPCPY
bool "Enable optimized stpcpy() for RISC-V"
default n
select LIBC_ARCH_STPCPY
depends on ARCH_TOOLCHAIN_GNU
---help---
Enable optimized RISC-V specific stpcpy() library function

config RISCV_STPNCPY
bool "Enable optimized stpncpy() for RISC-V"
default n
select LIBC_ARCH_STPNCPY
depends on ARCH_TOOLCHAIN_GNU
---help---
Enable optimized RISC-V specific stpncpy() library function

config RISCV_STRCHR
bool "Enable optimized strchr() for RISC-V"
default n
select LIBC_ARCH_STRCHR
depends on ARCH_TOOLCHAIN_GNU
---help---
Enable optimized RISC-V specific strchr() library function

config RISCV_STRCHRNUL
bool "Enable optimized strchrnul() for RISC-V"
default n
select LIBC_ARCH_STRCHRNUL
depends on ARCH_TOOLCHAIN_GNU
---help---
Enable optimized RISC-V specific strchrnul() library function

config RISCV_STRRCHR
bool "Enable optimized strrchr() for RISC-V"
default n
select LIBC_ARCH_STRRCHR
depends on ARCH_TOOLCHAIN_GNU
---help---
Enable optimized RISC-V specific strrchr() library function

config RISCV_STRNCMP
bool "Enable optimized strncmp() for RISC-V"
default n
select LIBC_ARCH_STRNCMP
depends on ARCH_TOOLCHAIN_GNU
---help---
Enable optimized RISC-V specific strncmp() library function

config RISCV_STRCAT
bool "Enable optimized strcat() for RISC-V"
default n
select LIBC_ARCH_STRCAT
depends on ARCH_TOOLCHAIN_GNU
---help---
Enable optimized RISC-V specific strcat() library function

config RISCV_STRLCPY
bool "Enable optimized strlcpy() for RISC-V"
default n
select LIBC_ARCH_STRLCPY
depends on ARCH_TOOLCHAIN_GNU
---help---
Enable optimized RISC-V specific strlcpy() library function
60 changes: 60 additions & 0 deletions libs/libc/machine/risc-v/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,70 @@ ifeq ($(CONFIG_RISCV_MEMSET),y)
ASRCS += arch_memset.S
endif

ifeq ($(CONFIG_RISCV_MEMMOVE),y)
ASRCS += arch_memmove.S
endif

ifeq ($(CONFIG_RISCV_MEMCMP),y)
ASRCS += arch_memcmp.S
endif

ifeq ($(CONFIG_RISCV_MEMCHR),y)
ASRCS += arch_memchr.S
endif

ifeq ($(CONFIG_RISCV_STRCMP),y)
ASRCS += arch_strcmp.S
endif

ifeq ($(CONFIG_RISCV_STRLEN),y)
ASRCS += arch_strlen.S
endif

ifeq ($(CONFIG_RISCV_STRNLEN),y)
ASRCS += arch_strnlen.S
endif

ifeq ($(CONFIG_RISCV_STRCPY),y)
ASRCS += arch_strcpy.S
endif

ifeq ($(CONFIG_RISCV_STRNCPY),y)
ASRCS += arch_strncpy.S
endif

ifeq ($(CONFIG_RISCV_STPCPY),y)
ASRCS += arch_stpcpy.S
endif

ifeq ($(CONFIG_RISCV_STPNCPY),y)
ASRCS += arch_stpncpy.S
endif

ifeq ($(CONFIG_RISCV_STRCHR),y)
ASRCS += arch_strchr.S
endif

ifeq ($(CONFIG_RISCV_STRCHRNUL),y)
ASRCS += arch_strchrnul.S
endif

ifeq ($(CONFIG_RISCV_STRRCHR),y)
ASRCS += arch_strrchr.S
endif

ifeq ($(CONFIG_RISCV_STRNCMP),y)
ASRCS += arch_strncmp.S
endif

ifeq ($(CONFIG_RISCV_STRLCPY),y)
ASRCS += arch_strlcpy.S
endif

ifeq ($(CONFIG_RISCV_STRCAT),y)
ASRCS += arch_strcat.S
endif

ifeq ($(CONFIG_ARCH_SETJMP_H),y)
ASRCS += arch_setjmp.S
endif
Expand Down
Loading
Loading