]>
Commit | Line | Data |
---|---|---|
c23de0aa | 1 | # Makefile for support library, used only at build and test time |
dff8da6b | 2 | # Copyright (C) 2016-2024 Free Software Foundation, Inc. |
c23de0aa FW |
3 | # This file is part of the GNU C Library. |
4 | ||
5 | # The GNU C Library is free software; you can redistribute it and/or | |
6 | # modify it under the terms of the GNU Lesser General Public | |
7 | # License as published by the Free Software Foundation; either | |
8 | # version 2.1 of the License, or (at your option) any later version. | |
9 | ||
10 | # The GNU C Library is distributed in the hope that it will be useful, | |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | # Lesser General Public License for more details. | |
14 | ||
15 | # You should have received a copy of the GNU Lesser General Public | |
16 | # License along with the GNU C Library; if not, see | |
5a82c748 | 17 | # <https://www.gnu.org/licenses/>. |
c23de0aa FW |
18 | |
19 | subdir := support | |
20 | ||
21 | include ../Makeconfig | |
22 | ||
23 | extra-libs := libsupport | |
24 | extra-libs-others = $(extra-libs) | |
25 | extra-libs-noinstall := $(extra-libs) | |
26 | ||
27 | libsupport-routines = \ | |
f5e7e959 | 28 | blob_repeat \ |
c23de0aa | 29 | check \ |
5840c75c FW |
30 | check_addrinfo \ |
31 | check_dns_packet \ | |
32 | check_hostent \ | |
33 | check_netent \ | |
c23de0aa | 34 | delayed_exit \ |
436a604b AY |
35 | dtotimespec \ |
36 | dtotimespec-time64 \ | |
c23de0aa | 37 | ignore_stderr \ |
cae87e64 | 38 | next_to_fault \ |
c23de0aa | 39 | oom_error \ |
873e239a FW |
40 | resolv_response_context_duplicate \ |
41 | resolv_response_context_free \ | |
5840c75c | 42 | resolv_test \ |
c23de0aa | 43 | set_fortify_handler \ |
da55fae9 | 44 | support-open-dev-null-range \ |
5707a64d | 45 | support_become_root \ |
2714c5f3 | 46 | support_can_chroot \ |
91b6eb11 | 47 | support_capture_subprocess \ |
2714c5f3 | 48 | support_capture_subprocess_check \ |
e7c14e54 FW |
49 | support_check_stat_fd \ |
50 | support_check_stat_path \ | |
d4165eed | 51 | support_chroot \ |
96d0bf98 JM |
52 | support_compare_file_bytes \ |
53 | support_compare_file_string \ | |
603ae243 | 54 | support_copy_file \ |
81b9d87b | 55 | support_copy_file_range \ |
92f7b465 | 56 | support_create_timer \ |
aa42b3db | 57 | support_descriptor_supports_holes \ |
f255336a | 58 | support_descriptors \ |
273a0c49 | 59 | support_enter_mount_namespace \ |
5707a64d | 60 | support_enter_network_namespace \ |
5840c75c FW |
61 | support_format_address_family \ |
62 | support_format_addrinfo \ | |
63 | support_format_dns_packet \ | |
64 | support_format_herrno \ | |
65 | support_format_hostent \ | |
66 | support_format_netent \ | |
f169509d | 67 | support_fuse \ |
2714c5f3 | 68 | support_isolate_in_subprocess \ |
9cba3fa3 | 69 | support_mutex_pi_monotonic \ |
2fe64148 | 70 | support_need_proc \ |
96d0bf98 JM |
71 | support_open_and_compare_file_bytes \ |
72 | support_open_and_compare_file_string \ | |
da55fae9 | 73 | support_openpty \ |
b2970919 | 74 | support_path_support_time64 \ |
da55fae9 | 75 | support_paths \ |
dfe9aa91 | 76 | support_process_state \ |
2f9046fb | 77 | support_ptrace \ |
2afece36 | 78 | support_quote_blob \ |
de82cb0d | 79 | support_quote_blob_wide \ |
c74a91de | 80 | support_quote_string \ |
1251e9ea | 81 | support_readdir \ |
3b1d3217 FW |
82 | support_readdir_check \ |
83 | support_readdir_r_check \ | |
5f0b8437 | 84 | support_record_failure \ |
5840c75c | 85 | support_run_diff \ |
5628f103 | 86 | support_select_modifies_timeout \ |
49a40ba1 | 87 | support_select_normalizes_timeout \ |
36ada9ee | 88 | support_set_small_thread_stack_size \ |
ed318bea | 89 | support_set_vma_name_supported \ |
2714c5f3 | 90 | support_shared_allocate \ |
36ada9ee | 91 | support_small_stack_thread_attribute \ |
38bc0f4e | 92 | support_socket_so_timestamp_time64 \ |
da55fae9 | 93 | support_stack_alloc \ |
1966f47a | 94 | support_stat_nanoseconds \ |
0e169691 | 95 | support_subprocess \ |
2afece36 | 96 | support_test_compare_blob \ |
93485524 | 97 | support_test_compare_failure \ |
1df872fd | 98 | support_test_compare_string \ |
de82cb0d | 99 | support_test_compare_string_wide \ |
c23de0aa | 100 | support_test_main \ |
5f0b8437 | 101 | support_test_verify_impl \ |
032d74ea FW |
102 | support_wait_for_thread_exit \ |
103 | support_write_file_string \ | |
c23de0aa | 104 | temp_file \ |
51983996 MC |
105 | timespec \ |
106 | timespec-add \ | |
e9bc2b3b | 107 | timespec-add-time64 \ |
51983996 | 108 | timespec-sub \ |
e9bc2b3b | 109 | timespec-sub-time64 \ |
da55fae9 | 110 | timespec-time64 \ |
c23de0aa | 111 | write_message \ |
5840c75c | 112 | xaccept \ |
e9203023 | 113 | xaccept4 \ |
c23de0aa | 114 | xasprintf \ |
5840c75c | 115 | xbind \ |
c23de0aa | 116 | xcalloc \ |
a7e9dbb7 | 117 | xchdir \ |
da55fae9 | 118 | xchmod \ |
2714c5f3 | 119 | xchroot \ |
33647a72 | 120 | xclock_gettime \ |
e9bc2b3b | 121 | xclock_gettime_time64 \ |
a1565550 | 122 | xclock_settime \ |
e9bc2b3b | 123 | xclock_settime_time64 \ |
de8995a2 | 124 | xclone \ |
ed3ea040 | 125 | xclose \ |
3b1d3217 | 126 | xclosedir \ |
5840c75c | 127 | xconnect \ |
81b9d87b | 128 | xcopy_file_range \ |
1cc9e59a | 129 | xdlfcn \ |
94b63e66 | 130 | xdlmopen \ |
91b6eb11 | 131 | xdup2 \ |
7a722654 | 132 | xfchmod \ |
5840c75c | 133 | xfclose \ |
3b1d3217 | 134 | xfdopendir \ |
7ba426a1 | 135 | xfgets \ |
5840c75c | 136 | xfopen \ |
5f0b8437 | 137 | xfork \ |
a84dcb4b | 138 | xfread \ |
dee2bea0 | 139 | xfreopen \ |
bad7a0c8 | 140 | xftruncate \ |
dfe9aa91 | 141 | xgetline \ |
6687a6e3 | 142 | xgetpeername \ |
5840c75c FW |
143 | xgetsockname \ |
144 | xlisten \ | |
bad7a0c8 | 145 | xlseek \ |
c23de0aa | 146 | xmalloc \ |
5840c75c | 147 | xmemstream \ |
2714c5f3 | 148 | xmkdir \ |
561b0bec | 149 | xmkdirp \ |
e3fdbe9f | 150 | xmkfifo \ |
faf0e9c8 | 151 | xmmap \ |
60149b28 | 152 | xmprotect \ |
faf0e9c8 | 153 | xmunmap \ |
653200ef | 154 | xnewlocale \ |
2714c5f3 | 155 | xopen \ |
3b1d3217 | 156 | xopendir \ |
91b6eb11 | 157 | xpipe \ |
5840c75c | 158 | xpoll \ |
bc79db3f | 159 | xposix_memalign \ |
da55fae9 CD |
160 | xposix_spawn \ |
161 | xposix_spawn_file_actions_addclose \ | |
162 | xposix_spawn_file_actions_adddup2 \ | |
f8bf15fe CD |
163 | xpthread_attr_destroy \ |
164 | xpthread_attr_init \ | |
da55fae9 | 165 | xpthread_attr_setaffinity_np \ |
f8bf15fe | 166 | xpthread_attr_setdetachstate \ |
0edbf123 | 167 | xpthread_attr_setguardsize \ |
bc79db3f | 168 | xpthread_attr_setstack \ |
446d22e9 | 169 | xpthread_attr_setstacksize \ |
c23de0aa FW |
170 | xpthread_barrier_destroy \ |
171 | xpthread_barrier_init \ | |
172 | xpthread_barrier_wait \ | |
0ce2fa69 FW |
173 | xpthread_barrierattr_destroy \ |
174 | xpthread_barrierattr_init \ | |
175 | xpthread_barrierattr_setpshared \ | |
c23de0aa FW |
176 | xpthread_cancel \ |
177 | xpthread_check_return \ | |
3bea50cc | 178 | xpthread_cond_signal \ |
da55fae9 | 179 | xpthread_cond_wait \ |
c23de0aa FW |
180 | xpthread_create \ |
181 | xpthread_detach \ | |
182 | xpthread_join \ | |
a9bfa435 MD |
183 | xpthread_key_create \ |
184 | xpthread_key_delete \ | |
0280b390 | 185 | xpthread_kill \ |
faf0e9c8 FW |
186 | xpthread_mutex_consistent \ |
187 | xpthread_mutex_destroy \ | |
188 | xpthread_mutex_init \ | |
c23de0aa FW |
189 | xpthread_mutex_lock \ |
190 | xpthread_mutex_unlock \ | |
faf0e9c8 FW |
191 | xpthread_mutexattr_destroy \ |
192 | xpthread_mutexattr_init \ | |
193 | xpthread_mutexattr_setprotocol \ | |
194 | xpthread_mutexattr_setpshared \ | |
195 | xpthread_mutexattr_setrobust \ | |
196 | xpthread_mutexattr_settype \ | |
5840c75c | 197 | xpthread_once \ |
5fc9ed4c | 198 | xpthread_rwlock_destroy \ |
da55fae9 | 199 | xpthread_rwlock_init \ |
faf8c066 | 200 | xpthread_rwlock_rdlock \ |
faf8c066 | 201 | xpthread_rwlock_unlock \ |
1ffe1ccb | 202 | xpthread_rwlock_wrlock \ |
faf8c066 CD |
203 | xpthread_rwlockattr_init \ |
204 | xpthread_rwlockattr_setkind_np \ | |
c23de0aa FW |
205 | xpthread_sigmask \ |
206 | xpthread_spin_lock \ | |
207 | xpthread_spin_unlock \ | |
446d22e9 | 208 | xraise \ |
20b6b8e8 | 209 | xread \ |
1ffe1ccb | 210 | xreadlink \ |
c23de0aa | 211 | xrealloc \ |
5840c75c FW |
212 | xrecvfrom \ |
213 | xsendto \ | |
cce35a50 | 214 | xsetlocale \ |
5840c75c | 215 | xsetsockopt \ |
446d22e9 FW |
216 | xsigaction \ |
217 | xsignal \ | |
fbbc9a4e | 218 | xsigstack \ |
5707a64d | 219 | xsocket \ |
92169051 | 220 | xstatx \ |
5840c75c | 221 | xstrdup \ |
1ffe1ccb | 222 | xstrndup \ |
561b0bec | 223 | xsymlink \ |
446d22e9 | 224 | xsysconf \ |
8022fc7d | 225 | xsystem \ |
1ffe1ccb | 226 | xunlink \ |
653200ef | 227 | xuselocale \ |
5f0b8437 | 228 | xwaitpid \ |
5840c75c | 229 | xwrite \ |
da55fae9 | 230 | # libsupport-routines |
c23de0aa FW |
231 | |
232 | libsupport-static-only-routines := $(libsupport-routines) | |
233 | # Only build one variant of the library. | |
234 | libsupport-inhibit-o := .os | |
235 | ifeq ($(build-shared),yes) | |
236 | libsupport-inhibit-o += .o | |
237 | endif | |
238 | ||
561b0bec DD |
239 | CFLAGS-support_paths.c = \ |
240 | -DSRCDIR_PATH=\"`cd .. ; pwd`\" \ | |
241 | -DOBJDIR_PATH=\"`cd $(objpfx)/..; pwd`\" \ | |
e7624d70 | 242 | -DOBJDIR_ELF_LDSO_PATH=\"`cd $(objpfx)/..; pwd`/elf/$(rtld-installed-name)\" \ |
561b0bec | 243 | -DINSTDIR_PATH=\"$(prefix)\" \ |
c7ac9caa | 244 | -DLIBDIR_PATH=\"$(libdir)\" \ |
d50f0918 | 245 | -DBINDIR_PATH=\"$(bindir)\" \ |
75c51570 | 246 | -DSBINDIR_PATH=\"$(sbindir)\" \ |
cb81264f | 247 | -DSLIBDIR_PATH=\"$(slibdir)\" \ |
92954ffa | 248 | -DROOTSBINDIR_PATH=\"$(rootsbindir)\" \ |
57ce87a9 RG |
249 | -DCOMPLOCALEDIR_PATH=\"$(complocaledir)\" \ |
250 | -DSYSCONFDIR_PATH=\"$(sysconfdir)\" | |
561b0bec | 251 | |
1d5024f4 JDA |
252 | # Build with exception handling and asynchronous unwind table support. |
253 | CFLAGS-.oS += -fexceptions -fasynchronous-unwind-tables | |
254 | ||
f896fc0f L |
255 | # In support_timespec_check_in_range we may be passed a very tight |
256 | # range for which we should produce a correct result for expected | |
7f0d9e61 | 257 | # being within the observed range. The code uses double internally |
f896fc0f L |
258 | # in support_timespec_check_in_range and for that computation we use |
259 | # -fexcess-precision=standard. | |
260 | CFLAGS-timespec.c += -fexcess-precision=standard | |
e9bc2b3b | 261 | CFLAGS-timespec-time64.c += -fexcess-precision=standard |
f896fc0f | 262 | |
3bfdc4e2 AS |
263 | # Ensure that general support files use 64-bit time_t |
264 | CFLAGS-delayed_exit.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
265 | CFLAGS-shell-container.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
266 | CFLAGS-support_can_chroot.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
267 | CFLAGS-support_copy_file.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
268 | CFLAGS-support_copy_file_range.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
269 | CFLAGS-support_descriptor_supports_holes.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
270 | CFLAGS-support_descriptors.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
271 | CFLAGS-support_process_state.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
272 | CFLAGS-support_stat_nanoseconds.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
273 | CFLAGS-support_subprocess.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
274 | CFLAGS-support_test_main.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
275 | CFLAGS-test-container.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
276 | CFLAGS-xmkdirp.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
277 | # This is required to get an mkstemp which can create large files on some | |
278 | # 32-bit platforms. | |
279 | CFLAGS-temp_file.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 | |
280 | ||
561b0bec DD |
281 | ifeq (,$(CXX)) |
282 | LINKS_DSO_PROGRAM = links-dso-program-c | |
283 | else | |
284 | LINKS_DSO_PROGRAM = links-dso-program | |
acc2842a | 285 | LDLIBS-links-dso-program = -lstdc++ -lgcc -lgcc_s $(libunwind) |
561b0bec DD |
286 | endif |
287 | ||
99135114 DD |
288 | ifeq (yes,$(have-selinux)) |
289 | LDLIBS-$(LINKS_DSO_PROGRAM) += -lselinux | |
290 | endif | |
291 | ||
292 | ||
561b0bec DD |
293 | LDLIBS-test-container = $(libsupport) |
294 | ||
295 | others += test-container | |
296 | others-noinstall += test-container | |
297 | ||
da55fae9 CD |
298 | others += \ |
299 | echo-container \ | |
300 | shell-container \ | |
301 | true-container \ | |
302 | # others | |
303 | others-noinstall += \ | |
304 | echo-container \ | |
305 | shell-container \ | |
306 | true-container \ | |
307 | # others-noinstall | |
561b0bec DD |
308 | |
309 | others += $(LINKS_DSO_PROGRAM) | |
310 | others-noinstall += $(LINKS_DSO_PROGRAM) | |
311 | ||
e6fd79f3 CLT |
312 | others += test-run-command |
313 | others-static += test-run-command | |
314 | others-noinstall += test-run-command | |
315 | LDLIBS-test-run-command = $(libsupport) | |
316 | ||
561b0bec DD |
317 | $(objpfx)test-container : $(libsupport) |
318 | $(objpfx)shell-container : $(libsupport) | |
319 | $(objpfx)echo-container : $(libsupport) | |
320 | $(objpfx)true-container : $(libsupport) | |
e6fd79f3 | 321 | $(objpfx)test-run-command : $(libsupport) $(common-objpfx)elf/static-stubs.o |
561b0bec | 322 | |
5f0b8437 FW |
323 | tests = \ |
324 | README-testing \ | |
5707a64d | 325 | tst-support-namespace \ |
e6e6184b FW |
326 | tst-support-open-dev-null-range \ |
327 | tst-support-process_state \ | |
f5e7e959 | 328 | tst-support_blob_repeat \ |
91b6eb11 | 329 | tst-support_capture_subprocess \ |
f255336a | 330 | tst-support_descriptors \ |
f889e73f | 331 | tst-support_format_dns_packet \ |
f169509d | 332 | tst-support_fuse \ |
2afece36 | 333 | tst-support_quote_blob \ |
de82cb0d | 334 | tst-support_quote_blob_wide \ |
c74a91de | 335 | tst-support_quote_string \ |
1251e9ea | 336 | tst-support_readdir \ |
5f0b8437 | 337 | tst-support_record_failure \ |
93485524 | 338 | tst-test_compare \ |
2afece36 | 339 | tst-test_compare_blob \ |
1df872fd | 340 | tst-test_compare_string \ |
de82cb0d | 341 | tst-test_compare_string_wide \ |
04deeaa9 | 342 | tst-timespec \ |
3b1d3217 | 343 | tst-xdirent \ |
1ffe1ccb | 344 | tst-xreadlink \ |
fbbc9a4e | 345 | tst-xsigstack \ |
da55fae9 | 346 | # tests |
5f0b8437 | 347 | |
ef83c83a | 348 | ifeq ($(run-built-tests),yes) |
5f0b8437 FW |
349 | tests-special = \ |
350 | $(objpfx)tst-support_record_failure-2.out | |
351 | ||
352 | $(objpfx)tst-support_record_failure-2.out: tst-support_record_failure-2.sh \ | |
353 | $(objpfx)tst-support_record_failure | |
354 | $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \ | |
355 | '$(run-program-env)' '$(test-program-prefix-after-env)' \ | |
356 | > $@; \ | |
357 | $(evaluate-test) | |
ef83c83a | 358 | endif |
c23de0aa | 359 | |
e6e6184b FW |
360 | tests-special += $(objpfx)tst-glibcpp.out |
361 | ||
362 | $(objpfx)tst-glibcpp.out: tst-glibcpp.py $(..)scripts/glibcpp.py | |
363 | PYTHONPATH=$(..)scripts $(PYTHON) tst-glibcpp.py > $@ 2>&1; \ | |
364 | $(evaluate-test) | |
365 | ||
f889e73f FW |
366 | $(objpfx)tst-support_format_dns_packet: $(common-objpfx)resolv/libresolv.so |
367 | ||
0e169691 AZ |
368 | tst-support_capture_subprocess-ARGS = -- $(host-test-program-cmd) |
369 | ||
c23de0aa | 370 | include ../Rules |