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