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. 4sysdeps-linux-python-cc = \ 5 --cc="$(CC) $(patsubst -DMODULE_NAME=%,-DMODULE_NAME=testsuite,$(CPPFLAGS))" 6 7# Additional dependencies for Python scripts. 8sysdeps-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. 13sysdeps-linux-python = \ 14 PYTHONPATH=$(..)scripts:$(..)sysdeps/unix/sysv/linux $(PYTHON) 15 16ifndef 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 35update-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 41endif 42 43ifeq ($(subdir),csu) 44sysdep_routines += errno-loc 45endif 46 47ifeq ($(subdir),assert) 48CFLAGS-assert.c += -DFATAL_PREPARE_INCLUDE='<fatal-prepare.h>' 49CFLAGS-assert-perr.c += -DFATAL_PREPARE_INCLUDE='<fatal-prepare.h>' 50endif 51 52ifeq ($(subdir),malloc) 53CFLAGS-malloc.c += -DMORECORE_CLEARS=2 54endif 55 56ifeq ($(subdir),misc) 57sysdep_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 73CFLAGS-gethostid.c = -fexceptions 74CFLAGS-tee.c = -fexceptions -fasynchronous-unwind-tables 75CFLAGS-vmsplice.c = -fexceptions -fasynchronous-unwind-tables 76CFLAGS-splice.c = -fexceptions -fasynchronous-unwind-tables 77CFLAGS-open_by_handle_at.c = -fexceptions -fasynchronous-unwind-tables 78CFLAGS-sync_file_range.c = -fexceptions -fasynchronous-unwind-tables 79CFLAGS-pselect32.c = -fexceptions -fasynchronous-unwind-tables 80CFLAGS-tst-writev.c += "-DARTIFICIAL_LIMIT=(0x80000000-sysconf(_SC_PAGESIZE))" 81 82sysdep_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 sys/rseq.h bits/rseq.h 117 118tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \ 119 tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \ 120 test-errno-linux tst-memfd_create tst-mlock2 tst-pkey \ 121 tst-rlimit-infinity tst-ofdlocks tst-gettid tst-gettid-kill \ 122 tst-tgkill tst-sysvsem-linux tst-sysvmsg-linux tst-sysvshm-linux \ 123 tst-timerfd tst-ppoll \ 124 tst-clock_adjtime tst-adjtimex tst-ntp_adjtime tst-ntp_gettime \ 125 tst-ntp_gettimex tst-sigtimedwait tst-misalign-clone \ 126 tst-prctl \ 127 tst-scm_rights \ 128 # tests 129 130# Test for the symbol version of fcntl that was replaced in glibc 2.28. 131ifeq ($(have-GLIBC_2.27)$(build-shared),yesyes) 132tests += tst-ofdlocks-compat 133endif 134 135tests-internal += \ 136 tst-rseq \ 137 tst-sigcontext-get_pc \ 138 # tests-internal 139 140ifneq (no,$(have-tunables)) 141tests-internal += \ 142 tst-rseq-disable \ 143 # tests-internal $(have-tunables) 144endif 145 146tests-time64 += \ 147 tst-adjtimex-time64 \ 148 tst-clock_adjtime-time64 \ 149 tst-ntp_adjtime-time64 \ 150 tst-ntp_gettime-time64 \ 151 tst-ntp_gettimex-time64 \ 152 tst-ppoll-time64 \ 153 tst-sigtimedwait-time64 \ 154 tst-timerfd-time64 \ 155 tst-prctl-time64 \ 156 tst-scm_rights-time64 \ 157 # tests-time64 158 159tests-clone-internal = \ 160 tst-align-clone-internal \ 161 tst-clone2-internal \ 162 tst-clone3-internal \ 163 tst-getpid1-internal \ 164 tst-misalign-clone-internal 165tests-internal += $(tests-clone-internal) 166tests-static += $(tests-clone-internal) 167 168CFLAGS-tst-sigcontext-get_pc.c = -fasynchronous-unwind-tables 169 170# Generate the list of SYS_* macros for the system calls (__NR_* 171# macros). The file syscall-names.list contains all possible system 172# call names, and the generated header file produces SYS_* macros for 173# the __NR_* macros which are actually defined. 174 175generated += bits/syscall.h 176$(objpfx)bits/syscall.h: \ 177 ../sysdeps/unix/sysv/linux/gen-syscall-h.awk \ 178 ../sysdeps/unix/sysv/linux/syscall-names.list 179 $(make-target-directory) 180 LC_ALL=C $(AWK) -f $^ > $@-tmp 181 $(move-if-change) $@-tmp $@ 182before-compile += $(objpfx)bits/syscall.h 183 184# All macros defined by <sys/syscall.h>. Include <bits/syscall.h> 185# explicitly because <sys/sycall.h> skips it if _LIBC is defined. 186$(objpfx)tst-syscall-list-macros.list: \ 187 $(objpfx)bits/syscall.h ../sysdeps/unix/sysv/linux/sys/syscall.h 188 printf '#include <linux/version.h>\n\ 189#include <sys/syscall.h>\n#include <bits/syscall.h>\n' | \ 190 $(CC) -E -o $@-tmp $(CFLAGS) $(CPPFLAGS) -x c - -dM 191 $(move-if-change) $@-tmp $@ 192 193# __NR_* system call names. Used by the test below. 194$(objpfx)tst-syscall-list-nr.list: \ 195 ../sysdeps/unix/sysv/linux/filter-nr-syscalls.awk \ 196 $(objpfx)tst-syscall-list-macros.list 197 LC_ALL=C $(AWK) -f $^ > $@-tmp 198 $(move-if-change) $@-tmp $@ 199 200# SYS_* system call names. Used by the test below. 201$(objpfx)tst-syscall-list-sys.list: $(objpfx)tst-syscall-list-macros.list 202 LC_ALL=C $(AWK) '/^#define SYS_/ { print substr($$2, 5) }' $< > $@-tmp 203 $(move-if-change) $@-tmp $@ 204 205tests-special += $(objpfx)tst-syscall-list.out 206$(objpfx)tst-syscall-list.out: \ 207 ../sysdeps/unix/sysv/linux/tst-syscall-list.sh \ 208 $(objpfx)tst-syscall-list-macros.list \ 209 $(objpfx)tst-syscall-list-nr.list \ 210 $(objpfx)tst-syscall-list-sys.list 211 $(BASH) $^ $(AWK) > $@; $(evaluate-test) 212 213tests-special += $(objpfx)tst-glibcsyscalls.out 214# arch-syscall.h is located via the sysdeps override search path. 215$(objpfx)tst-glibcsyscalls.out: arch-syscall.h \ 216 ../sysdeps/unix/sysv/linux/syscall-names.list 217 $(sysdeps-linux-python) \ 218 ../sysdeps/unix/sysv/linux/tst-glibcsyscalls.py \ 219 $(sysdeps-linux-python-cc) $< \ 220 ../sysdeps/unix/sysv/linux/syscall-names.list \ 221 < /dev/null > $@ 2>&1; $(evaluate-test) 222$(objpfx)tst-glibcsyscalls.out: \ 223 ../sysdeps/unix/sysv/linux/tst-glibcsyscalls.py \ 224 $(sysdeps-linux-python-deps) 225 226# Separate object file for access to the constant from the UAPI header. 227$(objpfx)tst-sysconf-iov_max: $(objpfx)tst-sysconf-iov_max-uapi.o 228 229tests-special += $(objpfx)tst-mman-consts.out 230$(objpfx)tst-mman-consts.out: ../sysdeps/unix/sysv/linux/tst-mman-consts.py 231 $(sysdeps-linux-python) \ 232 ../sysdeps/unix/sysv/linux/tst-mman-consts.py \ 233 $(sysdeps-linux-python-cc) \ 234 < /dev/null > $@ 2>&1; $(evaluate-test) 235$(objpfx)tst-mman-consts.out: $(sysdeps-linux-python-deps) 236 237tst-rseq-disable-ENV = GLIBC_TUNABLES=glibc.pthread.rseq=0 238 239endif # $(subdir) == misc 240 241ifeq ($(subdir),time) 242sysdep_headers += sys/timex.h bits/timex.h 243 244sysdep_routines += ntp_gettime ntp_gettimex 245 246tests += \ 247 tst-clock_gettime-clobber \ 248 tst-gettimeofday-clobber \ 249 tst-time-clobber \ 250 # tests 251endif 252 253ifeq ($(subdir),signal) 254tests-special += $(objpfx)tst-signal-numbers.out 255# Depending on signal.o* is a hack. What we actually want is a dependency 256# on signal.h and everything it includes. That's impractical to write 257# in this context, but signal.c includes signal.h and not much else so it'll 258# be conservatively correct. 259$(objpfx)tst-signal-numbers.out: \ 260 ../sysdeps/unix/sysv/linux/tst-signal-numbers.py \ 261 $(objpfx)signal.o* 262 $(sysdeps-linux-python) \ 263 ../sysdeps/unix/sysv/linux/tst-signal-numbers.py \ 264 $(sysdeps-linux-python-cc) \ 265 < /dev/null > $@ 2>&1; $(evaluate-test) 266$(objpfx)tst-signal-numbers.out: $(sysdeps-linux-python-deps) 267endif 268 269ifeq ($(subdir),socket) 270sysdep_headers += net/if_ppp.h net/ppp-comp.h \ 271 net/ppp_defs.h net/if_arp.h net/route.h net/ethernet.h \ 272 net/if_slip.h net/if_packet.h net/if_shaper.h \ 273 bits/socket-constants.h 274sysdep_routines += cmsg_nxthdr 275CFLAGS-recvmmsg.c = -fexceptions -fasynchronous-unwind-tables 276CFLAGS-sendmmsg.c = -fexceptions -fasynchronous-unwind-tables 277 278tests-special += $(objpfx)tst-socket-consts.out 279$(objpfx)tst-socket-consts.out: ../sysdeps/unix/sysv/linux/tst-socket-consts.py 280 PYTHONPATH=../scripts \ 281 $(PYTHON) ../sysdeps/unix/sysv/linux/tst-socket-consts.py \ 282 --cc="$(CC) $(patsubst -DMODULE_NAME=%, \ 283 -DMODULE_NAME=testsuite, \ 284 $(CPPFLAGS)) -D_ISOMAC" \ 285 < /dev/null > $@ 2>&1; $(evaluate-test) 286endif # $(subdir) == socket 287 288ifeq ($(subdir),sunrpc) 289sysdep_headers += nfs/nfs.h 290endif 291 292ifeq ($(subdir),termios) 293sysdep_headers += termio.h 294endif 295 296ifeq ($(subdir),posix) 297sysdep_headers += bits/initspin.h 298 299sysdep_routines += sched_getcpu oldglob getcpu 300 301tests += tst-affinity tst-affinity-pid 302 303tests-static := tst-affinity-static 304tests += $(tests-static) 305 306CFLAGS-fork.c = $(libio-mtsafe) 307CFLAGS-getpid.o = -fomit-frame-pointer 308CFLAGS-getpid.os = -fomit-frame-pointer 309endif 310 311ifeq ($(subdir),inet) 312sysdep_headers += netinet/if_fddi.h netinet/if_tr.h \ 313 netipx/ipx.h netash/ash.h netax25/ax25.h netatalk/at.h \ 314 netrom/netrom.h netpacket/packet.h netrose/rose.h \ 315 neteconet/ec.h netiucv/iucv.h 316sysdep_routines += netlink_assert_response 317endif 318 319# Don't compile the ctype glue code, since there is no old non-GNU C library. 320inhibit-glue = yes 321 322ifeq ($(subdir),dirent) 323sysdep_routines += getdirentries getdirentries64 324tests += tst-getdents64 325 326# The tested readdir64 symbol was replaced in glibc 2.2. 327ifeq ($(have-GLIBC_2.1.3)$(build-shared),yesyes) 328tests += tst-readdir64-compat 329endif 330endif # $(subdir) == dirent 331 332ifeq ($(subdir),nis) 333CFLAGS-ypclnt.c = -DUSE_BINDINGDIR=1 334endif 335 336ifeq ($(subdir),io) 337sysdep_routines += xstatconv internal_statvfs \ 338 sync_file_range fallocate fallocate64 \ 339 close_nocancel fcntl_nocancel \ 340 open_nocancel open64_nocancel \ 341 openat_nocancel openat64_nocancel \ 342 read_nocancel pread64_nocancel \ 343 write_nocancel statx_cp stat_t64_cp 344 345sysdep_headers += bits/fcntl-linux.h 346 347tests += tst-fallocate tst-fallocate64 tst-o_path-locks 348endif 349 350ifeq ($(subdir),elf) 351sysdep-rtld-routines += dl-brk dl-sbrk dl-getcwd dl-openat64 dl-opendir 352 353libof-lddlibc4 = lddlibc4 354 355others += pldd 356install-bin += pldd 357$(objpfx)pldd: $(objpfx)xmalloc.o 358endif 359 360ifeq ($(subdir),rt) 361CFLAGS-mq_send.c += -fexceptions 362CFLAGS-mq_receive.c += -fexceptions 363endif 364 365ifeq ($(subdir),nscd) 366sysdep-CFLAGS += -DHAVE_EPOLL -DHAVE_INOTIFY -DHAVE_NETLINK 367CFLAGS-gai.c += -DNEED_NETLINK 368endif 369 370ifeq ($(subdir),nptl) 371tests += tst-align-clone tst-getpid1 372 373# tst-rseq-nptl is an internal test because it requires a definition of 374# __NR_rseq from the internal system call list. 375tests-internal += tst-rseq-nptl 376endif 377