PowerPC: use _dl_static_init to set GLRO(gl_pagesize)
[glibc.git] / sysdeps / unix / Makefile
blobc5eb87e4fb0dedf3ae5a23b0bd5db2ba0deba186
1 # Copyright (C) 1991-2012 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <http://www.gnu.org/licenses/>.
18 ifndef inhibit-unix-syscalls
20 # Sysdep dirs unix/... can contain a file syscalls.list,
21 # which specifies objects to be compiled as simple Unix system calls.
23 -include $(common-objpfx)sysd-syscalls
25 ifeq (misc,$(subdir))
26 sysdep_routines += $(unix-extra-syscalls)
28 ifdef unix-stub-syscalls
29 # The system call entry points in this list are supposed to be additional
30 # functions not overriding any other sysdeps/.../call.c implementation, but
31 # their system call numbers are unavailable in the kernel headers we're
32 # using. Instead of a system call stub, these get a function that fails
33 # with ENOSYS. We just generate a single module defining one function and
34 # making all these entry point names aliases for it.
35 sysdep_routines += stub-syscalls
36 $(objpfx)stub-syscalls.c: $(common-objpfx)sysd-syscalls \
37 $(..)sysdeps/unix/Makefile
38 $(make-target-directory)
39 (for call in $(unix-stub-syscalls); do \
40 call=$${call%%@*}; \
41 echo "#define $$call RENAMED_$$call"; \
42 done; \
43 echo '#include <errno.h>'; \
44 echo '#include <shlib-compat.h>'; \
45 for call in $(unix-stub-syscalls); do \
46 call=$${call%%@*}; \
47 echo "#undef $$call"; \
48 done; \
49 echo 'long int _no_syscall (void)'; \
50 echo '{ __set_errno (ENOSYS); return -1L; }'; \
51 for call in $(unix-stub-syscalls); do \
52 case $$call in \
53 *@@*) \
54 ver=$${call##*@}; call=$${call%%@*}; ver=$${ver//./_}; \
55 echo "strong_alias (_no_syscall, __$${call}_$${ver})"; \
56 echo "versioned_symbol (libc, __$${call}_$${ver}, $$call, $$ver);"\
57 ;; \
58 *@*) \
59 ver=$${call##*@}; call=$${call%%@*}; ver=$${ver//./_}; \
60 echo "strong_alias (_no_syscall, __$${call}_$${ver})"; \
61 echo "compat_symbol (libc, __$${call}_$${ver}, $$call, $$ver);" \
62 ;; \
63 *) echo "weak_alias (_no_syscall, $$call)"; \
64 echo "stub_warning ($$call)"; \
65 echo "weak_alias (_no_syscall, __GI_$$call)" ;; \
66 esac; \
67 done) > $@T
68 mv -f $@T $@
69 generated += stub-syscalls.c
70 endif
71 endif
73 # This is the end of the pipeline for compiling the syscall stubs.
74 # The stdin is assembler with cpp using sysdep.h macros.
75 compile-syscall = $(COMPILE.S) -o $@ -x assembler-with-cpp - \
76 $(compile-mkdep-flags)
78 ifndef avoid-generated
79 $(common-objpfx)sysd-syscalls: $(..)sysdeps/unix/make-syscalls.sh \
80 $(wildcard $(+sysdep_dirs:%=%/syscalls.list))
81 for dir in $(+sysdep_dirs); do \
82 test -f $$dir/syscalls.list && \
83 { sysdirs='$(sysdirs)' \
84 asm_CPP='$(COMPILE.S) -E -x assembler-with-cpp' \
85 $(SHELL) $(dir $<)$(notdir $<) $$dir || exit 1; }; \
86 test $$dir = $(..)sysdeps/unix && break; \
87 done > $@T
88 mv -f $@T $@
89 endif
91 # The $(bppfx)syscall.ob objects depend on s-proto-bp.d, which are
92 # generated to specify dependencies generated BP stubs have on headers.
93 # These deps use file names relative to a subdir, so don't
94 # include them in the parent directory.
95 ifneq (,$(filter $(unix-syscalls),$(routines) $(sysdep_routines) $(aux)))
96 ifndef no_deps
97 -include $(common-objpfx)s-proto-bp.d
98 endif
99 endif
101 $(common-objpfx)s-%.d: $(..)sysdeps/unix/s-%.S \
102 $(wildcard $(+sysdep_dirs:%=%/syscalls.list))
103 $(+make-deps)
105 common-generated += s-proto-bp.d
106 postclean-generated += sysd-syscalls
108 endif