about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/Makefile
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2020-01-02 10:18:10 +0100
committerFlorian Weimer <fweimer@redhat.com>2020-01-02 10:18:10 +0100
commit4cf0d223052dabb9caed29e1e91e1d61933e14fb (patch)
tree67679008431b6bc21bb6f7a5efd5f2071f9a76f1 /sysdeps/unix/sysv/linux/Makefile
parent5f72f9800b250410cad3abfeeb09469ef12b2438 (diff)
downloadglibc-4cf0d223052dabb9caed29e1e91e1d61933e14fb.tar.gz
glibc-4cf0d223052dabb9caed29e1e91e1d61933e14fb.tar.xz
glibc-4cf0d223052dabb9caed29e1e91e1d61933e14fb.zip
Linux: Add tables with system call numbers
The new tables are currently only used for consistency checks
with the installed kernel headers and the architecture-independent
system call names table.  They are based on Linux 5.4.

The goal is to use these architecture-specific tables to ensure
that system call wrappers are available irrespective of the version
of the installed kernel headers.

The tables are formatted in the form of C header files so that they
can be used directly in an #include directive, without external
preprocessing.  (External preprocessing of a plain table file
would introduce cross-subdirectory dependency issues.)  However,
the intent is that they can still be treated as tables and can be
processed by simple tools.

The irregular system call names on 32-bit arm add a complication.
The <fixup-asm-unistd.h> header is introduced to work around that,
and the system calls are listed under regular names in the
<arch-syscall.h> file.

A make target, update-syscalls-list, is added to patch the glibc
sources with data from the current kernel headers.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'sysdeps/unix/sysv/linux/Makefile')
-rw-r--r--sysdeps/unix/sysv/linux/Makefile77
1 files changed, 65 insertions, 12 deletions
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 8735092c12..f12b7b1a2d 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -1,3 +1,45 @@
+# Option to pass to Python scripts to set the C compiler.  Rewriting
+# MODULE_NAME is required to enable the _ISOMAC verbatim header
+# environment.
+sysdeps-linux-python-cc = \
+  --cc="$(CC) $(patsubst -DMODULE_NAME=%,-DMODULE_NAME=testsuite,$(CPPFLAGS))"
+
+# Additional dependencies for Python scripts.
+sysdeps-linux-python-deps = \
+  $(..)sysdeps/unix/sysv/linux/glibcsyscalls.py \
+  $(..)scripts/glibcextract.py
+
+# Invocation of the Python interpreter with the Python search path.
+sysdeps-linux-python = \
+  PYTHONPATH=$(..)scripts:$(..)sysdeps/unix/sysv/linux $(PYTHON)
+
+ifndef subdir
+# This target performs two actions:
+#
+# Replace <arch-syscall.h> with a file generated from kernel headers
+# and <fixup-asm-unistd.h>.  Both files are located via the sysdeps
+# override search path.
+#
+# Update sysdeps/unix/sysv/linux/syscall-names.list with additional
+# names found in the generated <arch-syscall.h> file, so that the
+# global system call names list is a superset of the
+# architecture-specific system call names.
+#
+# To bootstrap a new architecture, create an empty file in the right
+# place and run “make update-arch-syscall” from the top-level of a
+# configured, but not-yet-built glibc tree.
+#
+# --lock points to a file not replaced during the update operation, so
+# that mutual exclusion is achieved.
+.PHONY: update-syscall-lists
+update-syscall-lists: arch-syscall.h
+	$(sysdeps-linux-python) \
+	  sysdeps/unix/sysv/linux/update-syscall-lists.py \
+	    $(sysdeps-linux-python-cc) \
+	    --lock=sysdeps/unix/sysv/linux/update-syscall-lists.py $< \
+	    sysdeps/unix/sysv/linux/syscall-names.list
+endif
+
 ifeq ($(subdir),csu)
 sysdep_routines += errno-loc
 endif
@@ -103,6 +145,19 @@ $(objpfx)tst-syscall-list.out: \
   $(objpfx)tst-syscall-list-sys.list
 	$(BASH) $^ $(AWK) > $@; $(evaluate-test)
 
+tests-special += $(objpfx)tst-glibcsyscalls.out
+# arch-syscall.h is located via the sysdeps override search path.
+$(objpfx)tst-glibcsyscalls.out: arch-syscall.h \
+  ../sysdeps/unix/sysv/linux/syscall-names.list
+	$(sysdeps-linux-python) \
+	  ../sysdeps/unix/sysv/linux/tst-glibcsyscalls.py \
+	    $(sysdeps-linux-python-cc) $< \
+	    ../sysdeps/unix/sysv/linux/syscall-names.list \
+	  < /dev/null > $@ 2>&1; $(evaluate-test)
+$(objpfx)tst-glibcsyscalls.out: \
+  ../sysdeps/unix/sysv/linux/tst-glibcsyscalls.py \
+  $(sysdeps-linux-python-deps)
+
 # Separate object file for access to the constant from the UAPI header.
 $(objpfx)tst-sysconf-iov_max: $(objpfx)tst-sysconf-iov_max-uapi.o
 
@@ -110,12 +165,11 @@ $(objpfx)tst-pkey: $(shared-thread-library)
 
 tests-special += $(objpfx)tst-mman-consts.out
 $(objpfx)tst-mman-consts.out: ../sysdeps/unix/sysv/linux/tst-mman-consts.py
-	PYTHONPATH=../scripts \
-	$(PYTHON) ../sysdeps/unix/sysv/linux/tst-mman-consts.py \
-		   --cc="$(CC) $(patsubst -DMODULE_NAME=%, \
-					  -DMODULE_NAME=testsuite, \
-					  $(CPPFLAGS))" \
-	< /dev/null > $@ 2>&1; $(evaluate-test)
+	$(sysdeps-linux-python) \
+	  ../sysdeps/unix/sysv/linux/tst-mman-consts.py \
+	    $(sysdeps-linux-python-cc) \
+	  < /dev/null > $@ 2>&1; $(evaluate-test)
+$(objpfx)tst-mman-consts.out: $(sysdeps-linux-python-deps)
 
 $(objpfx)tst-gettid: $(shared-thread-library)
 $(objpfx)tst-gettid-kill: $(shared-thread-library)
@@ -138,12 +192,11 @@ tests-special += $(objpfx)tst-signal-numbers.out
 $(objpfx)tst-signal-numbers.out: \
 		../sysdeps/unix/sysv/linux/tst-signal-numbers.py \
 		$(objpfx)signal.o*
-	PYTHONPATH=../scripts \
-	$(PYTHON) ../sysdeps/unix/sysv/linux/tst-signal-numbers.py \
-		   --cc="$(CC) $(patsubst -DMODULE_NAME=%, \
-					  -DMODULE_NAME=testsuite, \
-					  $(CPPFLAGS))" \
-	< /dev/null > $@ 2>&1; $(evaluate-test)
+	$(sysdeps-linux-python) \
+	  ../sysdeps/unix/sysv/linux/tst-signal-numbers.py \
+	    $(sysdeps-linux-python-cc) \
+	  < /dev/null > $@ 2>&1; $(evaluate-test)
+$(objpfx)tst-signal-numbers.out: $(sysdeps-linux-python-deps)
 endif
 
 ifeq ($(subdir),socket)