]>
Commit | Line | Data |
---|---|---|
dff8da6b | 1 | # Copyright (C) 1991-2024 Free Software Foundation, Inc. |
28f540f4 RM |
2 | # This file is part of the GNU C Library. |
3 | ||
4 | # The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
5 | # modify it under the terms of the GNU Lesser General Public |
6 | # License as published by the Free Software Foundation; either | |
7 | # version 2.1 of the License, or (at your option) any later version. | |
28f540f4 RM |
8 | |
9 | # The GNU C Library is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 12 | # Lesser General Public License for more details. |
28f540f4 | 13 | |
41bdb6e2 | 14 | # You should have received a copy of the GNU Lesser General Public |
59ba27a6 | 15 | # License along with the GNU C Library; if not, see |
5a82c748 | 16 | # <https://www.gnu.org/licenses/>. |
28f540f4 RM |
17 | |
18 | # | |
19 | # Sub-makefile for string portion of library. | |
20 | # | |
21 | subdir := string | |
22 | ||
a5f891ac JM |
23 | include ../Makeconfig |
24 | ||
a007ec46 L |
25 | headers := \ |
26 | argz.h \ | |
27 | bits/byteswap.h \ | |
28 | bits/endian.h \ | |
29 | bits/endianness.h \ | |
30 | bits/string_fortified.h \ | |
31 | bits/strings_fortified.h \ | |
32 | bits/uintn-identity.h \ | |
33 | byteswap.h \ | |
34 | endian.h \ | |
35 | envz.h \ | |
36 | memory.h \ | |
37 | string.h \ | |
38 | strings.h \ | |
39 | # headers | |
28f540f4 | 40 | |
a007ec46 L |
41 | routines := \ |
42 | _strerror \ | |
43 | argz-addsep \ | |
44 | argz-append \ | |
45 | argz-count \ | |
46 | argz-create \ | |
47 | argz-ctsep \ | |
48 | argz-delete \ | |
49 | argz-extract \ | |
50 | argz-insert \ | |
51 | argz-next \ | |
52 | argz-replace \ | |
53 | argz-stringify \ | |
54 | basename \ | |
55 | bcopy \ | |
56 | bzero \ | |
57 | envz \ | |
58 | explicit_bzero \ | |
59 | ffs \ | |
60 | ffsll \ | |
61 | memccpy \ | |
62 | memchr \ | |
63 | memcmp \ | |
64 | memcmpeq \ | |
65 | memcpy \ | |
66 | memfrob \ | |
67 | memmem \ | |
68 | memmove \ | |
69 | mempcpy \ | |
70 | memrchr \ | |
71 | memset \ | |
72 | rawmemchr \ | |
73 | sigabbrev_np \ | |
74 | sigdescr_np \ | |
75 | stpcpy \ | |
76 | stpncpy \ | |
77 | strcasecmp \ | |
78 | strcasecmp_l \ | |
79 | strcasestr \ | |
80 | strcat \ | |
81 | strchr \ | |
82 | strchrnul \ | |
83 | strcmp \ | |
84 | strcoll \ | |
85 | strcoll_l \ | |
86 | strcpy \ | |
87 | strcspn \ | |
88 | strdup \ | |
89 | strerror \ | |
90 | strerror_l \ | |
91 | strerrordesc_np \ | |
92 | strerrorname_np \ | |
93 | strfry \ | |
94 | string-inlines \ | |
454a20c8 FW |
95 | strlcat \ |
96 | strlcpy \ | |
a007ec46 L |
97 | strlen \ |
98 | strncase \ | |
99 | strncase_l \ | |
100 | strncat \ | |
101 | strncmp \ | |
102 | strncpy \ | |
103 | strndup \ | |
104 | strnlen \ | |
105 | strpbrk \ | |
106 | strrchr \ | |
107 | strsep \ | |
108 | strsignal \ | |
109 | strspn \ | |
110 | strstr \ | |
111 | strtok \ | |
112 | strtok_r \ | |
113 | strverscmp \ | |
114 | strxfrm \ | |
115 | strxfrm_l \ | |
116 | swab \ | |
117 | wordcopy \ | |
118 | xpg-strerror \ | |
119 | # routines | |
28f540f4 | 120 | |
20c894d2 FB |
121 | # Exclude fortified routines from being built with _FORTIFY_SOURCE |
122 | routines_no_fortify += \ | |
123 | explicit_bzero \ | |
124 | memcpy \ | |
125 | memmove \ | |
126 | mempcpy \ | |
127 | memset \ | |
128 | stpcpy \ | |
129 | stpncpy \ | |
130 | strcat \ | |
131 | strcpy \ | |
132 | strlcat \ | |
133 | strlcpy \ | |
134 | strncat \ | |
135 | strncpy \ | |
136 | # routines_no_fortify | |
137 | ||
a007ec46 L |
138 | tests := \ |
139 | bug-envz1 \ | |
140 | bug-strcoll1 \ | |
141 | bug-strcoll2 \ | |
142 | bug-strncat1 \ | |
143 | bug-strpbrk1 \ | |
144 | bug-strspn1 \ | |
145 | bug-strtok1 \ | |
146 | inl-tester \ | |
147 | noinl-tester \ | |
148 | stratcliff \ | |
149 | test-bcopy \ | |
150 | test-bzero \ | |
151 | test-endian-file-scope \ | |
152 | test-endian-sign-conversion \ | |
153 | test-endian-types \ | |
154 | test-explicit_bzero \ | |
155 | test-ffs \ | |
156 | test-memccpy \ | |
157 | test-memchr \ | |
158 | test-memcmp \ | |
159 | test-memcmpeq \ | |
160 | test-memcpy \ | |
161 | test-memcpy-large \ | |
162 | test-memmem \ | |
163 | test-memmove \ | |
164 | test-mempcpy \ | |
165 | test-memrchr \ | |
166 | test-memset \ | |
167 | test-rawmemchr \ | |
168 | test-sig_np \ | |
169 | test-stpcpy \ | |
170 | test-stpncpy \ | |
171 | test-strcasecmp \ | |
172 | test-strcasestr \ | |
173 | test-strcat \ | |
174 | test-strchr \ | |
175 | test-strchrnul \ | |
176 | test-strcmp \ | |
177 | test-strcpy \ | |
178 | test-strcspn \ | |
eaaad78d | 179 | test-strdup \ |
a007ec46 L |
180 | test-strlen \ |
181 | test-strncasecmp \ | |
182 | test-strncat \ | |
183 | test-strncmp \ | |
184 | test-strncpy \ | |
0c48aa05 | 185 | test-strndup \ |
a007ec46 L |
186 | test-strnlen \ |
187 | test-strpbrk \ | |
188 | test-strrchr \ | |
189 | test-strspn \ | |
190 | test-strstr \ | |
191 | testcopy \ | |
192 | tester \ | |
193 | tst-bswap \ | |
194 | tst-cmp \ | |
195 | tst-endian \ | |
196 | tst-inlcall \ | |
197 | tst-memmove-overflow \ | |
1d44530a | 198 | tst-strerror-fail \ |
a007ec46 | 199 | tst-strfry \ |
454a20c8 | 200 | tst-strlcat \ |
b316c9a7 | 201 | tst-strlcat2 \ |
454a20c8 | 202 | tst-strlcpy \ |
23871292 | 203 | tst-strlcpy2 \ |
a007ec46 L |
204 | tst-strlen \ |
205 | tst-strtok \ | |
206 | tst-strtok_r \ | |
207 | tst-strxfrm \ | |
208 | tst-strxfrm2 \ | |
209 | tst-svc \ | |
210 | tst-svc2 \ | |
211 | tst-xbzero-opt \ | |
212 | # tests | |
c1e63c72 | 213 | |
fccf38c5 AZ |
214 | tests-static-internal := \ |
215 | test-memswap \ | |
216 | # tests-static-internal | |
217 | ||
218 | tests-internal := \ | |
219 | $(tests-static-internal) \ | |
220 | # tests-internal | |
221 | ||
222 | tests-static := \ | |
223 | $(tests-static-internal) \ | |
224 | # tests-static | |
225 | ||
10b01bd4 | 226 | # Both tests require the .mo translation files generated by msgfmt. |
a007ec46 L |
227 | tests-translation := \ |
228 | tst-strerror \ | |
229 | tst-strsignal \ | |
230 | # tests-translation | |
10b01bd4 AZ |
231 | |
232 | tests-container += $(tests-translation) | |
233 | ifeq ($(MSGFMT),:) | |
234 | tests-unsupported += $(tests-translation) | |
235 | endif | |
28f540f4 | 236 | |
5653ab12 | 237 | # This test allocates a lot of memory and can run for a long time. |
303e567a SP |
238 | xtests = tst-strcoll-overflow |
239 | ||
2ef42716 AJ |
240 | # This test needs libdl. |
241 | ifeq (yes,$(build-shared)) | |
242 | tests += test-strerror-errno | |
2ef42716 AJ |
243 | endif |
244 | ||
f214606a JM |
245 | ifeq ($(run-built-tests),yes) |
246 | tests-special += $(objpfx)tst-svc-cmp.out | |
247 | endif | |
248 | ||
28f540f4 | 249 | include ../Rules |
59dd8641 | 250 | |
e70c6fee L |
251 | CFLAGS-inl-tester.c += -fno-builtin |
252 | CFLAGS-noinl-tester.c += -fno-builtin | |
253 | CFLAGS-tst-strlen.c += -fno-builtin | |
254 | CFLAGS-stratcliff.c += -fno-builtin | |
255 | CFLAGS-test-ffs.c += -fno-builtin | |
256 | CFLAGS-tst-inlcall.c += -fno-builtin | |
257 | CFLAGS-tst-xbzero-opt.c += -O3 | |
0d40d0ec | 258 | CFLAGS-test-endian-sign-conversion.c += -Werror -Wsign-conversion |
570c4433 SL |
259 | # BZ 21006: Resolve all functions but at least explicit_bzero at startup. |
260 | # Otherwise the test fails on s390x as the memcpy in prepare_test_buffer is | |
261 | # done by loading r4 / r5 with the test_pattern and using store multiple | |
262 | # instruction to store r4 / r5 to buf. If explicit_bzero would be resolved in | |
263 | # setup_explicit_clear, r4 / r5 would be stored to stack by _dl_runtime_resolve | |
264 | # and the call to memmem in count_test_patterns will find a hit of the | |
265 | # test_pattern on the stack. | |
266 | LDFLAGS-tst-xbzero-opt = -z now | |
1f205a47 | 267 | |
10c85e76 | 268 | # Called during TLS initialization. |
e70c6fee L |
269 | CFLAGS-memcpy.c += $(no-stack-protector) |
270 | CFLAGS-wordcopy.c += $(no-stack-protector) | |
fb95c316 AZ |
271 | # Called during static initialization |
272 | CFLAGS-strncmp.c += $(no-stack-protector) | |
77c6a271 | 273 | CFLAGS-memset.c += $(no-stack-protector) |
10c85e76 | 274 | |
8d98c7c0 AZ |
275 | CFLAGS-argz-next.c += $(config-cflags-wno-ignored-attributes) |
276 | CFLAGS-basename.c += $(config-cflags-wno-ignored-attributes) | |
277 | CFLAGS-ffs.c += $(config-cflags-wno-ignored-attributes) | |
278 | CFLAGS-memmem.c += $(config-cflags-wno-ignored-attributes) | |
279 | CFLAGS-memchr.c += $(config-cflags-wno-ignored-attributes) | |
280 | CFLAGS-mempcpy.c += $(config-cflags-wno-ignored-attributes) | |
281 | CFLAGS-stpcpy.c += $(config-cflags-wno-ignored-attributes) | |
282 | CFLAGS-strnlen.c += $(config-cflags-wno-ignored-attributes) | |
283 | ||
03ac099f | 284 | ifeq ($(run-built-tests),yes) |
6e89caf1 | 285 | $(objpfx)tst-svc-cmp.out: tst-svc.expect $(objpfx)tst-svc.out |
f0881698 JM |
286 | cmp $^ > $@; \ |
287 | $(evaluate-test) | |
60cf80f0 MS |
288 | |
289 | LOCALES := de_DE.UTF-8 en_US.ISO-8859-1 en_US.UTF-8 \ | |
02018629 | 290 | tr_TR.ISO-8859-9 tr_TR.UTF-8 cs_CZ.UTF-8 \ |
c2723ce3 | 291 | da_DK.ISO-8859-1 en_GB.UTF-8 pt_BR.UTF-8 |
60cf80f0 MS |
292 | include ../gen-locales.mk |
293 | ||
294 | $(objpfx)test-strcasecmp.out: $(gen-locales) | |
295 | $(objpfx)test-strncasecmp.out: $(gen-locales) | |
296 | $(objpfx)tst-strxfrm.out: $(gen-locales) | |
297 | $(objpfx)tst-strxfrm2.out: $(gen-locales) | |
facdd9ea CD |
298 | # bug-strcoll2 needs cs_CZ.UTF-8 and da_DK.ISO-8859-1. |
299 | $(objpfx)bug-strcoll2.out: $(gen-locales) | |
5653ab12 | 300 | $(objpfx)tst-strcoll-overflow.out: $(gen-locales) |
c2723ce3 | 301 | $(objpfx)tst-strsignal.out: $(gen-locales) |
653200ef | 302 | $(objpfx)tst-strerror.out: $(gen-locales) |
60cf80f0 | 303 | |
e7a95dc6 | 304 | endif |