s390: Use dl-symbol-redir-ifunc.h on cpu-tunables
[glibc.git] / support / Makefile
blob9aa7f23a6e4b89d495f611dd532eb5ae1b7a5053
1 # Makefile for support library, used only at build and test time
2 # Copyright (C) 2016-2023 Free Software Foundation, Inc.
3 # This file is part of the GNU C Library.
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.
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.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with the GNU C Library; if not, see
17 # <https://www.gnu.org/licenses/>.
19 subdir := support
21 include ../Makeconfig
23 extra-libs := libsupport
24 extra-libs-others = $(extra-libs)
25 extra-libs-noinstall := $(extra-libs)
27 libsupport-routines = \
28 blob_repeat \
29 check \
30 check_addrinfo \
31 check_dns_packet \
32 check_hostent \
33 check_netent \
34 delayed_exit \
35 dtotimespec \
36 dtotimespec-time64 \
37 ignore_stderr \
38 next_to_fault \
39 oom_error \
40 resolv_response_context_duplicate \
41 resolv_response_context_free \
42 resolv_test \
43 set_fortify_handler \
44 support-open-dev-null-range \
45 support-xfstat \
46 support-xfstat-time64 \
47 support-xstat \
48 support-xstat-time64 \
49 support_become_root \
50 support_can_chroot \
51 support_capture_subprocess \
52 support_capture_subprocess_check \
53 support_chroot \
54 support_copy_file \
55 support_copy_file_range \
56 support_create_timer \
57 support_descriptor_supports_holes \
58 support_descriptors \
59 support_enter_mount_namespace \
60 support_enter_network_namespace \
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 \
67 support_isolate_in_subprocess \
68 support_mutex_pi_monotonic \
69 support_need_proc \
70 support_openpty \
71 support_path_support_time64 \
72 support_paths \
73 support_process_state \
74 support_ptrace \
75 support_quote_blob \
76 support_quote_blob_wide \
77 support_quote_string \
78 support_record_failure \
79 support_run_diff \
80 support_select_modifies_timeout \
81 support_select_normalizes_timeout \
82 support_set_small_thread_stack_size \
83 support_set_vma_name_supported \
84 support_shared_allocate \
85 support_small_stack_thread_attribute \
86 support_socket_so_timestamp_time64 \
87 support_stack_alloc \
88 support_stat_nanoseconds \
89 support_subprocess \
90 support_test_compare_blob \
91 support_test_compare_failure \
92 support_test_compare_string \
93 support_test_compare_string_wide \
94 support_test_main \
95 support_test_verify_impl \
96 support_wait_for_thread_exit \
97 support_write_file_string \
98 temp_file \
99 timespec \
100 timespec-add \
101 timespec-add-time64 \
102 timespec-sub \
103 timespec-sub-time64 \
104 timespec-time64 \
105 write_message \
106 xaccept \
107 xaccept4 \
108 xasprintf \
109 xbind \
110 xcalloc \
111 xchdir \
112 xchmod \
113 xchroot \
114 xclock_gettime \
115 xclock_gettime_time64 \
116 xclock_settime \
117 xclock_settime_time64 \
118 xclone \
119 xclose \
120 xconnect \
121 xcopy_file_range \
122 xdlfcn \
123 xdlmopen \
124 xdup2 \
125 xfchmod \
126 xfclose \
127 xfgets \
128 xfopen \
129 xfork \
130 xfread \
131 xfreopen \
132 xftruncate \
133 xgetline \
134 xgetsockname \
135 xlisten \
136 xlseek \
137 xlstat \
138 xlstat-time64 \
139 xmalloc \
140 xmemstream \
141 xmkdir \
142 xmkdirp \
143 xmkfifo \
144 xmmap \
145 xmprotect \
146 xmunmap \
147 xnewlocale \
148 xopen \
149 xpipe \
150 xpoll \
151 xposix_memalign \
152 xposix_spawn \
153 xposix_spawn_file_actions_addclose \
154 xposix_spawn_file_actions_adddup2 \
155 xpthread_attr_destroy \
156 xpthread_attr_init \
157 xpthread_attr_setaffinity_np \
158 xpthread_attr_setdetachstate \
159 xpthread_attr_setguardsize \
160 xpthread_attr_setstack \
161 xpthread_attr_setstacksize \
162 xpthread_barrier_destroy \
163 xpthread_barrier_init \
164 xpthread_barrier_wait \
165 xpthread_barrierattr_destroy \
166 xpthread_barrierattr_init \
167 xpthread_barrierattr_setpshared \
168 xpthread_cancel \
169 xpthread_check_return \
170 xpthread_cond_signal \
171 xpthread_cond_wait \
172 xpthread_create \
173 xpthread_detach \
174 xpthread_join \
175 xpthread_key_create \
176 xpthread_key_delete \
177 xpthread_kill \
178 xpthread_mutex_consistent \
179 xpthread_mutex_destroy \
180 xpthread_mutex_init \
181 xpthread_mutex_lock \
182 xpthread_mutex_unlock \
183 xpthread_mutexattr_destroy \
184 xpthread_mutexattr_init \
185 xpthread_mutexattr_setprotocol \
186 xpthread_mutexattr_setpshared \
187 xpthread_mutexattr_setrobust \
188 xpthread_mutexattr_settype \
189 xpthread_once \
190 xpthread_rwlock_destroy \
191 xpthread_rwlock_init \
192 xpthread_rwlock_rdlock \
193 xpthread_rwlock_unlock \
194 xpthread_rwlock_wrlock \
195 xpthread_rwlockattr_init \
196 xpthread_rwlockattr_setkind_np \
197 xpthread_sigmask \
198 xpthread_spin_lock \
199 xpthread_spin_unlock \
200 xraise \
201 xread \
202 xreadlink \
203 xrealloc \
204 xrecvfrom \
205 xsendto \
206 xsetlocale \
207 xsetsockopt \
208 xsigaction \
209 xsignal \
210 xsigstack \
211 xsocket \
212 xstrdup \
213 xstrndup \
214 xsymlink \
215 xsysconf \
216 xsystem \
217 xunlink \
218 xuselocale \
219 xwaitpid \
220 xwrite \
221 # libsupport-routines
223 libsupport-static-only-routines := $(libsupport-routines)
224 # Only build one variant of the library.
225 libsupport-inhibit-o := .os
226 ifeq ($(build-shared),yes)
227 libsupport-inhibit-o += .o
228 endif
230 CFLAGS-support_paths.c = \
231 -DSRCDIR_PATH=\"`cd .. ; pwd`\" \
232 -DOBJDIR_PATH=\"`cd $(objpfx)/..; pwd`\" \
233 -DOBJDIR_ELF_LDSO_PATH=\"`cd $(objpfx)/..; pwd`/elf/$(rtld-installed-name)\" \
234 -DINSTDIR_PATH=\"$(prefix)\" \
235 -DLIBDIR_PATH=\"$(libdir)\" \
236 -DBINDIR_PATH=\"$(bindir)\" \
237 -DSBINDIR_PATH=\"$(sbindir)\" \
238 -DSLIBDIR_PATH=\"$(slibdir)\" \
239 -DROOTSBINDIR_PATH=\"$(rootsbindir)\" \
240 -DCOMPLOCALEDIR_PATH=\"$(complocaledir)\" \
241 -DSYSCONFDIR_PATH=\"$(sysconfdir)\"
243 # Build with exception handling and asynchronous unwind table support.
244 CFLAGS-.oS += -fexceptions -fasynchronous-unwind-tables
246 # In support_timespec_check_in_range we may be passed a very tight
247 # range for which we should produce a correct result for expected
248 # being within the observed range. The code uses double internally
249 # in support_timespec_check_in_range and for that computation we use
250 # -fexcess-precision=standard.
251 CFLAGS-timespec.c += -fexcess-precision=standard
252 CFLAGS-timespec-time64.c += -fexcess-precision=standard
254 # Ensure that general support files use 64-bit time_t
255 CFLAGS-delayed_exit.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
256 CFLAGS-shell-container.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
257 CFLAGS-support_can_chroot.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
258 CFLAGS-support_copy_file.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
259 CFLAGS-support_copy_file_range.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
260 CFLAGS-support_descriptor_supports_holes.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
261 CFLAGS-support_descriptors.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
262 CFLAGS-support_process_state.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
263 CFLAGS-support_stat_nanoseconds.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
264 CFLAGS-support_subprocess.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
265 CFLAGS-support_test_main.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
266 CFLAGS-test-container.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
267 CFLAGS-xmkdirp.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
268 # This is required to get an mkstemp which can create large files on some
269 # 32-bit platforms.
270 CFLAGS-temp_file.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
272 ifeq (,$(CXX))
273 LINKS_DSO_PROGRAM = links-dso-program-c
274 else
275 LINKS_DSO_PROGRAM = links-dso-program
276 LDLIBS-links-dso-program = -lstdc++ -lgcc -lgcc_s $(libunwind)
277 endif
279 ifeq (yes,$(have-selinux))
280 LDLIBS-$(LINKS_DSO_PROGRAM) += -lselinux
281 endif
284 LDLIBS-test-container = $(libsupport)
286 others += test-container
287 others-noinstall += test-container
289 others += \
290 echo-container \
291 shell-container \
292 true-container \
293 # others
294 others-noinstall += \
295 echo-container \
296 shell-container \
297 true-container \
298 # others-noinstall
300 others += $(LINKS_DSO_PROGRAM)
301 others-noinstall += $(LINKS_DSO_PROGRAM)
303 others += test-run-command
304 others-static += test-run-command
305 others-noinstall += test-run-command
306 LDLIBS-test-run-command = $(libsupport)
308 $(objpfx)test-container : $(libsupport)
309 $(objpfx)shell-container : $(libsupport)
310 $(objpfx)echo-container : $(libsupport)
311 $(objpfx)true-container : $(libsupport)
312 $(objpfx)test-run-command : $(libsupport) $(common-objpfx)elf/static-stubs.o
314 tests = \
315 README-testing \
316 tst-support-namespace \
317 tst-support-open-dev-null-range \
318 tst-support-process_state \
319 tst-support_blob_repeat \
320 tst-support_capture_subprocess \
321 tst-support_descriptors \
322 tst-support_format_dns_packet \
323 tst-support_quote_blob \
324 tst-support_quote_blob_wide \
325 tst-support_quote_string \
326 tst-support_record_failure \
327 tst-test_compare \
328 tst-test_compare_blob \
329 tst-test_compare_string \
330 tst-test_compare_string_wide \
331 tst-timespec \
332 tst-xreadlink \
333 tst-xsigstack \
334 # tests
336 ifeq ($(run-built-tests),yes)
337 tests-special = \
338 $(objpfx)tst-support_record_failure-2.out
340 $(objpfx)tst-support_record_failure-2.out: tst-support_record_failure-2.sh \
341 $(objpfx)tst-support_record_failure
342 $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
343 '$(run-program-env)' '$(test-program-prefix-after-env)' \
344 > $@; \
345 $(evaluate-test)
346 endif
348 tests-special += $(objpfx)tst-glibcpp.out
350 $(objpfx)tst-glibcpp.out: tst-glibcpp.py $(..)scripts/glibcpp.py
351 PYTHONPATH=$(..)scripts $(PYTHON) tst-glibcpp.py > $@ 2>&1; \
352 $(evaluate-test)
354 $(objpfx)tst-support_format_dns_packet: $(common-objpfx)resolv/libresolv.so
356 tst-support_capture_subprocess-ARGS = -- $(host-test-program-cmd)
358 include ../Rules