summaryrefslogtreecommitdiff
path: root/lib/libc/aarch64/string/Makefile.inc
blob: 528c19574a1c46d9f4d6554a3347925ced907e9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#
# String handling from the Arm Optimized Routines
# https://github.com/ARM-software/optimized-routines
#

AARCH64_STRING_FUNCS= \
	memcmp \
	memmove \
	memrchr \
	stpcpy \
	strchr \
	strchrnul \
	strcpy \
	strnlen \
	strrchr

# SIMD-enhanced routines not derived from Arm's code
MDSRCS+= \
	memchr.S \
	strcmp.S \
	strspn.S \
	strcspn.S \
	strpbrk.c \
	strsep.c \
	strcat.c \
	strlcpy.S \
	strncmp.S \
	memccpy.S \
	strncat.c \
	strlcat.c \
	strlen.S \
	timingsafe_bcmp.S \
	timingsafe_memcmp.S \
	bcopy.c \
	bzero.c \
	memcpy.S \
	memcpy_resolver.c \
	memmove_resolver.c \
	memset.S \
	memset_resolver.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

# Several files are wrappers in the src tree for the implementation from
# arm-optimized-routines
CFLAGS.memchr.S+=-I${SRCTOP}/contrib/arm-optimized-routines/string
CFLAGS.memcpy.S+=-I${SRCTOP}/contrib/arm-optimized-routines/string
CFLAGS.memset.S+=-I${SRCTOP}/contrib/arm-optimized-routines/string