1# 2# String handling from the Arm Optimized Routines 3# https://github.com/ARM-software/optimized-routines 4# 5 6AARCH64_STRING_FUNCS= \ 7 memchr \ 8 memcmp \ 9 memcpy \ 10 memmove \ 11 memrchr \ 12 memset \ 13 stpcpy \ 14 strchr \ 15 strchrnul \ 16 strcpy \ 17 strnlen \ 18 strrchr 19 20# SIMD-enhanced routines not derived from Arm's code 21MDSRCS+= \ 22 strcmp.S \ 23 strspn.S \ 24 strcspn.S \ 25 strpbrk.c \ 26 strsep.c \ 27 strcat.c \ 28 strlcpy.S \ 29 strncmp.S \ 30 memccpy.S \ 31 strncat.c \ 32 strlcat.c \ 33 strlen.S \ 34 timingsafe_bcmp.S \ 35 timingsafe_memcmp.S \ 36 bcopy.c \ 37 bzero.c 38 39# 40# Add the above functions. Generate an asm file that includes the needed 41# Arm Optimized Routines file defining the function name to the libc name. 42# Some file need multiple macros defined or a weak symbol added we can 43# override the generated file in these cases. 44# 45.for FUNC in ${AARCH64_STRING_FUNCS} 46.if !exists(${FUNC}.S) 47${FUNC}.S: 48 printf '/* %sgenerated by libc/aarch64/string/Makefile.inc */\n' @ > ${.TARGET} 49 printf '#define __%s_aarch64 %s\n' ${FUNC} ${FUNC} >> ${.TARGET} 50 printf '#include "aarch64/%s.S"\n' ${FUNC} >> ${.TARGET} 51CLEANFILES+= ${FUNC}.S 52.endif 53 54MDSRCS+= ${FUNC}.S 55CFLAGS.${FUNC}.S+=-I${SRCTOP}/contrib/arm-optimized-routines/string 56.endfor 57