diff options
-rw-r--r-- | sysdeps/unix/Makefile | 30 | ||||
-rw-r--r-- | sysdeps/unix/make-syscalls.sh | 10 |
2 files changed, 40 insertions, 0 deletions
diff --git a/sysdeps/unix/Makefile b/sysdeps/unix/Makefile index 18de414..f360013 100644 --- a/sysdeps/unix/Makefile +++ b/sysdeps/unix/Makefile @@ -282,6 +282,36 @@ omit-deps += $(unix-syscalls) ifeq (misc,$(subdir)) sysdep_routines += $(unix-extra-syscalls) + +ifdef unix-stub-syscalls +# The system call entry points in this list are supposed to be additional +# functions not overriding any other sysdeps/.../call.c implementation, but +# their system call numbers are unavailable in the kernel headers we're +# using. Instead of a system call stub, these get a function that fails +# with ENOSYS. We just generate a single module defining one function and +# making all these entry point names aliases for it. +sysdep_routines += stub-syscalls +$(objpfx)stub-syscalls.c: $(common-objpfx)sysd-syscalls \ + $(..)sysdeps/unix/Makefile + (echo '#include <errno.h>'; \ + echo 'long int _no_syscall (void)'; \ + echo '{ __set_errno (ENOSYS); return -1L; }'; \ + for call in $(unix-stub-syscalls); do \ + case $$call in \ + *@@*) ver=$${call##*@}; call=$${call%%*@}; \ + echo "strong_alias (_no_syscall, $${call}_$${ver})"; \ + echo "default_symbol_version \ + ($${call}_$${ver}, $$call, $$ver);" ;; \ + *@@*) ver=$${call##*@}; call=$${call%%*@}; \ + echo "strong_alias (_no_syscall, $${call}_$${ver})"; \ + echo "symbol_version ($${call}_$${ver}, $$call, $$ver);" ;; \ + *) echo "weak_alias (_no_syscall, $$call)"; \ + echo "weak_alias (_no_syscall, __GI_$$call)" ;; \ + esac; \ + done) > $@T + mv -f $@T $@ +generated += stub-syscalls.c +endif endif export sysdirs diff --git a/sysdeps/unix/make-syscalls.sh b/sysdeps/unix/make-syscalls.sh index 275875e..0c7eab6 100644 --- a/sysdeps/unix/make-syscalls.sh +++ b/sysdeps/unix/make-syscalls.sh @@ -111,6 +111,16 @@ while read file srcfile caller syscall args strong weak; do echo "#### CALL=$file NUMBER=$callnum ARGS=$args SOURCE=$srcfile" case x$srcfile"$callnum" in + x--) + # Undefined callnum for an extra syscall. + if [ x$caller != x- ]; then + if [ x$noerrno != x ]; then + echo >&2 "$0: no number for $fileno, no-error syscall ($strong $weak)" + exit 2 + fi + echo "unix-stub-syscalls += $strong $weak" + fi + ;; x*-) ;; ### Do nothing for undefined callnum x-*) echo "ifeq (,\$(filter $file,\$(unix-syscalls)))" |