]> sourceware.org Git - glibc.git/blob - sysdeps/unix/sysv/linux/init-first.c
elf: Enable relro for static build
[glibc.git] / sysdeps / unix / sysv / linux / init-first.c
1 /* vDSO internal symbols. Linux generic version.
2 Copyright (C) 2019-2020 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19 #include <dl-vdso.h>
20 #include <libc-vdso.h>
21
22 /* vDSO symbol used on clock_gettime implementation. */
23 #ifdef HAVE_CLOCK_GETTIME_VSYSCALL
24 int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
25 attribute_hidden;
26 #endif
27 /* vDSO symbol used on clock_gettime64 implementation. */
28 #ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
29 int (*VDSO_SYMBOL(clock_gettime64)) (clockid_t, struct __timespec64 *)
30 attribute_hidden;
31 #endif
32 /* vDSO symbol used on clock_getres implementation. */
33 #ifdef HAVE_CLOCK_GETRES_VSYSCALL
34 int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *)
35 attribute_hidden;
36 #endif
37 /* vDSO symbol used on gettimeofday implementation. */
38 #ifdef HAVE_GETTIMEOFDAY_VSYSCALL
39 int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *)
40 attribute_hidden;
41 #endif
42 /* vDSO symbol used on GNU extension getcpu implementation. */
43 #ifdef HAVE_GETCPU_VSYSCALL
44 long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *)
45 attribute_hidden;
46 #endif
47 /* vDSO symbol used on time implementation. */
48 #ifdef HAVE_TIME_VSYSCALL
49 time_t (*VDSO_SYMBOL(time)) (time_t *) attribute_hidden;
50 #endif
51
52 static inline void
53 __libc_vdso_platform_setup (void)
54 {
55 #ifdef HAVE_CLOCK_GETTIME_VSYSCALL
56 VDSO_SYMBOL(clock_gettime)
57 = get_vdso_mangle_symbol (HAVE_CLOCK_GETTIME_VSYSCALL);
58 #endif
59
60 #ifdef HAVE_CLOCK_GETTIME64_VSYSCALL
61 VDSO_SYMBOL(clock_gettime64)
62 = get_vdso_mangle_symbol (HAVE_CLOCK_GETTIME64_VSYSCALL);
63 #endif
64
65 #ifdef HAVE_CLOCK_GETRES_VSYSCALL
66 VDSO_SYMBOL(clock_getres)
67 = get_vdso_mangle_symbol (HAVE_CLOCK_GETRES_VSYSCALL);
68 #endif
69
70 #ifdef HAVE_GETTIMEOFDAY_VSYSCALL
71 VDSO_SYMBOL(gettimeofday)
72 = get_vdso_mangle_symbol (HAVE_GETTIMEOFDAY_VSYSCALL);
73 #endif
74
75 #ifdef HAVE_GETCPU_VSYSCALL
76 VDSO_SYMBOL(getcpu) = get_vdso_mangle_symbol (HAVE_GETCPU_VSYSCALL);
77 #endif
78
79 #ifdef HAVE_TIME_VSYSCALL
80 VDSO_SYMBOL(time) = get_vdso_mangle_symbol (HAVE_TIME_VSYSCALL);
81 #endif
82
83 #ifdef VDSO_SETUP_ARCH
84 VDSO_SETUP_ARCH ();
85 #endif
86 }
87
88 #define VDSO_SETUP __libc_vdso_platform_setup
89
90 #include <csu/init-first.c>
This page took 0.039768 seconds and 5 git commands to generate.