1 # Option to pass to Python scripts to set the C compiler. Rewriting
2 # MODULE_NAME is required to enable the _ISOMAC verbatim header
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
)
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
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>'
55 ifeq ($(subdir
),malloc
)
56 CFLAGS-malloc.c
+= -DMORECORE_CLEARS
=2
68 convert_scm_timestamps \
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
)
134 bits
/mman-map-flags-generic.h \
136 bits
/procfs-extra.h \
138 bits
/procfs-prregset.h \
140 bits
/pthread_stack_min-dynamic.h \
141 bits
/pthread_stack_min.h \
142 bits
/ptrace-shared.h \
145 bits
/siginfo-arch.h \
146 bits
/siginfo-consts-arch.h \
150 bits
/struct_stat_time64_helper.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 \
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 \
205 tst-fdopendir-o_path \
223 tst-process_mrelease \
225 tst-rlimit-infinity \
228 tst-sync_file_range \
229 tst-sysconf-iov_max \
236 tst-ttyname-namespace \
239 # process_madvise requires CAP_SYS_ADMIN.
241 tst-process_madvise \
244 # For +depfiles in Makerules.
246 tst-sysconf-iov_max-uapi.o \
249 # Test for the symbol version of fcntl that was replaced in glibc 2.28.
250 ifeq ($(have-GLIBC_2.27
)$(build-shared
),yesyes
)
252 tst-ofdlocks-compat \
258 tst-sigcontext-get_pc \
266 tst-adjtimex-time64 \
267 tst-clock_adjtime-time64 \
269 tst-ntp_adjtime-time64 \
270 tst-ntp_gettime-time64 \
271 tst-ntp_gettimex-time64 \
274 tst-scm_rights-time64 \
275 tst-sigtimedwait-time64 \
279 tests-clone-internal
= \
280 tst-align-clone-internal \
281 tst-clone2-internal \
282 tst-clone3-internal \
284 # tests-clone-internal
286 $(tests-clone-internal
) \
289 $(tests-clone-internal
) \
292 CFLAGS-tst-sigcontext-get_pc.c
= -fasynchronous-unwind-tables
294 # Generate the list of SYS_* macros for the system calls (__NR_*
295 # macros). The file syscall-names.list contains all possible system
296 # call names, and the generated header file produces SYS_* macros for
297 # the __NR_* macros which are actually defined.
299 generated
+= bits
/syscall.h
300 $(objpfx
)bits
/syscall.h
: \
301 ..
/sysdeps
/unix
/sysv
/linux
/gen-syscall-h.awk \
302 ..
/sysdeps
/unix
/sysv
/linux
/syscall-names.list
303 $(make-target-directory
)
304 LC_ALL
=C
$(AWK
) -f
$^
> $@
-tmp
305 $(move-if-change
) $@
-tmp
$@
306 before-compile
+= $(objpfx
)bits
/syscall.h
308 # All macros defined by <sys/syscall.h>. Include <bits/syscall.h>
309 # explicitly because <sys/sycall.h> skips it if _LIBC is defined.
310 $(objpfx
)tst-syscall-list-macros.list
: \
311 $(objpfx
)bits
/syscall.h ..
/sysdeps
/unix
/sysv
/linux
/sys
/syscall.h
312 printf
'#include <linux/version.h>\n\
313 #include <sys/syscall.h>\n#include <bits/syscall.h>\n' | \
314 $(CC
) -E
-o
$@
-tmp
$(CFLAGS
) $(CPPFLAGS
) -x c
- -dM
315 $(move-if-change
) $@
-tmp
$@
317 # __NR_* system call names. Used by the test below.
318 $(objpfx
)tst-syscall-list-nr.list
: \
319 ..
/sysdeps
/unix
/sysv
/linux
/filter-nr-syscalls.awk \
320 $(objpfx
)tst-syscall-list-macros.list
321 LC_ALL
=C
$(AWK
) -f
$^
> $@
-tmp
322 $(move-if-change
) $@
-tmp
$@
324 # SYS_* system call names. Used by the test below.
325 $(objpfx
)tst-syscall-list-sys.list
: $(objpfx
)tst-syscall-list-macros.list
326 LC_ALL
=C
$(AWK
) '/^#define SYS_/ { print substr($$2, 5) }' $< > $@
-tmp
327 $(move-if-change
) $@
-tmp
$@
330 $(objpfx
)tst-syscall-list.out
332 $(objpfx
)tst-syscall-list.out
: \
333 ..
/sysdeps
/unix
/sysv
/linux
/tst-syscall-list.sh \
334 $(objpfx
)tst-syscall-list-macros.list \
335 $(objpfx
)tst-syscall-list-nr.list \
336 $(objpfx
)tst-syscall-list-sys.list
337 $(BASH
) $^
$(AWK
) > $@
; $(evaluate-test
)
340 $(objpfx
)tst-glibcsyscalls.out
342 # arch-syscall.h is located via the sysdeps override search path.
343 $(objpfx
)tst-glibcsyscalls.out
: arch-syscall.h \
344 ..
/sysdeps
/unix
/sysv
/linux
/syscall-names.list
345 $(sysdeps-linux-python
) \
346 ..
/sysdeps
/unix
/sysv
/linux
/tst-glibcsyscalls.py \
347 $(sysdeps-linux-python-cc
) $< \
348 ..
/sysdeps
/unix
/sysv
/linux
/syscall-names.list \
349 < /dev
/null
> $@
2>&1; $(evaluate-test
)
350 $(objpfx
)tst-glibcsyscalls.out
: \
351 ..
/sysdeps
/unix
/sysv
/linux
/tst-glibcsyscalls.py \
352 $(sysdeps-linux-python-deps
)
354 # Separate object file for access to the constant from the UAPI header.
355 $(objpfx
)tst-sysconf-iov_max
: $(objpfx
)tst-sysconf-iov_max-uapi.o
358 $(objpfx
)tst-mman-consts.out \
360 $(objpfx
)tst-mman-consts.out
: ..
/sysdeps
/unix
/sysv
/linux
/tst-mman-consts.py
361 $(sysdeps-linux-python
) \
362 ..
/sysdeps
/unix
/sysv
/linux
/tst-mman-consts.py \
363 $(sysdeps-linux-python-cc
) \
364 < /dev
/null
> $@
2>&1; $(evaluate-test
)
365 $(objpfx
)tst-mman-consts.out
: $(sysdeps-linux-python-deps
)
368 $(objpfx
)tst-pidfd-consts.out \
370 $(objpfx
)tst-pidfd-consts.out
: ..
/sysdeps
/unix
/sysv
/linux
/tst-pidfd-consts.py
371 $(sysdeps-linux-python
) \
372 ..
/sysdeps
/unix
/sysv
/linux
/tst-pidfd-consts.py \
373 $(sysdeps-linux-python-cc
) \
374 < /dev
/null
> $@
2>&1; $(evaluate-test
)
375 $(objpfx
)tst-pidfd-consts.out
: $(sysdeps-linux-python-deps
)
378 $(objpfx
)tst-mount-consts.out \
380 $(objpfx
)tst-mount-consts.out
: ..
/sysdeps
/unix
/sysv
/linux
/tst-mount-consts.py
381 $(sysdeps-linux-python
) \
382 ..
/sysdeps
/unix
/sysv
/linux
/tst-mount-consts.py \
383 $(sysdeps-linux-python-cc
) \
384 < /dev
/null
> $@
2>&1; $(evaluate-test
)
385 $(objpfx
)tst-mount-consts.out
: $(sysdeps-linux-python-deps
)
388 $(objpfx
)tst-mount-compile.out \
390 $(objpfx
)tst-mount-compile.out
: ..
/sysdeps
/unix
/sysv
/linux
/tst-mount-compile.py
391 $(sysdeps-linux-python
) \
392 ..
/sysdeps
/unix
/sysv
/linux
/tst-mount-compile.py \
393 $(sysdeps-linux-python-cc
) \
394 < /dev
/null
> $@
2>&1; $(evaluate-test
)
395 $(objpfx
)tst-mount-compile.out
: $(sysdeps-linux-python-deps
)
397 tst-rseq-disable-ENV
= GLIBC_TUNABLES
=glibc.pthread.rseq
=0
399 endif # $(subdir) == misc
401 ifeq ($(subdir
),time
)
413 tst-clock_gettime-clobber \
414 tst-gettimeofday-clobber \
419 ifeq ($(subdir
),signal
)
421 $(objpfx
)tst-signal-numbers.out \
424 # Depending on signal.o* is a hack. What we actually want is a dependency
425 # on signal.h and everything it includes. That's impractical to write
426 # in this context, but signal.c includes signal.h and not much else so it'll
427 # be conservatively correct.
428 $(objpfx
)tst-signal-numbers.out
: \
429 ..
/sysdeps
/unix
/sysv
/linux
/tst-signal-numbers.py \
431 $(sysdeps-linux-python
) \
432 ..
/sysdeps
/unix
/sysv
/linux
/tst-signal-numbers.py \
433 $(sysdeps-linux-python-cc
) \
434 < /dev
/null
> $@
2>&1; $(evaluate-test
)
435 $(objpfx
)tst-signal-numbers.out
: $(sysdeps-linux-python-deps
)
438 ifeq ($(subdir
),socket
)
440 bits
/socket-constants.h \
456 CFLAGS-recvmmsg.c
= -fexceptions
-fasynchronous-unwind-tables
457 CFLAGS-sendmmsg.c
= -fexceptions
-fasynchronous-unwind-tables
460 tst-socket-timestamp \
461 tst-socket-timestamp-compat \
464 tst-socket-timestamp-compat-time64 \
465 tst-socket-timestamp-time64 \
469 $(objpfx
)tst-socket-consts.out \
471 $(objpfx
)tst-socket-consts.out
: ..
/sysdeps
/unix
/sysv
/linux
/tst-socket-consts.py
472 PYTHONPATH
=..
/scripts \
473 $(PYTHON
) ..
/sysdeps
/unix
/sysv
/linux
/tst-socket-consts.py \
474 --cc="$(CC) $(patsubst -DMODULE_NAME=%, \
475 -DMODULE_NAME=testsuite, \
476 $(CPPFLAGS)) -D_ISOMAC" \
477 < /dev
/null
> $@
2>&1; $(evaluate-test
)
478 endif # $(subdir) == socket
480 ifeq ($(subdir
),sunrpc
)
486 ifeq ($(subdir
),termios
)
492 ifeq ($(subdir
),posix
)
505 spawnattr_getcgroup_np \
506 spawnattr_setcgroup_np \
512 tst-posix_spawn-setsid-pidfd \
514 tst-spawn-chdir-pidfd \
525 tst-affinity-static \
532 CFLAGS-fork.c
= $(libio-mtsafe
)
533 CFLAGS-getpid.o
= -fomit-frame-pointer
534 CFLAGS-getpid.os
= -fomit-frame-pointer
535 CFLAGS-tst-spawn3-pidfd.c
+= -DOBJPFX
=\"$(objpfx
)\"
537 tst-spawn-cgroup-ARGS
= -- $(host-test-program-cmd
)
538 tst-spawn-pidfd-ARGS
= -- $(host-test-program-cmd
)
539 tst-spawn5-pidfd-ARGS
= -- $(host-test-program-cmd
)
540 tst-spawn6-pidfd-ARGS
= -- $(host-test-program-cmd
)
541 tst-spawn7-pidfd-ARGS
= -- $(host-test-program-cmd
)
542 tst-posix_spawn-setsid-pidfd-ARGS
= -- $(host-test-program-cmd
)
545 ifeq ($(subdir
),inet
)
561 netlink_assert_response \
564 CFLAGS-check_pf.c
+= -fexceptions
567 # Don't compile the ctype glue code, since there is no old non-GNU C library.
570 ifeq ($(subdir
),dirent
)
578 tst-readdir64-compat \
580 endif # $(subdir) == dirent
583 CFLAGS-ypclnt.c
= -DUSE_BINDINGDIR
=1
613 tst-getcwd-smallbuff \
619 sysdep-rtld-routines
+= \
625 # sysdep-rtld-routines
635 $(objpfx
)pldd
: $(objpfx
)xmalloc.o
639 CFLAGS-mq_send.c
+= -fexceptions
640 CFLAGS-mq_receive.c
+= -fexceptions
643 ifeq ($(subdir
),nscd
)
644 sysdep-CFLAGS
+= -DHAVE_EPOLL
-DHAVE_INOTIFY
-DHAVE_NETLINK
645 CFLAGS-gai.c
+= -DNEED_NETLINK
648 ifeq ($(subdir
),nptl
)
654 # tst-rseq-nptl is an internal test because it requires a definition of
655 # __NR_rseq from the internal system call list.