hjl / source-git / glibc

Forked from source-git/glibc 3 years ago
Clone

Blame sysdeps/unix/Makefile

Packit 6c4009
# Copyright (C) 1991-2018 Free Software Foundation, Inc.
Packit 6c4009
# This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
# The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
# modify it under the terms of the GNU Lesser General Public
Packit 6c4009
# License as published by the Free Software Foundation; either
Packit 6c4009
# version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
# The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
# Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
# You should have received a copy of the GNU Lesser General Public
Packit 6c4009
# License along with the GNU C Library; if not, see
Packit 6c4009
# <http://www.gnu.org/licenses/>.
Packit 6c4009
Packit 6c4009
ifndef inhibit-unix-syscalls
Packit 6c4009
Packit 6c4009
# Sysdep dirs unix/... can contain a file syscalls.list,
Packit 6c4009
# which specifies objects to be compiled as simple Unix system calls.
Packit 6c4009
Packit 6c4009
-include $(common-objpfx)sysd-syscalls
Packit 6c4009
Packit 6c4009
ifeq (misc,$(subdir))
Packit 6c4009
sysdep_routines += $(unix-extra-syscalls)
Packit 6c4009
Packit 6c4009
ifdef unix-stub-syscalls
Packit 6c4009
# The system call entry points in this list are supposed to be additional
Packit 6c4009
# functions not overriding any other sysdeps/.../call.c implementation, but
Packit 6c4009
# their system call numbers are unavailable in the kernel headers we're
Packit 6c4009
# using.  Instead of a system call stub, these get a function that fails
Packit 6c4009
# with ENOSYS.  We just generate a single module defining one function and
Packit 6c4009
# making all these entry point names aliases for it.
Packit 6c4009
sysdep_routines += stub-syscalls
Packit 6c4009
$(objpfx)stub-syscalls.c: $(common-objpfx)sysd-syscalls \
Packit 6c4009
			  $(..)sysdeps/unix/Makefile
Packit 6c4009
	$(make-target-directory)
Packit 6c4009
	(for call in $(unix-stub-syscalls); do \
Packit 6c4009
	   call=$${call%%@*}; \
Packit 6c4009
	   echo "#define $$call RENAMED_$$call"; \
Packit 6c4009
	 done; \
Packit 6c4009
	 echo '#include <errno.h>'; \
Packit 6c4009
	 echo '#include <shlib-compat.h>'; \
Packit 6c4009
	 for call in $(unix-stub-syscalls); do \
Packit 6c4009
	   call=$${call%%@*}; \
Packit 6c4009
	   echo "#undef $$call"; \
Packit 6c4009
	 done; \
Packit 6c4009
	 echo 'long int _no_syscall (void)'; \
Packit 6c4009
	 echo '{ __set_errno (ENOSYS); return -1L; }'; \
Packit 6c4009
	 for call in $(unix-stub-syscalls); do \
Packit 6c4009
	   case $$call in \
Packit 6c4009
	   *@@*) \
Packit 6c4009
	     ver=$${call##*@}; call=$${call%%@*}; \
Packit 6c4009
	     ver=`echo "$$ver" | sed 's/\./_/g'`; \
Packit 6c4009
	     echo "strong_alias (_no_syscall, __$${call}_$${ver})"; \
Packit 6c4009
	     echo "versioned_symbol (libc, __$${call}_$${ver}, $$call, $$ver);"\
Packit 6c4009
	     ;; \
Packit 6c4009
	   *@*) \
Packit 6c4009
	     ver=$${call##*@}; call=$${call%%@*}; \
Packit 6c4009
	     ver=`echo "$$ver" | sed 's/\./_/g'`; \
Packit 6c4009
	     case $$ver in \
Packit 6c4009
	     *:*) \
Packit 6c4009
	       compat_ver=$${ver#*:}; \
Packit 6c4009
	       ver=$${ver%%:*}; \
Packit 6c4009
	       compat_cond="SHLIB_COMPAT (libc, $$ver, $$compat_ver)"; \
Packit 6c4009
	       ;; \
Packit 6c4009
	     *) \
Packit 6c4009
	       compat_cond=""; \
Packit 6c4009
	       ;; \
Packit 6c4009
	     esac; \
Packit 6c4009
	     if [ -n "$$compat_cond" ]; then echo "#if $$compat_cond"; fi; \
Packit 6c4009
	     echo "strong_alias (_no_syscall, __$${call}_$${ver})"; \
Packit 6c4009
	     echo "compat_symbol (libc, __$${call}_$${ver}, $$call, $$ver);"; \
Packit 6c4009
	     if [ -n "$$compat_cond" ]; then echo "#endif"; fi; \
Packit 6c4009
	     ;; \
Packit 6c4009
	   *) echo "weak_alias (_no_syscall, $$call)"; \
Packit 6c4009
	      echo "stub_warning ($$call)"; \
Packit 6c4009
	      echo "weak_alias (_no_syscall, __GI_$$call)" ;; \
Packit 6c4009
	   esac; \
Packit 6c4009
	 done) > $@T
Packit 6c4009
	mv -f $@T $@
Packit 6c4009
generated += stub-syscalls.c
Packit 6c4009
endif
Packit 6c4009
endif
Packit 6c4009
Packit 6c4009
# This is the end of the pipeline for compiling the syscall stubs.
Packit 6c4009
# The stdin is assembler with cpp using sysdep.h macros.
Packit 6c4009
compile-syscall = $(COMPILE.S) -o $@ -x assembler-with-cpp - \
Packit 6c4009
			       $(compile-mkdep-flags)
Packit 6c4009
Packit 6c4009
ifndef avoid-generated
Packit 6c4009
$(common-objpfx)sysd-syscalls: $(..)sysdeps/unix/make-syscalls.sh \
Packit 6c4009
			       $(wildcard $(+sysdep_dirs:%=%/syscalls.list)) \
Packit 6c4009
			       $(common-objpfx)libc-modules.stmp
Packit 6c4009
	for dir in $(+sysdep_dirs); do \
Packit 6c4009
	  test -f $$dir/syscalls.list && \
Packit 6c4009
	  { sysdirs='$(sysdirs)' \
Packit 6c4009
	    asm_CPP='$(COMPILE.S) -E -x assembler-with-cpp' \
Packit 6c4009
	    $(SHELL) $(dir $<)$(notdir $<) $$dir || exit 1; }; \
Packit 6c4009
	  test $$dir = $(..)sysdeps/unix && break; \
Packit 6c4009
	done > $@T
Packit 6c4009
	mv -f $@T $@
Packit 6c4009
endif
Packit 6c4009
Packit 6c4009
$(common-objpfx)s-%.d: $(..)sysdeps/unix/s-%.S \
Packit 6c4009
		       $(wildcard $(+sysdep_dirs:%=%/syscalls.list))
Packit 6c4009
	$(+make-deps)
Packit 6c4009
Packit 6c4009
postclean-generated += sysd-syscalls
Packit 6c4009
Packit 6c4009
endif