]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/powerpc/init-first.c
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / powerpc / init-first.c
1 /* Initialization code run first thing by the ELF startup code. Linux/PowerPC.
2 Copyright (C) 2007-2019 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
7 License as published by the Free Software Foundation; either
8 version 2.1 of the 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 <https://www.gnu.org/licenses/>. */
18
19 #include <dl-vdso.h>
20 #include <libc-vdso.h>
21
22 int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *)
23 attribute_hidden;
24 int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *);
25 int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *);
26 unsigned long long (*VDSO_SYMBOL(get_tbfreq)) (void);
27 int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *);
28 time_t (*VDSO_SYMBOL(time)) (time_t *);
29
30 #if defined(__PPC64__) || defined(__powerpc64__)
31 void *VDSO_SYMBOL(sigtramp_rt64);
32 #else
33 void *VDSO_SYMBOL(sigtramp32);
34 void *VDSO_SYMBOL(sigtramp_rt32);
35 #endif
36
37 static inline void
38 _libc_vdso_platform_setup (void)
39 {
40 PREPARE_VERSION_KNOWN (linux2615, LINUX_2_6_15);
41
42 void *p = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2615);
43 PTR_MANGLE (p);
44 VDSO_SYMBOL (gettimeofday) = p;
45
46 p = _dl_vdso_vsym ("__kernel_clock_gettime", &linux2615);
47 PTR_MANGLE (p);
48 VDSO_SYMBOL (clock_gettime) = p;
49
50 p = _dl_vdso_vsym ("__kernel_clock_getres", &linux2615);
51 PTR_MANGLE (p);
52 VDSO_SYMBOL (clock_getres) = p;
53
54 p = _dl_vdso_vsym ("__kernel_get_tbfreq", &linux2615);
55 PTR_MANGLE (p);
56 VDSO_SYMBOL (get_tbfreq) = p;
57
58 p = _dl_vdso_vsym ("__kernel_getcpu", &linux2615);
59 PTR_MANGLE (p);
60 VDSO_SYMBOL (getcpu) = p;
61
62 p = _dl_vdso_vsym ("__kernel_time", &linux2615);
63 PTR_MANGLE (p);
64 VDSO_SYMBOL (time) = p;
65
66 /* PPC64 uses only one signal trampoline symbol, while PPC32 will use
67 two depending if SA_SIGINFO is used (__kernel_sigtramp_rt32) or not
68 (__kernel_sigtramp32).
69 There is no need to pointer mangle these symbol because they will
70 used only for pointer comparison. */
71 #if defined(__PPC64__) || defined(__powerpc64__)
72 VDSO_SYMBOL(sigtramp_rt64) = _dl_vdso_vsym ("__kernel_sigtramp_rt64",
73 &linux2615);
74 #else
75 VDSO_SYMBOL(sigtramp32) = _dl_vdso_vsym ("__kernel_sigtramp32", &linux2615);
76 VDSO_SYMBOL(sigtramp_rt32) = _dl_vdso_vsym ("__kernel_sigtramp_rt32",
77 &linux2615);
78 #endif
79 }
80
81 #define VDSO_SETUP _libc_vdso_platform_setup
82
83 #include <csu/init-first.c>