]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/powerpc/gettimeofday.c
Remove PREPARE_VERSION and PREPARE_VERSION_KNOW
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / powerpc / gettimeofday.c
CommitLineData
04277e02 1/* Copyright (C) 2005-2019 Free Software Foundation, Inc.
8c2e201b
UD
2 This file is part of the GNU C Library.
3
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.
8
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.
13
14 You should have received a copy of the GNU Lesser General Public
59ba27a6 15 License along with the GNU C Library; if not, see
5a82c748 16 <https://www.gnu.org/licenses/>. */
8c2e201b 17
a4d7fe35
SL
18#if defined SHARED && !defined __powerpc64__
19# define __gettimeofday __redirect___gettimeofday
20#else
21# define __redirect___gettimeofday __gettimeofday
22#endif
ef26eece 23
8c2e201b 24#include <sys/time.h>
8c2e201b 25
ef26eece
AZ
26#ifdef SHARED
27
28# include <dl-vdso.h>
7bf8fb10 29# include <libc-vdso.h>
76a9b998 30# include <dl-machine.h>
ef26eece 31
a4d7fe35
SL
32# ifndef __powerpc64__
33# undef __gettimeofday
ef26eece 34
a4d7fe35
SL
35int
36__gettimeofday_vsyscall (struct timeval *tv, struct timezone *tz)
ef26eece 37{
a4d7fe35 38 return INLINE_VSYSCALL (gettimeofday, 2, tv, tz);
ef26eece 39}
736c304a
AZ
40
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
46 ifuncs calls safe. */
a4d7fe35
SL
47# undef libc_hidden_def
48# define libc_hidden_def(name) \
49 __hidden_ver1 (__gettimeofday_vsyscall, __GI___gettimeofday, \
50 __gettimeofday_vsyscall);
51
52# endif /* !__powerpc64__ */
53
54static int
55__gettimeofday_syscall (struct timeval *tv, struct timezone *tz)
736c304a 56{
a4d7fe35 57 return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
736c304a 58}
a4d7fe35 59
b8386c28
AZ
60# define INIT_ARCH() \
61 void *vdso_gettimeofday = get_vdso_symbol ("__kernel_gettimeofday")
a4d7fe35
SL
62
63/* If the vDSO is not available we fall back syscall. */
64libc_ifunc_hidden (__redirect___gettimeofday, __gettimeofday,
65 vdso_gettimeofday
66 ? VDSO_IFUNC_RET (vdso_gettimeofday)
67 : (void *) __gettimeofday_syscall);
68libc_hidden_def (__gettimeofday)
ef26eece
AZ
69
70#else
8c2e201b 71
ef26eece
AZ
72# include <sysdep.h>
73# include <errno.h>
8c2e201b
UD
74
75int
ef26eece 76__gettimeofday (struct timeval *tv, struct timezone *tz)
8c2e201b 77{
ef26eece 78 return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
8c2e201b 79}
d6c33fda 80libc_hidden_def (__gettimeofday)
ef26eece
AZ
81
82#endif
8c2e201b 83weak_alias (__gettimeofday, gettimeofday)
d6c33fda 84libc_hidden_weak (gettimeofday)