]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/Makefile
nptl: Add glibc.pthread.rseq tunable to control rseq registration
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / Makefile
1 # Option to pass to Python scripts to set the C compiler. Rewriting
2 # MODULE_NAME is required to enable the _ISOMAC verbatim header
3 # environment.
4 sysdeps-linux-python-cc = \
5 --cc="$(CC) $(patsubst -DMODULE_NAME=%,-DMODULE_NAME=testsuite,$(CPPFLAGS))"
6
7 # Additional dependencies for Python scripts.
8 sysdeps-linux-python-deps = \
9 $(..)sysdeps/unix/sysv/linux/glibcsyscalls.py \
10 $(..)scripts/glibcextract.py
11
12 # Invocation of the Python interpreter with the Python search path.
13 sysdeps-linux-python = \
14 PYTHONPATH=$(..)scripts:$(..)sysdeps/unix/sysv/linux $(PYTHON)
15
16 ifndef subdir
17 # This target performs two actions:
18 #
19 # Replace <arch-syscall.h> with a file generated from kernel headers
20 # and <fixup-asm-unistd.h>. Both files are located via the sysdeps
21 # override search path.
22 #
23 # Update sysdeps/unix/sysv/linux/syscall-names.list with additional
24 # names found in the generated <arch-syscall.h> file, so that the
25 # global system call names list is a superset of the
26 # architecture-specific system call names.
27 #
28 # To bootstrap a new architecture, create an empty file in the right
29 # place and run `make update-syscall-lists' from the top-level of a
30 # configured, but not-yet-built glibc tree.
31 #
32 # --lock points to a file not replaced during the update operation, so
33 # that mutual exclusion is achieved.
34 .PHONY: update-syscall-lists
35 update-syscall-lists: arch-syscall.h
36 $(sysdeps-linux-python) \
37 sysdeps/unix/sysv/linux/update-syscall-lists.py \
38 $(sysdeps-linux-python-cc) \
39 --lock=sysdeps/unix/sysv/linux/update-syscall-lists.py $< \
40 sysdeps/unix/sysv/linux/syscall-names.list
41 endif
42
43 ifeq ($(subdir),csu)
44 sysdep_routines += errno-loc
45 endif
46
47 ifeq ($(subdir),assert)
48 CFLAGS-assert.c += -DFATAL_PREPARE_INCLUDE='<fatal-prepare.h>'
49 CFLAGS-assert-perr.c += -DFATAL_PREPARE_INCLUDE='<fatal-prepare.h>'
50 endif
51
52 ifeq ($(subdir),malloc)
53 CFLAGS-malloc.c += -DMORECORE_CLEARS=2
54 endif
55
56 ifeq ($(subdir),misc)
57 sysdep_routines += adjtimex clone umount umount2 readahead sysctl \
58 setfsuid setfsgid epoll_pwait signalfd \
59 eventfd eventfd_read eventfd_write prlimit prlimit64 \
60 personality epoll_wait tee vmsplice splice \
61 open_by_handle_at mlock2 pkey_mprotect pkey_set pkey_get \
62 timerfd_gettime timerfd_settime prctl \
63 process_vm_readv process_vm_writev clock_adjtime \
64 pselect32 \
65 xstat fxstat lxstat xstat64 fxstat64 lxstat64 \
66 fxstatat fxstatat64 \
67 xmknod xmknodat convert_scm_timestamps \
68 closefrom_fallback \
69 clone3 clone-internal \
70 fanotify_mark \
71 mremap \
72
73 CFLAGS-gethostid.c = -fexceptions
74 CFLAGS-tee.c = -fexceptions -fasynchronous-unwind-tables
75 CFLAGS-vmsplice.c = -fexceptions -fasynchronous-unwind-tables
76 CFLAGS-splice.c = -fexceptions -fasynchronous-unwind-tables
77 CFLAGS-open_by_handle_at.c = -fexceptions -fasynchronous-unwind-tables
78 CFLAGS-sync_file_range.c = -fexceptions -fasynchronous-unwind-tables
79 CFLAGS-pselect32.c = -fexceptions -fasynchronous-unwind-tables
80 CFLAGS-tst-writev.c += "-DARTIFICIAL_LIMIT=(0x80000000-sysconf(_SC_PAGESIZE))"
81
82 sysdep_headers += sys/mount.h sys/acct.h \
83 sys/klog.h \
84 sys/user.h sys/prctl.h \
85 sys/kd.h sys/soundcard.h sys/vt.h \
86 sys/quota.h sys/fsuid.h \
87 scsi/sg.h scsi/scsi.h scsi/scsi_ioctl.h sys/pci.h \
88 sys/raw.h sys/personality.h sys/epoll.h \
89 bits/a.out.h sys/inotify.h sys/signalfd.h sys/eventfd.h \
90 sys/timerfd.h sys/fanotify.h bits/eventfd.h bits/inotify.h \
91 bits/signalfd.h bits/timerfd.h bits/epoll.h \
92 bits/socket_type.h bits/syscall.h \
93 bits/mman-linux.h bits/mman-shared.h bits/ptrace-shared.h \
94 bits/siginfo-arch.h bits/siginfo-consts-arch.h \
95 bits/procfs.h bits/procfs-id.h bits/procfs-extra.h \
96 bits/procfs-prregset.h bits/mman-map-flags-generic.h \
97 bits/shmlba.h \
98 bits/termios-struct.h bits/termios-c_cc.h \
99 bits/termios-c_iflag.h bits/termios-c_oflag.h \
100 bits/termios-baud.h bits/termios-c_cflag.h \
101 bits/termios-c_lflag.h bits/termios-tcflow.h \
102 bits/termios-misc.h \
103 bits/types/struct_semid_ds.h \
104 bits/types/struct_msqid_ds.h \
105 bits/types/struct_shmid_ds.h \
106 bits/ipc-perm.h \
107 bits/struct_stat.h \
108 bits/struct_stat_time64_helper.h \
109 bits/types/struct_msqid64_ds.h \
110 bits/types/struct_msqid64_ds_helper.h \
111 bits/types/struct_semid64_ds.h \
112 bits/types/struct_semid64_ds_helper.h \
113 bits/types/struct_shmid64_ds.h \
114 bits/types/struct_shmid64_ds_helper.h \
115 bits/pthread_stack_min.h bits/pthread_stack_min-dynamic.h
116
117 tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
118 tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
119 test-errno-linux tst-memfd_create tst-mlock2 tst-pkey \
120 tst-rlimit-infinity tst-ofdlocks tst-gettid tst-gettid-kill \
121 tst-tgkill tst-sysvsem-linux tst-sysvmsg-linux tst-sysvshm-linux \
122 tst-timerfd tst-ppoll \
123 tst-clock_adjtime tst-adjtimex tst-ntp_adjtime tst-ntp_gettime \
124 tst-ntp_gettimex tst-sigtimedwait tst-misalign-clone \
125 tst-prctl \
126 tst-scm_rights \
127 # tests
128
129 # Test for the symbol version of fcntl that was replaced in glibc 2.28.
130 ifeq ($(have-GLIBC_2.27)$(build-shared),yesyes)
131 tests += tst-ofdlocks-compat
132 endif
133
134 tests-internal += \
135 tst-rseq \
136 tst-sigcontext-get_pc \
137 # tests-internal
138
139 ifneq (no,$(have-tunables))
140 tests-internal += \
141 tst-rseq-disable \
142 # tests-internal $(have-tunables)
143 endif
144
145 tests-time64 += \
146 tst-adjtimex-time64 \
147 tst-clock_adjtime-time64 \
148 tst-ntp_adjtime-time64 \
149 tst-ntp_gettime-time64 \
150 tst-ntp_gettimex-time64 \
151 tst-ppoll-time64 \
152 tst-sigtimedwait-time64 \
153 tst-timerfd-time64 \
154 tst-prctl-time64 \
155 tst-scm_rights-time64 \
156 # tests-time64
157
158 tests-clone-internal = \
159 tst-align-clone-internal \
160 tst-clone2-internal \
161 tst-clone3-internal \
162 tst-getpid1-internal \
163 tst-misalign-clone-internal
164 tests-internal += $(tests-clone-internal)
165 tests-static += $(tests-clone-internal)
166
167 CFLAGS-tst-sigcontext-get_pc.c = -fasynchronous-unwind-tables
168
169 # Generate the list of SYS_* macros for the system calls (__NR_*
170 # macros). The file syscall-names.list contains all possible system
171 # call names, and the generated header file produces SYS_* macros for
172 # the __NR_* macros which are actually defined.
173
174 generated += bits/syscall.h
175 $(objpfx)bits/syscall.h: \
176 ../sysdeps/unix/sysv/linux/gen-syscall-h.awk \
177 ../sysdeps/unix/sysv/linux/syscall-names.list
178 $(make-target-directory)
179 LC_ALL=C $(AWK) -f $^ > $@-tmp
180 $(move-if-change) $@-tmp $@
181 before-compile += $(objpfx)bits/syscall.h
182
183 # All macros defined by <sys/syscall.h>. Include <bits/syscall.h>
184 # explicitly because <sys/sycall.h> skips it if _LIBC is defined.
185 $(objpfx)tst-syscall-list-macros.list: \
186 $(objpfx)bits/syscall.h ../sysdeps/unix/sysv/linux/sys/syscall.h
187 printf '#include <linux/version.h>\n\
188 #include <sys/syscall.h>\n#include <bits/syscall.h>\n' | \
189 $(CC) -E -o $@-tmp $(CFLAGS) $(CPPFLAGS) -x c - -dM
190 $(move-if-change) $@-tmp $@
191
192 # __NR_* system call names. Used by the test below.
193 $(objpfx)tst-syscall-list-nr.list: \
194 ../sysdeps/unix/sysv/linux/filter-nr-syscalls.awk \
195 $(objpfx)tst-syscall-list-macros.list
196 LC_ALL=C $(AWK) -f $^ > $@-tmp
197 $(move-if-change) $@-tmp $@
198
199 # SYS_* system call names. Used by the test below.
200 $(objpfx)tst-syscall-list-sys.list: $(objpfx)tst-syscall-list-macros.list
201 LC_ALL=C $(AWK) '/^#define SYS_/ { print substr($$2, 5) }' $< > $@-tmp
202 $(move-if-change) $@-tmp $@
203
204 tests-special += $(objpfx)tst-syscall-list.out
205 $(objpfx)tst-syscall-list.out: \
206 ../sysdeps/unix/sysv/linux/tst-syscall-list.sh \
207 $(objpfx)tst-syscall-list-macros.list \
208 $(objpfx)tst-syscall-list-nr.list \
209 $(objpfx)tst-syscall-list-sys.list
210 $(BASH) $^ $(AWK) > $@; $(evaluate-test)
211
212 tests-special += $(objpfx)tst-glibcsyscalls.out
213 # arch-syscall.h is located via the sysdeps override search path.
214 $(objpfx)tst-glibcsyscalls.out: arch-syscall.h \
215 ../sysdeps/unix/sysv/linux/syscall-names.list
216 $(sysdeps-linux-python) \
217 ../sysdeps/unix/sysv/linux/tst-glibcsyscalls.py \
218 $(sysdeps-linux-python-cc) $< \
219 ../sysdeps/unix/sysv/linux/syscall-names.list \
220 < /dev/null > $@ 2>&1; $(evaluate-test)
221 $(objpfx)tst-glibcsyscalls.out: \
222 ../sysdeps/unix/sysv/linux/tst-glibcsyscalls.py \
223 $(sysdeps-linux-python-deps)
224
225 # Separate object file for access to the constant from the UAPI header.
226 $(objpfx)tst-sysconf-iov_max: $(objpfx)tst-sysconf-iov_max-uapi.o
227
228 tests-special += $(objpfx)tst-mman-consts.out
229 $(objpfx)tst-mman-consts.out: ../sysdeps/unix/sysv/linux/tst-mman-consts.py
230 $(sysdeps-linux-python) \
231 ../sysdeps/unix/sysv/linux/tst-mman-consts.py \
232 $(sysdeps-linux-python-cc) \
233 < /dev/null > $@ 2>&1; $(evaluate-test)
234 $(objpfx)tst-mman-consts.out: $(sysdeps-linux-python-deps)
235
236 tst-rseq-disable-ENV = GLIBC_TUNABLES=glibc.pthread.rseq=0
237
238 endif # $(subdir) == misc
239
240 ifeq ($(subdir),time)
241 sysdep_headers += sys/timex.h bits/timex.h
242
243 sysdep_routines += ntp_gettime ntp_gettimex
244
245 tests += \
246 tst-clock_gettime-clobber \
247 tst-gettimeofday-clobber \
248 tst-time-clobber \
249 # tests
250 endif
251
252 ifeq ($(subdir),signal)
253 tests-special += $(objpfx)tst-signal-numbers.out
254 # Depending on signal.o* is a hack. What we actually want is a dependency
255 # on signal.h and everything it includes. That's impractical to write
256 # in this context, but signal.c includes signal.h and not much else so it'll
257 # be conservatively correct.
258 $(objpfx)tst-signal-numbers.out: \
259 ../sysdeps/unix/sysv/linux/tst-signal-numbers.py \
260 $(objpfx)signal.o*
261 $(sysdeps-linux-python) \
262 ../sysdeps/unix/sysv/linux/tst-signal-numbers.py \
263 $(sysdeps-linux-python-cc) \
264 < /dev/null > $@ 2>&1; $(evaluate-test)
265 $(objpfx)tst-signal-numbers.out: $(sysdeps-linux-python-deps)
266 endif
267
268 ifeq ($(subdir),socket)
269 sysdep_headers += net/if_ppp.h net/ppp-comp.h \
270 net/ppp_defs.h net/if_arp.h net/route.h net/ethernet.h \
271 net/if_slip.h net/if_packet.h net/if_shaper.h \
272 bits/socket-constants.h
273 sysdep_routines += cmsg_nxthdr
274 CFLAGS-recvmmsg.c = -fexceptions -fasynchronous-unwind-tables
275 CFLAGS-sendmmsg.c = -fexceptions -fasynchronous-unwind-tables
276
277 tests-special += $(objpfx)tst-socket-consts.out
278 $(objpfx)tst-socket-consts.out: ../sysdeps/unix/sysv/linux/tst-socket-consts.py
279 PYTHONPATH=../scripts \
280 $(PYTHON) ../sysdeps/unix/sysv/linux/tst-socket-consts.py \
281 --cc="$(CC) $(patsubst -DMODULE_NAME=%, \
282 -DMODULE_NAME=testsuite, \
283 $(CPPFLAGS)) -D_ISOMAC" \
284 < /dev/null > $@ 2>&1; $(evaluate-test)
285 endif # $(subdir) == socket
286
287 ifeq ($(subdir),sunrpc)
288 sysdep_headers += nfs/nfs.h
289 endif
290
291 ifeq ($(subdir),termios)
292 sysdep_headers += termio.h
293 endif
294
295 ifeq ($(subdir),posix)
296 sysdep_headers += bits/initspin.h
297
298 sysdep_routines += sched_getcpu oldglob getcpu
299
300 tests += tst-affinity tst-affinity-pid
301
302 tests-static := tst-affinity-static
303 tests += $(tests-static)
304
305 CFLAGS-fork.c = $(libio-mtsafe)
306 CFLAGS-getpid.o = -fomit-frame-pointer
307 CFLAGS-getpid.os = -fomit-frame-pointer
308 endif
309
310 ifeq ($(subdir),inet)
311 sysdep_headers += netinet/if_fddi.h netinet/if_tr.h \
312 netipx/ipx.h netash/ash.h netax25/ax25.h netatalk/at.h \
313 netrom/netrom.h netpacket/packet.h netrose/rose.h \
314 neteconet/ec.h netiucv/iucv.h
315 sysdep_routines += netlink_assert_response
316 endif
317
318 # Don't compile the ctype glue code, since there is no old non-GNU C library.
319 inhibit-glue = yes
320
321 ifeq ($(subdir),dirent)
322 sysdep_routines += getdirentries getdirentries64
323 tests += tst-getdents64
324
325 # The tested readdir64 symbol was replaced in glibc 2.2.
326 ifeq ($(have-GLIBC_2.1.3)$(build-shared),yesyes)
327 tests += tst-readdir64-compat
328 endif
329 endif # $(subdir) == dirent
330
331 ifeq ($(subdir),nis)
332 CFLAGS-ypclnt.c = -DUSE_BINDINGDIR=1
333 endif
334
335 ifeq ($(subdir),io)
336 sysdep_routines += xstatconv internal_statvfs \
337 sync_file_range fallocate fallocate64 \
338 close_nocancel fcntl_nocancel \
339 open_nocancel open64_nocancel \
340 openat_nocancel openat64_nocancel \
341 read_nocancel pread64_nocancel \
342 write_nocancel statx_cp stat_t64_cp
343
344 sysdep_headers += bits/fcntl-linux.h
345
346 tests += tst-fallocate tst-fallocate64 tst-o_path-locks
347 endif
348
349 ifeq ($(subdir),elf)
350 sysdep-rtld-routines += dl-brk dl-sbrk dl-getcwd dl-openat64 dl-opendir
351
352 libof-lddlibc4 = lddlibc4
353
354 others += pldd
355 install-bin += pldd
356 $(objpfx)pldd: $(objpfx)xmalloc.o
357 endif
358
359 ifeq ($(subdir),rt)
360 CFLAGS-mq_send.c += -fexceptions
361 CFLAGS-mq_receive.c += -fexceptions
362 endif
363
364 ifeq ($(subdir),nscd)
365 sysdep-CFLAGS += -DHAVE_EPOLL -DHAVE_INOTIFY -DHAVE_NETLINK
366 CFLAGS-gai.c += -DNEED_NETLINK
367 endif
368
369 ifeq ($(subdir),nptl)
370 tests += tst-align-clone tst-getpid1
371
372 # tst-rseq-nptl is an internal test because it requires a definition of
373 # __NR_rseq from the internal system call list.
374 tests-internal += tst-rseq-nptl
375 endif