1 /* Copyright (C) 2005-2016 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 #if defined SHARED && !defined __powerpc64__
19 # define __gettimeofday __redirect___gettimeofday
21 # define __redirect___gettimeofday __gettimeofday
29 # include <libc-vdso.h>
30 # include <dl-machine.h>
32 # ifndef __powerpc64__
33 # undef __gettimeofday
36 __gettimeofday_vsyscall (struct timeval
*tv
, struct timezone
*tz
)
38 return INLINE_VSYSCALL (gettimeofday
, 2, tv
, tz
);
41 /* __GI___gettimeofday is defined as hidden and for ppc32 it enables the
42 compiler make a local call (symbol@local) for internal GLIBC usage. It
43 means the PLT won't be used and the ifunc resolver will be called directly.
44 For ppc64 a call to a function in another translation unit might use a
45 different toc pointer thus disallowing direct branchess and making internal
47 # undef libc_hidden_def
48 # define libc_hidden_def(name) \
49 __hidden_ver1 (__gettimeofday_vsyscall, __GI___gettimeofday, \
50 __gettimeofday_vsyscall);
52 # endif /* !__powerpc64__ */
55 __gettimeofday_syscall (struct timeval
*tv
, struct timezone
*tz
)
57 return INLINE_SYSCALL (gettimeofday
, 2, tv
, tz
);
60 # define INIT_ARCH() \
61 PREPARE_VERSION (linux2615, "LINUX_2.6.15", 123718565); \
62 void *vdso_gettimeofday = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2615);
64 /* If the vDSO is not available we fall back syscall. */
65 libc_ifunc_hidden (__redirect___gettimeofday
, __gettimeofday
,
67 ? VDSO_IFUNC_RET (vdso_gettimeofday
)
68 : (void *) __gettimeofday_syscall
);
69 libc_hidden_def (__gettimeofday
)
77 __gettimeofday (struct timeval
*tv
, struct timezone
*tz
)
79 return INLINE_SYSCALL (gettimeofday
, 2, tv
, tz
);
81 libc_hidden_def (__gettimeofday
)
84 weak_alias (__gettimeofday
, gettimeofday
)
85 libc_hidden_weak (gettimeofday
)