| 1 | /* Data for vDSO support. Linux version. |
| 2 | Copyright (C) 2020-2023 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 | /* This file is included in three different modes for both static (libc.a) |
| 20 | and shared (rtld) modes: |
| 21 | |
| 22 | 1. PROCINFO_DECL is defined, meaning we are only interested in |
| 23 | declarations. For static it requires use the extern keywork along with |
| 24 | the attribute_relro while for shared it will be embedded in the |
| 25 | rtld_global_ro. |
| 26 | |
| 27 | 2. PROCINFO_DECL and SHARED are not defined. Nothing to do, the default |
| 28 | zero initializion is suffice. |
| 29 | |
| 30 | 3. PROCINFO_DECL is not defined while SHARED is. Similar to 2., the zero |
| 31 | initialization of rtld_global_ro is suffice. */ |
| 32 | |
| 33 | #ifndef PROCINFO_CLASS |
| 34 | # define PROCINFO_CLASS |
| 35 | #endif |
| 36 | |
| 37 | #ifndef SHARED |
| 38 | # define RELRO attribute_relro |
| 39 | #else |
| 40 | # define RELRO |
| 41 | #endif |
| 42 | |
| 43 | #if defined PROCINFO_DECL || !defined SHARED |
| 44 | # ifdef HAVE_CLOCK_GETTIME_VSYSCALL |
| 45 | PROCINFO_CLASS int (*_dl_vdso_clock_gettime) (clockid_t, |
| 46 | struct timespec *) RELRO; |
| 47 | #endif |
| 48 | # ifdef HAVE_CLOCK_GETTIME64_VSYSCALL |
| 49 | PROCINFO_CLASS int (*_dl_vdso_clock_gettime64) (clockid_t, |
| 50 | struct __timespec64 *) RELRO; |
| 51 | #endif |
| 52 | # ifdef HAVE_GETTIMEOFDAY_VSYSCALL |
| 53 | PROCINFO_CLASS int (*_dl_vdso_gettimeofday) (struct timeval *, void *) RELRO; |
| 54 | #endif |
| 55 | # ifdef HAVE_TIME_VSYSCALL |
| 56 | PROCINFO_CLASS time_t (*_dl_vdso_time) (time_t *) RELRO; |
| 57 | # endif |
| 58 | # ifdef HAVE_GETCPU_VSYSCALL |
| 59 | PROCINFO_CLASS int (*_dl_vdso_getcpu) (unsigned *, unsigned *, void *) RELRO; |
| 60 | # endif |
| 61 | # ifdef HAVE_CLOCK_GETRES_VSYSCALL |
| 62 | PROCINFO_CLASS int (*_dl_vdso_clock_getres) (clockid_t, |
| 63 | struct timespec *) RELRO; |
| 64 | # endif |
| 65 | # ifdef HAVE_CLOCK_GETRES64_VSYSCALL |
| 66 | PROCINFO_CLASS int (*_dl_vdso_clock_getres_time64) (clockid_t, |
| 67 | struct __timespec64 *) RELRO; |
| 68 | # endif |
| 69 | |
| 70 | /* PowerPC specific ones. */ |
| 71 | # ifdef HAVE_GET_TBFREQ |
| 72 | PROCINFO_CLASS uint64_t (*_dl_vdso_get_tbfreq)(void) RELRO; |
| 73 | # endif |
| 74 | #endif |
| 75 | |
| 76 | #undef RELRO |
| 77 | #undef PROCINFO_DECL |
| 78 | #undef PROCINFO_CLASS |
| 79 | |