x86: In ld.so, diagnose missing APX support in APX-only builds
[glibc.git] / sysdeps / unix / sysv / linux / Makefile
blob415aa1f14dd20ba64b237e9201c9240e3ca2b9c6
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))"
7 # Additional dependencies for Python scripts.
8 sysdeps-linux-python-deps = \
9 $(..)scripts/glibcextract.py \
10 $(..)sysdeps/unix/sysv/linux/glibcsyscalls.py \
11 # sysdeps-linux-python-deps
13 # Invocation of the Python interpreter with the Python search path.
14 sysdeps-linux-python = \
15 PYTHONPATH=$(..)scripts:$(..)sysdeps/unix/sysv/linux $(PYTHON)
17 ifndef subdir
18 # This target performs two actions:
20 # Replace <arch-syscall.h> with a file generated from kernel headers
21 # and <fixup-asm-unistd.h>. Both files are located via the sysdeps
22 # override search path.
24 # Update sysdeps/unix/sysv/linux/syscall-names.list with additional
25 # names found in the generated <arch-syscall.h> file, so that the
26 # global system call names list is a superset of the
27 # architecture-specific system call names.
29 # To bootstrap a new architecture, create an empty file in the right
30 # place and run `make update-syscall-lists' from the top-level of a
31 # configured, but not-yet-built glibc tree.
33 # --lock points to a file not replaced during the update operation, so
34 # that mutual exclusion is achieved.
35 .PHONY: update-syscall-lists
36 update-syscall-lists: arch-syscall.h
37 $(sysdeps-linux-python) \
38 sysdeps/unix/sysv/linux/update-syscall-lists.py \
39 $(sysdeps-linux-python-cc) \
40 --lock=sysdeps/unix/sysv/linux/update-syscall-lists.py $< \
41 sysdeps/unix/sysv/linux/syscall-names.list
42 endif
44 ifeq ($(subdir),csu)
45 sysdep_routines += \
46 errno-loc \
47 # sysdep_routines
48 endif
50 ifeq ($(subdir),assert)
51 CFLAGS-assert.c += -DFATAL_PREPARE_INCLUDE='<fatal-prepare.h>'
52 CFLAGS-assert-perr.c += -DFATAL_PREPARE_INCLUDE='<fatal-prepare.h>'
53 endif
55 ifeq ($(subdir),malloc)
56 CFLAGS-malloc.c += -DMORECORE_CLEARS=2
57 endif
59 ifeq ($(subdir),misc)
60 sysdep_routines += \
61 adjtimex \
62 clock_adjtime \
63 clone \
64 clone-internal \
65 clone-pidfd-support \
66 clone3 \
67 closefrom_fallback \
68 convert_scm_timestamps \
69 epoll_create \
70 epoll_pwait \
71 epoll_pwait2 \
72 epoll_wait \
73 eventfd \
74 eventfd_read \
75 eventfd_write \
76 fanotify_mark \
77 fxstat \
78 fxstat64 \
79 fxstatat \
80 fxstatat64 \
81 inotify_init \
82 lxstat \
83 lxstat64 \
84 mlock2 \
85 mremap \
86 open_by_handle_at \
87 personality \
88 pkey_get \
89 pkey_mprotect \
90 pkey_set \
91 prctl \
92 prlimit \
93 prlimit64 \
94 process_vm_readv \
95 process_vm_writev \
96 pselect32 \
97 readahead \
98 setfsgid \
99 setfsuid \
100 setvmaname \
101 signalfd \
102 splice \
103 sysctl \
104 tee \
105 timerfd_gettime \
106 timerfd_settime \
107 umount \
108 umount2 \
109 vmsplice \
110 xmknod \
111 xmknodat \
112 xstat \
113 xstat64 \
114 # sysdep_routines
116 CFLAGS-gethostid.c = -fexceptions
117 CFLAGS-tee.c = -fexceptions -fasynchronous-unwind-tables
118 CFLAGS-vmsplice.c = -fexceptions -fasynchronous-unwind-tables
119 CFLAGS-splice.c = -fexceptions -fasynchronous-unwind-tables
120 CFLAGS-open_by_handle_at.c = -fexceptions -fasynchronous-unwind-tables
121 CFLAGS-sync_file_range.c = -fexceptions -fasynchronous-unwind-tables
122 CFLAGS-pselect32.c = -fexceptions -fasynchronous-unwind-tables
123 CFLAGS-tst-writev.c += "-DARTIFICIAL_LIMIT=(0x80000000-sysconf(_SC_PAGESIZE))"
125 # The test triggers FORTIFY abortion due to purposely wrong parameters
126 CFLAGS-test-errno-linux.c += $(no-fortify-source)
128 sysdep_headers += \
129 bits/a.out.h \
130 bits/epoll.h \
131 bits/eventfd.h \
132 bits/inotify.h \
133 bits/mman-linux.h \
134 bits/mman-map-flags-generic.h \
135 bits/mman-shared.h \
136 bits/procfs-extra.h \
137 bits/procfs-id.h \
138 bits/procfs-prregset.h \
139 bits/procfs.h \
140 bits/pthread_stack_min-dynamic.h \
141 bits/pthread_stack_min.h \
142 bits/ptrace-shared.h \
143 bits/rseq.h \
144 bits/shmlba.h \
145 bits/siginfo-arch.h \
146 bits/siginfo-consts-arch.h \
147 bits/signalfd.h \
148 bits/socket_type.h \
149 bits/struct_stat.h \
150 bits/struct_stat_time64_helper.h \
151 bits/syscall.h \
152 bits/termios-baud.h \
153 bits/termios-c_cc.h \
154 bits/termios-c_cflag.h \
155 bits/termios-c_iflag.h \
156 bits/termios-c_lflag.h \
157 bits/termios-c_oflag.h \
158 bits/termios-misc.h \
159 bits/termios-struct.h \
160 bits/termios-tcflow.h \
161 bits/timerfd.h \
162 bits/types/struct_msqid64_ds.h \
163 bits/types/struct_msqid64_ds_helper.h \
164 bits/types/struct_semid64_ds.h \
165 bits/types/struct_semid64_ds_helper.h \
166 bits/types/struct_semid_ds.h \
167 bits/types/struct_shmid64_ds.h \
168 bits/types/struct_shmid64_ds_helper.h \
169 scsi/scsi.h \
170 scsi/scsi_ioctl.h \
171 scsi/sg.h \
172 sys/acct.h \
173 sys/epoll.h \
174 sys/eventfd.h \
175 sys/fanotify.h \
176 sys/fsuid.h \
177 sys/inotify.h \
178 sys/kd.h \
179 sys/klog.h \
180 sys/mount.h \
181 sys/pci.h \
182 sys/personality.h \
183 sys/pidfd.h \
184 sys/prctl.h \
185 sys/quota.h \
186 sys/raw.h \
187 sys/rseq.h \
188 sys/signalfd.h \
189 sys/soundcard.h \
190 sys/timerfd.h \
191 sys/user.h \
192 sys/vt.h \
193 # sysdep_headers
195 tests += \
196 test-errno-linux \
197 tst-adjtimex \
198 tst-clock_adjtime \
199 tst-clone \
200 tst-clone2 \
201 tst-clone3 \
202 tst-epoll \
203 tst-fanotify \
204 tst-fdopendir-o_path \
205 tst-getauxval \
206 tst-gettid \
207 tst-gettid-kill \
208 tst-memfd_create \
209 tst-misalign-clone \
210 tst-mlock2 \
211 tst-mount \
212 tst-ntp_adjtime \
213 tst-ntp_gettime \
214 tst-ntp_gettimex \
215 tst-ofdlocks \
216 tst-personality \
217 tst-pidfd \
218 tst-pidfd_getpid \
219 tst-pkey \
220 tst-ppoll \
221 tst-prctl \
222 tst-process_mrelease \
223 tst-quota \
224 tst-rlimit-infinity \
225 tst-scm_rights \
226 tst-sigtimedwait \
227 tst-sync_file_range \
228 tst-sysconf-iov_max \
229 tst-sysvmsg-linux \
230 tst-sysvsem-linux \
231 tst-sysvshm-linux \
232 tst-tgkill \
233 tst-timerfd \
234 tst-ttyname-direct \
235 tst-ttyname-namespace \
236 # tests
238 # process_madvise requires CAP_SYS_ADMIN.
239 xtests += \
240 tst-process_madvise \
241 # xtests
243 # For +depfiles in Makerules.
244 extra-test-objs += \
245 tst-sysconf-iov_max-uapi.o \
246 # extra-test-objs
248 # Test for the symbol version of fcntl that was replaced in glibc 2.28.
249 ifeq ($(have-GLIBC_2.27)$(build-shared),yesyes)
250 tests += \
251 tst-ofdlocks-compat \
252 # tests
253 endif
255 tests-internal += \
256 tst-rseq \
257 tst-sigcontext-get_pc \
258 # tests-internal
260 tests-internal += \
261 tst-rseq-disable \
262 # tests-internal
264 tests-time64 += \
265 tst-adjtimex-time64 \
266 tst-clock_adjtime-time64 \
267 tst-epoll-time64 \
268 tst-ntp_adjtime-time64 \
269 tst-ntp_gettime-time64 \
270 tst-ntp_gettimex-time64 \
271 tst-ppoll-time64 \
272 tst-prctl-time64 \
273 tst-scm_rights-time64 \
274 tst-sigtimedwait-time64 \
275 tst-timerfd-time64 \
276 # tests-time64
278 tests-clone-internal = \
279 tst-align-clone-internal \
280 tst-clone2-internal \
281 tst-clone3-internal \
282 tst-getpid1-internal
283 # tests-clone-internal
284 tests-internal += \
285 $(tests-clone-internal) \
286 # tests-internal
287 tests-static += \
288 $(tests-clone-internal) \
289 # tests-static
291 CFLAGS-tst-sigcontext-get_pc.c = -fasynchronous-unwind-tables
293 # Generate the list of SYS_* macros for the system calls (__NR_*
294 # macros). The file syscall-names.list contains all possible system
295 # call names, and the generated header file produces SYS_* macros for
296 # the __NR_* macros which are actually defined.
298 generated += bits/syscall.h
299 $(objpfx)bits/syscall.h: \
300 ../sysdeps/unix/sysv/linux/gen-syscall-h.awk \
301 ../sysdeps/unix/sysv/linux/syscall-names.list
302 $(make-target-directory)
303 LC_ALL=C $(AWK) -f $^ > $@-tmp
304 $(move-if-change) $@-tmp $@
305 before-compile += $(objpfx)bits/syscall.h
307 # All macros defined by <sys/syscall.h>. Include <bits/syscall.h>
308 # explicitly because <sys/sycall.h> skips it if _LIBC is defined.
309 $(objpfx)tst-syscall-list-macros.list: \
310 $(objpfx)bits/syscall.h ../sysdeps/unix/sysv/linux/sys/syscall.h
311 printf '#include <linux/version.h>\n\
312 #include <sys/syscall.h>\n#include <bits/syscall.h>\n' | \
313 $(CC) -E -o $@-tmp $(CFLAGS) $(CPPFLAGS) -x c - -dM
314 $(move-if-change) $@-tmp $@
316 # __NR_* system call names. Used by the test below.
317 $(objpfx)tst-syscall-list-nr.list: \
318 ../sysdeps/unix/sysv/linux/filter-nr-syscalls.awk \
319 $(objpfx)tst-syscall-list-macros.list
320 LC_ALL=C $(AWK) -f $^ > $@-tmp
321 $(move-if-change) $@-tmp $@
323 # SYS_* system call names. Used by the test below.
324 $(objpfx)tst-syscall-list-sys.list: $(objpfx)tst-syscall-list-macros.list
325 LC_ALL=C $(AWK) '/^#define SYS_/ { print substr($$2, 5) }' $< > $@-tmp
326 $(move-if-change) $@-tmp $@
328 tests-special += \
329 $(objpfx)tst-syscall-list.out
330 # tests-special
331 $(objpfx)tst-syscall-list.out: \
332 ../sysdeps/unix/sysv/linux/tst-syscall-list.sh \
333 $(objpfx)tst-syscall-list-macros.list \
334 $(objpfx)tst-syscall-list-nr.list \
335 $(objpfx)tst-syscall-list-sys.list
336 $(BASH) $^ $(AWK) > $@; $(evaluate-test)
338 tests-special += \
339 $(objpfx)tst-glibcsyscalls.out
340 # tests-special
341 # arch-syscall.h is located via the sysdeps override search path.
342 $(objpfx)tst-glibcsyscalls.out: arch-syscall.h \
343 ../sysdeps/unix/sysv/linux/syscall-names.list
344 $(sysdeps-linux-python) \
345 ../sysdeps/unix/sysv/linux/tst-glibcsyscalls.py \
346 $(sysdeps-linux-python-cc) $< \
347 ../sysdeps/unix/sysv/linux/syscall-names.list \
348 < /dev/null > $@ 2>&1; $(evaluate-test)
349 $(objpfx)tst-glibcsyscalls.out: \
350 ../sysdeps/unix/sysv/linux/tst-glibcsyscalls.py \
351 $(sysdeps-linux-python-deps)
353 # Separate object file for access to the constant from the UAPI header.
354 $(objpfx)tst-sysconf-iov_max: $(objpfx)tst-sysconf-iov_max-uapi.o
356 tests-special += \
357 $(objpfx)tst-mman-consts.out \
358 # tests-special
359 $(objpfx)tst-mman-consts.out: ../sysdeps/unix/sysv/linux/tst-mman-consts.py
360 $(sysdeps-linux-python) \
361 ../sysdeps/unix/sysv/linux/tst-mman-consts.py \
362 $(sysdeps-linux-python-cc) \
363 < /dev/null > $@ 2>&1; $(evaluate-test)
364 $(objpfx)tst-mman-consts.out: $(sysdeps-linux-python-deps)
366 tests-special += \
367 $(objpfx)tst-pidfd-consts.out \
368 # tests-special
369 $(objpfx)tst-pidfd-consts.out: ../sysdeps/unix/sysv/linux/tst-pidfd-consts.py
370 $(sysdeps-linux-python) \
371 ../sysdeps/unix/sysv/linux/tst-pidfd-consts.py \
372 $(sysdeps-linux-python-cc) \
373 < /dev/null > $@ 2>&1; $(evaluate-test)
374 $(objpfx)tst-pidfd-consts.out: $(sysdeps-linux-python-deps)
376 tests-special += \
377 $(objpfx)tst-mount-consts.out \
378 # tests-special
379 $(objpfx)tst-mount-consts.out: ../sysdeps/unix/sysv/linux/tst-mount-consts.py
380 $(sysdeps-linux-python) \
381 ../sysdeps/unix/sysv/linux/tst-mount-consts.py \
382 $(sysdeps-linux-python-cc) \
383 < /dev/null > $@ 2>&1; $(evaluate-test)
384 $(objpfx)tst-mount-consts.out: $(sysdeps-linux-python-deps)
386 tests-special += \
387 $(objpfx)tst-mount-compile.out \
388 # tests-special
389 $(objpfx)tst-mount-compile.out: ../sysdeps/unix/sysv/linux/tst-mount-compile.py
390 $(sysdeps-linux-python) \
391 ../sysdeps/unix/sysv/linux/tst-mount-compile.py \
392 $(sysdeps-linux-python-cc) \
393 < /dev/null > $@ 2>&1; $(evaluate-test)
394 $(objpfx)tst-mount-compile.out: $(sysdeps-linux-python-deps)
396 tst-rseq-disable-ENV = GLIBC_TUNABLES=glibc.pthread.rseq=0
398 endif # $(subdir) == misc
400 ifeq ($(subdir),time)
401 sysdep_headers += \
402 bits/timex.h \
403 sys/timex.h \
404 # sysdep_headers
406 sysdep_routines += \
407 ntp_gettime \
408 ntp_gettimex \
409 # sysdep_routines
411 tests += \
412 tst-clock_gettime-clobber \
413 tst-gettimeofday-clobber \
414 tst-time-clobber \
415 # tests
416 endif
418 ifeq ($(subdir),signal)
419 tests-special += \
420 $(objpfx)tst-signal-numbers.out \
421 # tests-special
423 # Depending on signal.o* is a hack. What we actually want is a dependency
424 # on signal.h and everything it includes. That's impractical to write
425 # in this context, but signal.c includes signal.h and not much else so it'll
426 # be conservatively correct.
427 $(objpfx)tst-signal-numbers.out: \
428 ../sysdeps/unix/sysv/linux/tst-signal-numbers.py \
429 $(objpfx)signal.o*
430 $(sysdeps-linux-python) \
431 ../sysdeps/unix/sysv/linux/tst-signal-numbers.py \
432 $(sysdeps-linux-python-cc) \
433 < /dev/null > $@ 2>&1; $(evaluate-test)
434 $(objpfx)tst-signal-numbers.out: $(sysdeps-linux-python-deps)
435 endif
437 ifeq ($(subdir),socket)
438 sysdep_headers += \
439 bits/socket-constants.h \
440 net/ethernet.h \
441 net/if_arp.h \
442 net/if_packet.h \
443 net/if_ppp.h \
444 net/if_shaper.h \
445 net/if_slip.h \
446 net/ppp-comp.h \
447 net/ppp_defs.h \
448 net/route.h \
449 # sysdep_headers
451 sysdep_routines += \
452 cmsg_nxthdr \
453 # sysdep_routines
455 CFLAGS-recvmmsg.c = -fexceptions -fasynchronous-unwind-tables
456 CFLAGS-sendmmsg.c = -fexceptions -fasynchronous-unwind-tables
458 tests += \
459 tst-socket-timestamp \
460 tst-socket-timestamp-compat \
461 # tests
462 tests-time64 += \
463 tst-socket-timestamp-compat-time64 \
464 tst-socket-timestamp-time64 \
465 # tests-time64
467 tests-special += \
468 $(objpfx)tst-socket-consts.out \
469 # tests-special
470 $(objpfx)tst-socket-consts.out: ../sysdeps/unix/sysv/linux/tst-socket-consts.py
471 PYTHONPATH=../scripts \
472 $(PYTHON) ../sysdeps/unix/sysv/linux/tst-socket-consts.py \
473 --cc="$(CC) $(patsubst -DMODULE_NAME=%, \
474 -DMODULE_NAME=testsuite, \
475 $(CPPFLAGS)) -D_ISOMAC" \
476 < /dev/null > $@ 2>&1; $(evaluate-test)
477 endif # $(subdir) == socket
479 ifeq ($(subdir),sunrpc)
480 sysdep_headers += \
481 nfs/nfs.h \
482 # sysdep_headers
483 endif
485 ifeq ($(subdir),termios)
486 sysdep_headers += \
487 termio.h \
488 # sysdep_headers
489 endif
491 ifeq ($(subdir),posix)
492 sysdep_headers += \
493 bits/initspin.h \
494 # sysdep_headers
496 sysdep_routines += \
497 getcpu \
498 oldglob \
499 pidfd_getpid \
500 pidfd_spawn \
501 pidfd_spawnp \
502 procutils \
503 sched_getcpu \
504 spawnattr_getcgroup_np \
505 spawnattr_setcgroup_np \
506 # sysdep_routines
508 tests += \
509 tst-affinity \
510 tst-affinity-pid \
511 tst-posix_spawn-setsid-pidfd \
512 tst-spawn-cgroup \
513 tst-spawn-chdir-pidfd \
514 tst-spawn-pidfd \
515 tst-spawn2-pidfd \
516 tst-spawn3-pidfd \
517 tst-spawn4-pidfd \
518 tst-spawn5-pidfd \
519 tst-spawn6-pidfd \
520 tst-spawn7-pidfd \
521 # tests
523 tests-static += \
524 tst-affinity-static \
525 # tests-static
527 tests += \
528 $(tests-static) \
529 # tests
531 CFLAGS-fork.c = $(libio-mtsafe)
532 CFLAGS-getpid.o = -fomit-frame-pointer
533 CFLAGS-getpid.os = -fomit-frame-pointer
534 CFLAGS-tst-spawn3-pidfd.c += -DOBJPFX=\"$(objpfx)\"
536 tst-spawn-cgroup-ARGS = -- $(host-test-program-cmd)
537 tst-spawn-pidfd-ARGS = -- $(host-test-program-cmd)
538 tst-spawn5-pidfd-ARGS = -- $(host-test-program-cmd)
539 tst-spawn6-pidfd-ARGS = -- $(host-test-program-cmd)
540 tst-spawn7-pidfd-ARGS = -- $(host-test-program-cmd)
541 tst-posix_spawn-setsid-pidfd-ARGS = -- $(host-test-program-cmd)
542 endif
544 ifeq ($(subdir),inet)
545 sysdep_headers += \
546 netash/ash.h \
547 netatalk/at.h \
548 netax25/ax25.h \
549 neteconet/ec.h \
550 netinet/if_fddi.h \
551 netinet/if_tr.h \
552 netipx/ipx.h \
553 netiucv/iucv.h \
554 netpacket/packet.h \
555 netrom/netrom.h \
556 netrose/rose.h \
557 # sysdep_headers
559 sysdep_routines += \
560 netlink_assert_response \
561 # sysdep_routines
563 CFLAGS-check_pf.c += -fexceptions
564 endif
566 # Don't compile the ctype glue code, since there is no old non-GNU C library.
567 inhibit-glue = yes
569 ifeq ($(subdir),dirent)
570 sysdep_routines += \
571 getdirentries \
572 getdirentries64 \
573 # sysdep_routines
575 tests += \
576 tst-getdents64 \
577 tst-readdir64-compat \
578 # tests
579 endif # $(subdir) == dirent
581 ifeq ($(subdir),nis)
582 CFLAGS-ypclnt.c = -DUSE_BINDINGDIR=1
583 endif
585 ifeq ($(subdir),io)
586 sysdep_routines += \
587 close_nocancel \
588 fallocate \
589 fallocate64 \
590 fcntl_nocancel \
591 internal_statvfs \
592 open64_nocancel \
593 open_nocancel \
594 openat64_nocancel \
595 openat_nocancel \
596 pread64_nocancel \
597 read_nocancel \
598 stat_t64_cp \
599 statx_cp \
600 sync_file_range \
601 write_nocancel \
602 xstatconv \
603 # sysdep_routines
605 sysdep_headers += \
606 bits/fcntl-linux.h \
607 # sysdep_headers
609 tests += \
610 tst-fallocate \
611 tst-fallocate64 \
612 tst-getcwd-smallbuff \
613 tst-o_path-locks \
614 # tests
615 endif
617 ifeq ($(subdir),elf)
618 sysdep-rtld-routines += \
619 dl-brk \
620 dl-getcwd \
621 dl-openat64 \
622 dl-opendir \
623 dl-sbrk \
624 # sysdep-rtld-routines
626 others += \
627 pldd \
628 # others
630 install-bin += \
631 pldd \
632 # install-bin
634 $(objpfx)pldd: $(objpfx)xmalloc.o
635 endif
637 ifeq ($(subdir),rt)
638 CFLAGS-mq_send.c += -fexceptions
639 CFLAGS-mq_receive.c += -fexceptions
640 endif
642 ifeq ($(subdir),nscd)
643 sysdep-CFLAGS += -DHAVE_EPOLL -DHAVE_INOTIFY -DHAVE_NETLINK
644 CFLAGS-gai.c += -DNEED_NETLINK
645 endif
647 ifeq ($(subdir),nptl)
648 tests += \
649 tst-align-clone \
650 tst-getpid1 \
651 # tests
653 # tst-rseq-nptl is an internal test because it requires a definition of
654 # __NR_rseq from the internal system call list.
655 tests-internal += \
656 tst-rseq-nptl \
657 # tests-internal
658 endif