Allow abort PLT references in libc.so for SH.
[glibc.git] / sysdeps / unix / sysv / linux / sysdep-vdso.h
blobfaf5698b6106ca1577b0419d729c35a186130dee
1 /* vDSO common definition for Linux.
2 Copyright (C) 2015-2017 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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/>. */
19 #ifndef SYSDEP_VDSO_LINUX_H
20 # define SYSDEP_VDSO_LINUX_H
22 #define VDSO_SYMBOL(__name) __vdso_##__name
24 #ifndef INTERNAL_VSYSCALL_CALL
25 # define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \
26 funcptr (args)
27 #endif
29 #ifdef SHARED
31 # ifdef HAVE_VSYSCALL
33 # include <libc-vdso.h>
35 # define INLINE_VSYSCALL(name, nr, args...) \
36 ({ \
37 __label__ out; \
38 __label__ iserr; \
39 INTERNAL_SYSCALL_DECL (sc_err); \
40 long int sc_ret; \
42 __typeof (__vdso_##name) vdsop = __vdso_##name; \
43 PTR_DEMANGLE (vdsop); \
44 if (vdsop != NULL) \
45 { \
46 sc_ret = INTERNAL_VSYSCALL_CALL (vdsop, sc_err, nr, ##args); \
47 if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
48 goto out; \
49 if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \
50 goto iserr; \
51 } \
53 sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args); \
54 if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
55 { \
56 iserr: \
57 __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \
58 sc_ret = -1L; \
59 } \
60 out: \
61 sc_ret; \
64 # define INTERNAL_VSYSCALL(name, err, nr, args...) \
65 ({ \
66 __label__ out; \
67 long v_ret; \
69 __typeof (__vdso_##name) vdsop = __vdso_##name; \
70 PTR_DEMANGLE (vdsop); \
71 if (vdsop != NULL) \
72 { \
73 v_ret = INTERNAL_VSYSCALL_CALL (vdsop, err, nr, ##args); \
74 if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \
75 || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \
76 goto out; \
77 } \
78 v_ret = INTERNAL_SYSCALL (name, err, nr, ##args); \
79 out: \
80 v_ret; \
82 # else
83 # define INLINE_VSYSCALL(name, nr, args...) \
84 INLINE_SYSCALL (name, nr, ##args)
85 # define INTERNAL_VSYSCALL(name, err, nr, args...) \
86 INTERNAL_SYSCALL (name, err, nr, ##args)
87 # endif /* HAVE_VSYSCALL */
89 # else /* SHARED */
91 # define INLINE_VSYSCALL(name, nr, args...) \
92 INLINE_SYSCALL (name, nr, ##args)
93 # define INTERNAL_VSYSCALL(name, err, nr, args...) \
94 INTERNAL_SYSCALL (name, err, nr, ##args)
96 #endif /* SHARED */
98 #endif /* SYSDEP_VDSO_LINUX_H */