summaryrefslogtreecommitdiff
path: root/src/lib/libc/string/Makefile.inc
diff options
context:
space:
mode:
authorderaadt <>2014-11-30 19:43:57 +0000
committerderaadt <>2014-11-30 19:43:57 +0000
commit3539e3fa3e1f8ac6b4177476a424681e58c76af5 (patch)
tree82fa98088bf55df432f5bac1dd59e9f100a1cac9 /src/lib/libc/string/Makefile.inc
parentc65fff479ff8dc713956bcf5d92883f19a479d84 (diff)
downloadopenbsd-3539e3fa3e1f8ac6b4177476a424681e58c76af5.tar.gz
openbsd-3539e3fa3e1f8ac6b4177476a424681e58c76af5.tar.bz2
openbsd-3539e3fa3e1f8ac6b4177476a424681e58c76af5.zip
restructure libc/string + libc/arch/*/string coperation regarding
(potentially) MD versions (function dependent, not filename dependent) split out memcpy/memmove/bcopy and strchr/index/strrchr/rindex Bring back amd64 .S versions And the final touch: switch all architectures temporarily to MI memcpy.c, which contains syslog + abort for overlapping copies. A nice harsh undefined behaviour. We will clean the entire userland of the remaining issues in this catagory, then switch to the optimised memcpy which skips the memmove check. I tried to cut this change into pieces, but testing each sub-step on every architecture is too time consuming and mindnumbing. ok miod
Diffstat (limited to 'src/lib/libc/string/Makefile.inc')
-rw-r--r--src/lib/libc/string/Makefile.inc135
1 files changed, 7 insertions, 128 deletions
diff --git a/src/lib/libc/string/Makefile.inc b/src/lib/libc/string/Makefile.inc
index a293219058..f684800db3 100644
--- a/src/lib/libc/string/Makefile.inc
+++ b/src/lib/libc/string/Makefile.inc
@@ -1,11 +1,11 @@
1# $OpenBSD: Makefile.inc,v 1.35 2014/06/13 02:12:17 matthew Exp $ 1# $OpenBSD: Makefile.inc,v 1.36 2014/11/30 19:43:56 deraadt Exp $
2 2
3# string sources 3# string sources
4.PATH: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/string ${LIBCSRCDIR}/string 4.PATH: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/string ${LIBCSRCDIR}/string
5 5
6SRCS+= explicit_bzero.c memccpy.c memmem.c memrchr.c stpcpy.c stpncpy.c \ 6SRCS+= explicit_bzero.c memccpy.c memmem.c memrchr.c stpcpy.c stpncpy.c \
7 strcasecmp.c strcasestr.c strcoll.c strdup.c \ 7 strcasecmp.c strcasestr.c strcoll.c strdup.c \
8 strerror.c strerror_r.c strlcat.c strmode.c strndup.c strnlen.c \ 8 strerror.c strerror_r.c strmode.c strndup.c strnlen.c \
9 strsignal.c strtok.c strxfrm.c \ 9 strsignal.c strtok.c strxfrm.c \
10 timingsafe_bcmp.c timingsafe_memcmp.c \ 10 timingsafe_bcmp.c timingsafe_memcmp.c \
11 wcscat.c wcschr.c wcscmp.c wcscpy.c wcscspn.c wcslcat.c wcslcpy.c \ 11 wcscat.c wcschr.c wcscmp.c wcscpy.c wcscspn.c wcslcat.c wcslcpy.c \
@@ -14,136 +14,15 @@ SRCS+= explicit_bzero.c memccpy.c memmem.c memrchr.c stpcpy.c stpncpy.c \
14 wmemmove.c wmemset.c wcsdup.c wcscasecmp.c 14 wmemmove.c wmemset.c wcsdup.c wcscasecmp.c
15 15
16# machine-dependent net sources 16# machine-dependent net sources
17# m-d Makefile.inc must include sources for: 17# ../arch/ARCH/Makefile.inc must include sources for:
18# bcmp() bcopy() bzero() ffs() index() memchr() memcmp() memset() 18# bcmp() bcopy() bzero() ffs() index() memchr() memcmp() memset()
19# rindex() strcat() strcmp() strcpy() strcspn() strlen() strlcpy() 19# memcpy() memmove() memset() rindex() strcat() strchr()
20# strncat() strncmp() strncpy() strpbrk() strsep() 20# strcmp() strcpy() strcspn() strlen() strlcat() strlcpy()
21# strspn() strstr() swav() 21# strncat() strncmp() strncpy() strpbrk() strrchr() strsep()
22# m-d Makefile.inc may include sources for: 22# strspn() strstr() swab()
23# memcpy() memmove() strchr() strrchr()
24 23
25.include "${LIBCSRCDIR}/arch/${MACHINE_CPU}/string/Makefile.inc" 24.include "${LIBCSRCDIR}/arch/${MACHINE_CPU}/string/Makefile.inc"
26 25
27# if no machine specific memmove(3), build one out of bcopy(3).
28.if empty(SRCS:Mmemmove.S)
29OBJS+= memmove.o
30memmove.o: bcopy.c
31 ${CC} -DMEMMOVE ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} -o ${.TARGET}
32 @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
33 @mv ${.TARGET}.tmp ${.TARGET}
34
35memmove.go: bcopy.c
36 ${CC} -g -DMEMMOVE ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} -o ${.TARGET}
37 @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
38 @mv ${.TARGET}.tmp ${.TARGET}
39
40memmove.po: bcopy.c
41 ${CC} -DMEMMOVE ${CFLAGS} ${CPPFLAGS} -c -p ${.ALLSRC} -o ${.TARGET}
42 @${LD} -o ${.TARGET}.tmp -X -r ${.TARGET}
43 @mv ${.TARGET}.tmp ${.TARGET}
44
45memmove.so: bcopy.c
46 ${CC} ${PICFLAG} -DPIC -DMEMMOVE ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} \
47 -o ${.TARGET}
48
49memmove.do: bcopy.c
50 ${CC} -DMEMMOVE ${CFLAGS} ${CPPFLAGS} ${DIST_CFLAGS} -c ${.ALLSRC} \
51 -o ${.TARGET}
52 @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
53 @mv ${.TARGET}.tmp ${.TARGET}
54.endif
55
56# if no machine specific memcpy(3), build one out of bcopy(3).
57# if there is a machine specific memmove(3), we'll assume it aliases
58# memcpy(3).
59.if empty(SRCS:Mmemcpy.S)
60.if empty(SRCS:Mmemmove.S)
61OBJS+= memcpy.o
62memcpy.o: bcopy.c
63 ${CC} -DMEMCOPY ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} -o ${.TARGET}
64 @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
65 @mv ${.TARGET}.tmp ${.TARGET}
66
67memcpy.go: bcopy.c
68 ${CC} -g -DMEMCOPY ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} -o ${.TARGET}
69 @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
70 @mv ${.TARGET}.tmp ${.TARGET}
71
72memcpy.po: bcopy.c
73 ${CC} -DMEMCOPY ${CFLAGS} ${CPPFLAGS} -c -p ${.ALLSRC} -o ${.TARGET}
74 @${LD} -o ${.TARGET}.tmp -X -r ${.TARGET}
75 @mv ${.TARGET}.tmp ${.TARGET}
76
77memcpy.so: bcopy.c
78 ${CC} ${PICFLAG} -DPIC -DMEMCOPY ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} \
79 -o ${.TARGET}
80
81memcpy.do: bcopy.c
82 ${CC} -DMEMCOPY ${CFLAGS} ${CPPFLAGS} ${DIST_CFLAGS} -c ${.ALLSRC} \
83 -o ${.TARGET}
84 @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
85 @mv ${.TARGET}.tmp ${.TARGET}
86.endif
87.endif
88
89# if no machine specific strchr(3), build one out of index(3).
90.if empty(SRCS:Mstrchr.S)
91OBJS+= strchr.o
92strchr.o: index.c
93 ${CC} -DSTRCHR ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} -o ${.TARGET}
94 @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
95 @mv ${.TARGET}.tmp ${.TARGET}
96
97strchr.go: index.c
98 ${CC} -g -DSTRCHR ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} -o ${.TARGET}
99 @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
100 @mv ${.TARGET}.tmp ${.TARGET}
101
102strchr.po: index.c
103 ${CC} -DSTRCHR ${CFLAGS} ${CPPFLAGS} -c -p ${.ALLSRC} -o ${.TARGET}
104 @${LD} -o ${.TARGET}.tmp -X -r ${.TARGET}
105 @mv ${.TARGET}.tmp ${.TARGET}
106
107strchr.so: index.c
108 ${CC} ${PICFLAG} -DPIC -DSTRCHR ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} \
109 -o ${.TARGET}
110
111strchr.do: index.c
112 ${CC} -DSTRCHR ${CFLAGS} ${CPPFLAGS} ${DIST_CFLAGS} -c ${.ALLSRC} \
113 -o ${.TARGET}
114 @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
115 @mv ${.TARGET}.tmp ${.TARGET}
116.endif
117
118# if no machine specific strrchr(3), build one out of rindex(3).
119.if empty(SRCS:Mstrrchr.S)
120OBJS+= strrchr.o
121strrchr.o: rindex.c
122 ${CC} -DSTRRCHR ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} -o ${.TARGET}
123 @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
124 @mv ${.TARGET}.tmp ${.TARGET}
125
126strrchr.go: rindex.c
127 ${CC} -g -DSTRRCHR ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} -o ${.TARGET}
128 @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
129 @mv ${.TARGET}.tmp ${.TARGET}
130
131strrchr.po: rindex.c
132 ${CC} -DSTRRCHR ${CFLAGS} ${CPPFLAGS} -c -p ${.ALLSRC} -o ${.TARGET}
133 @${LD} -o ${.TARGET}.tmp -X -r ${.TARGET}
134 @mv ${.TARGET}.tmp ${.TARGET}
135
136strrchr.so: rindex.c
137 ${CC} ${PICFLAG} -DPIC -DSTRRCHR ${CFLAGS} ${CPPFLAGS} -c ${.ALLSRC} \
138 -o ${.TARGET}
139
140strrchr.do: rindex.c
141 ${CC} -DSTRRCHR ${CFLAGS} ${CPPFLAGS} ${DIST_CFLAGS} -c ${.ALLSRC} \
142 -o ${.TARGET}
143 @${LD} -o ${.TARGET}.tmp -x -r ${.TARGET}
144 @mv ${.TARGET}.tmp ${.TARGET}
145.endif
146
147MAN+= bcmp.3 bcopy.3 bstring.3 bzero.3 ffs.3 memccpy.3 memchr.3 \ 26MAN+= bcmp.3 bcopy.3 bstring.3 bzero.3 ffs.3 memccpy.3 memchr.3 \
148 memcmp.3 memcpy.3 memmem.3 memmove.3 memset.3 stpcpy.3 strcasecmp.3 \ 27 memcmp.3 memcpy.3 memmem.3 memmove.3 memset.3 stpcpy.3 strcasecmp.3 \
149 strcat.3 strchr.3 strcmp.3 strcoll.3 strcpy.3 strcspn.3 strdup.3 \ 28 strcat.3 strchr.3 strcmp.3 strcoll.3 strcpy.3 strcspn.3 strdup.3 \