diff --git a/lib/libc/aarch64/string/Makefile.inc b/lib/libc/aarch64/string/Makefile.inc index 996a2fd45bc0..0b2974947389 100644 --- a/lib/libc/aarch64/string/Makefile.inc +++ b/lib/libc/aarch64/string/Makefile.inc @@ -1,47 +1,48 @@ # # String handling from the Arm Optimized Routines # https://github.com/ARM-software/optimized-routines # AARCH64_STRING_FUNCS= \ memchr \ memcmp \ memcpy \ memmove \ memrchr \ memset \ stpcpy \ strchr \ strchrnul \ strcpy \ strlen \ strncmp \ strnlen \ strrchr # SIMD-enhanced routines not derived from Arm's code MDSRCS+= \ strcmp.S \ strspn.S \ strcspn.S \ strpbrk.c \ - strsep.c + strsep.c \ + strcat.c # # Add the above functions. Generate an asm file that includes the needed # Arm Optimized Routines file defining the function name to the libc name. # Some file need multiple macros defined or a weak symbol added we can # override the generated file in these cases. # .for FUNC in ${AARCH64_STRING_FUNCS} .if !exists(${FUNC}.S) ${FUNC}.S: printf '/* %sgenerated by libc/aarch64/string/Makefile.inc */\n' @ > ${.TARGET} printf '#define __%s_aarch64 %s\n' ${FUNC} ${FUNC} >> ${.TARGET} printf '#include "aarch64/%s.S"\n' ${FUNC} >> ${.TARGET} CLEANFILES+= ${FUNC}.S .endif MDSRCS+= ${FUNC}.S CFLAGS.${FUNC}.S+=-I${SRCTOP}/contrib/arm-optimized-routines/string .endfor diff --git a/lib/libc/aarch64/string/strcat.c b/lib/libc/aarch64/string/strcat.c new file mode 100644 index 000000000000..c70875be1c1a --- /dev/null +++ b/lib/libc/aarch64/string/strcat.c @@ -0,0 +1,20 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024 Getz Mikalsen +*/ + +#include + +#undef strcat /* _FORTIFY_SOURCE */ + +char * +strcat(char * __restrict s, const char * __restrict append) +{ + char *save = s; + + /* call into SIMD optimized functions */ + stpcpy(s + strlen(s), append); + + return(save); +}