This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch azanella/vdso-cleanup created. glibc-2.21-286-gc937dcc
- From: azanella at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 24 Apr 2015 14:31:58 -0000
- Subject: GNU C Library master sources branch azanella/vdso-cleanup created. glibc-2.21-286-gc937dcc
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, azanella/vdso-cleanup has been created
at c937dcc14ba5c70fd43b614dd57e891fa82cfdda (commit)
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c937dcc14ba5c70fd43b614dd57e891fa82cfdda
commit c937dcc14ba5c70fd43b614dd57e891fa82cfdda
Author: Adhemerval Zanella <adhemerval.zanella@linaro.com>
Date: Thu Apr 23 09:17:42 2015 -0300
x86: Remove vsyscall usage
This patch removes the vsyscall usage for x86_64 port. As indicated
by kernel code comments [1], vsyscalls are a legacy ABI and its concept
is problematic:
- It interferes with ASLR.
- It's awkward to write code that lives in kernel addresses but is
callable by userspace at fixed addresses.
- The whole concept is impossible for 32-bit compat userspace.
- UML cannot easily virtualize a vsyscall.
The VDSO is a better approach for such functionality.
diff --git a/ChangeLog b/ChangeLog
index 935ec8f..af27cbd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2015-04-24 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysdeps/unix/sysv/linux/i386/gettimeofday.c
+ (__gettimeofday_syscall): Remove.
+ * sysdeps/unix/sysv/linux/i386/time.c (__time_syscall): Remove.
+ * sysdeps/unix/sysv/linux/x86/gettimeofday.c (__gettimeofday_syscall):
+ Add function.
+ (gettimeofday_ifunc): Use __gettimeofday_syscall as fallback mechanism
+ if vDSO is not present.
+ * sysdeps/unix/sysv/linux/x86/time.c (__time_syscall): Add function.
+ (time_ifunc): Use __time_syscall as fallback mechanism if vDSO is not
+ present.
+ * sysdeps/unix/sysv/linux/x86_64/gettimeofday.c: Remove file.
+ * sysdeps/unix/sysv/linux/x86_64/time.c: Likewise.
+
* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
(HAVE_GETCPU_VSYSCALL): Define.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
diff --git a/sysdeps/unix/sysv/linux/i386/gettimeofday.c b/sysdeps/unix/sysv/linux/i386/gettimeofday.c
index 3e00eb4..fdb0fab 100644
--- a/sysdeps/unix/sysv/linux/i386/gettimeofday.c
+++ b/sysdeps/unix/sysv/linux/i386/gettimeofday.c
@@ -20,16 +20,6 @@
#ifdef SHARED
-# include <dl-vdso.h>
-# include <errno.h>
-
-/* If the vDSO is not available we fall back on the syscall. */
-static int
-__gettimeofday_syscall (struct timeval *tv, struct timezone *tz)
-{
- return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
-}
-# define GETTIMEOFAY_FALLBACK (void*) (&__gettimeofday_syscall)
# undef libc_ifunc_hidden_def
# define libc_ifunc_hidden_def(name) \
libc_ifunc_hidden_def1 (__GI_##name, __gettimeofday_syscall)
diff --git a/sysdeps/unix/sysv/linux/i386/time.c b/sysdeps/unix/sysv/linux/i386/time.c
index e8a4e59..66b9a6c 100644
--- a/sysdeps/unix/sysv/linux/i386/time.c
+++ b/sysdeps/unix/sysv/linux/i386/time.c
@@ -18,17 +18,6 @@
#ifdef SHARED
-# include <dl-vdso.h>
-# include <errno.h>
-
-/* If the vDSO is not available we fall back on the old vsyscall. */
-static time_t
-__time_syscall (time_t *t)
-{
- INTERNAL_SYSCALL_DECL (err);
- return INTERNAL_SYSCALL (time, err, 1, t);
-}
-# define TIME_FALLBACK (void*) &__time_syscall
# undef libc_ifunc_hidden_def
# define libc_ifunc_hidden_def(name) \
libc_ifunc_hidden_def1 (__GI_##name, __time_syscall)
diff --git a/sysdeps/unix/sysv/linux/x86/gettimeofday.c b/sysdeps/unix/sysv/linux/x86/gettimeofday.c
index c820fd7..c9cb6ea 100644
--- a/sysdeps/unix/sysv/linux/x86/gettimeofday.c
+++ b/sysdeps/unix/sysv/linux/x86/gettimeofday.c
@@ -21,6 +21,14 @@
#ifdef SHARED
# include <dl-vdso.h>
+# include <errno.h>
+
+/* If the vDSO is not available we fall back on the syscall. */
+static int
+__gettimeofday_syscall (struct timeval *tv, struct timezone *tz)
+{
+ return INLINE_SYSCALL (gettimeofday, 2, tv, tz);
+}
void *gettimeofday_ifunc (void) __asm__ ("__gettimeofday");
@@ -31,7 +39,7 @@ gettimeofday_ifunc (void)
/* If the vDSO is not available we fall back on the old vsyscall. */
return (_dl_vdso_vsym ("__vdso_gettimeofday", &linux26)
- ?: GETTIMEOFAY_FALLBACK);
+ ?: (void*) (&__gettimeofday_syscall));
}
asm (".type __gettimeofday, %gnu_indirect_function");
diff --git a/sysdeps/unix/sysv/linux/x86/time.c b/sysdeps/unix/sysv/linux/x86/time.c
index 1ab9248..3459e17 100644
--- a/sysdeps/unix/sysv/linux/x86/time.c
+++ b/sysdeps/unix/sysv/linux/x86/time.c
@@ -21,6 +21,15 @@
#ifdef SHARED
#include <dl-vdso.h>
+#include <errno.h>
+
+/* If the vDSO is not available we fall back on the old vsyscall. */
+static time_t
+__time_syscall (time_t *t)
+{
+ INTERNAL_SYSCALL_DECL (err);
+ return INTERNAL_SYSCALL (time, err, 1, t);
+}
void *time_ifunc (void) __asm__ ("time");
@@ -29,7 +38,8 @@ time_ifunc (void)
{
PREPARE_VERSION_KNOWN (linux26, LINUX_2_6);
- return _dl_vdso_vsym ("__vdso_time", &linux26) ?: TIME_FALLBACK;
+ return _dl_vdso_vsym ("__vdso_time", &linux26)
+ ?: (void*) &__time_syscall;
}
asm (".type time, %gnu_indirect_function");
diff --git a/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c b/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
deleted file mode 100644
index daa14de..0000000
--- a/sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 2002-2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sys/time.h>
-
-#ifdef SHARED
-/* If the vDSO is not available we fall back on the old vsyscall. */
-# define VSYSCALL_ADDR_vgettimeofday 0xffffffffff600000ul
-# define GETTIMEOFAY_FALLBACK (void*)VSYSCALL_ADDR_vgettimeofday
-#endif
-
-#include <sysdeps/unix/sysv/linux/x86/gettimeofday.c>
diff --git a/sysdeps/unix/sysv/linux/x86_64/time.c b/sysdeps/unix/sysv/linux/x86_64/time.c
deleted file mode 100644
index 6ceb819..0000000
--- a/sysdeps/unix/sysv/linux/x86_64/time.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright (C) 2001-2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef SHARED
-/* If the vDSO is not available we fall back on the old vsyscall. */
-#define VSYSCALL_ADDR_vtime 0xffffffffff600400
-#define TIME_FALLBACK (void*)VSYSCALL_ADDR_vtime
-#endif
-
-#include <sysdeps/unix/sysv/linux/x86/time.c>
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=4a2eeb77b235d6a7fd1b6af0e3da0c4dfc7ff25c
commit 4a2eeb77b235d6a7fd1b6af0e3da0c4dfc7ff25c
Author: Adhemerval Zanella <adhemerval.zanella@linaro.com>
Date: Wed Apr 22 14:21:39 2015 -0300
Consolidate sched_getcpu
This patch consolidates the sched_getcpu implementations across all
arches (except tile, which requires its own). This patch removes
the powerpc, x86_64 and x32 specific files and change the default
linux one to use INLINE_VSYSCALL where possible (for ports that
implements it).
diff --git a/ChangeLog b/ChangeLog
index 01f9215..935ec8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,28 @@
2015-04-24 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
+ (HAVE_GETCPU_VSYSCALL): Define.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
+ (HAVE_GETCPU_VSYSCALL): Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c: Remove file.
+ * sysdeps/unix/sysv/linux/sched_getcpu.c (HAVE_VSYSCALL): Define if
+ HAVE_GETCPU_VSYSCALL and include sysdep-vdso.
+ (sched_getcpu): Use INLINE_VSYSCALL instead of INLINE_SYSCALL.
+ * sysdeps/unix/sysv/linux/x86/libc-vdso.h (getcpu): Add vDSO
+ prototype.
+ * sysdeps/unix/sysv/linux/x86_64/init-first.c
+ (__syscall_clock_gettime): Remove prototype.
+ (__vdso_platform_setup): Remove vsyscall getcpu fallback.
+ * sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S: Remove file.
+ * sysdeps/unix/sysv/linux/x86_64/syscalls.list
+ (__syscall_clock_gettime): Remove defintion.
+ * sysdeps/unix/sysv/linux/x86_64/sysdep.h (HAVE_GETCPU_VSYSCALL):
+ Define.
+ * sysdeps/unix/sysv/linux/x86_64/x32/Makefile: Remove file.
+ * sysdeps/unix/sysv/linux/x86_64/x32/init-first.c: Likewise.
+ * sysdeps/unix//sysv/linux/x86_64/x32/sched_getcpu-static.c: Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S: Likewise.
+
* sysdeps/unix/sysv/linux/i386/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL):
Define.
(HAVE_GETTIMEOFDAY_VSYSCALL): Likewise.
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
index 8bd42ec..f52f1a9 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
@@ -165,6 +165,7 @@
/* List of system calls which are supported as vsyscalls. */
# define HAVE_CLOCK_GETRES_VSYSCALL 1
# define HAVE_CLOCK_GETTIME_VSYSCALL 1
+# define HAVE_GETCPU_VSYSCALL 1
# define LOADARGS_0(name, dummy) \
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
index 1bad856..e2205f9 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
@@ -80,6 +80,7 @@
/* List of system calls which are supported as vsyscalls. */
#define HAVE_CLOCK_GETRES_VSYSCALL 1
#define HAVE_CLOCK_GETTIME_VSYSCALL 1
+#define HAVE_GETCPU_VSYSCALL 1
/* Define a macro which expands inline into the wrapper code for a system
call. This use is for internal calls that do not need to handle errors
diff --git a/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c b/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c
deleted file mode 100644
index f93be01..0000000
--- a/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 2013-2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sched.h>
-#include <sysdep.h>
-#include <sysdep-vdso.h>
-
-int
-sched_getcpu (void)
-{
- unsigned int cpu;
- int r = INLINE_VSYSCALL (getcpu, 3, &cpu, NULL, NULL);
-
- return r == -1 ? r : cpu;
-}
diff --git a/sysdeps/unix/sysv/linux/sched_getcpu.c b/sysdeps/unix/sysv/linux/sched_getcpu.c
index 09f0816..a485d36 100644
--- a/sysdeps/unix/sysv/linux/sched_getcpu.c
+++ b/sysdeps/unix/sysv/linux/sched_getcpu.c
@@ -19,13 +19,17 @@
#include <sched.h>
#include <sysdep.h>
+#ifdef HAVE_GETCPU_VSYSCALL
+# define HAVE_VSYSCALL
+#endif
+#include <sysdep-vdso.h>
int
sched_getcpu (void)
{
#ifdef __NR_getcpu
unsigned int cpu;
- int r = INLINE_SYSCALL (getcpu, 3, &cpu, NULL, NULL);
+ int r = INLINE_VSYSCALL (getcpu, 3, &cpu, NULL, NULL);
return r == -1 ? r : cpu;
#else
diff --git a/sysdeps/unix/sysv/linux/x86/libc-vdso.h b/sysdeps/unix/sysv/linux/x86/libc-vdso.h
index fea9c2b..f3a8f07 100644
--- a/sysdeps/unix/sysv/linux/x86/libc-vdso.h
+++ b/sysdeps/unix/sysv/linux/x86/libc-vdso.h
@@ -29,6 +29,8 @@
extern long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
attribute_hidden;
+extern long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *);
+
#endif
#endif /* _LIBC_VDSO_H */
diff --git a/sysdeps/unix/sysv/linux/x86_64/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c
index b7bdbd1..d83b04b 100644
--- a/sysdeps/unix/sysv/linux/x86_64/init-first.c
+++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c
@@ -27,25 +27,16 @@ long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *)
attribute_hidden;
-extern long int __syscall_clock_gettime (clockid_t, struct timespec *);
-
-
static inline void
__vdso_platform_setup (void)
{
PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
void *p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux26);
- if (p == NULL)
- p = __syscall_clock_gettime;
PTR_MANGLE (p);
VDSO_SYMBOL(clock_gettime) = p;
p = _dl_vdso_vsym ("__vdso_getcpu", &linux26);
- /* If the vDSO is not available we fall back on the old vsyscall. */
-#define VSYSCALL_ADDR_vgetcpu 0xffffffffff600800
- if (p == NULL)
- p = (void *) VSYSCALL_ADDR_vgetcpu;
PTR_MANGLE (p);
VDSO_SYMBOL(getcpu) = p;
}
diff --git a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
deleted file mode 100644
index b87f803..0000000
--- a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Copyright (C) 2007-2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <tls.h>
-#define _ERRNO_H 1
-#include <bits/errno.h>
-#include <kernel-features.h>
-
-/* For the calculation see asm/vsyscall.h. */
-#define VSYSCALL_ADDR_vgetcpu 0xffffffffff600800
-
-
-ENTRY (sched_getcpu)
- /* Align stack and create local variable for result. */
- sub $0x8, %rsp
- cfi_adjust_cfa_offset(8)
-
- movq %rsp, %rdi
- xorl %esi, %esi
- movl $VGETCPU_CACHE_OFFSET, %edx
- addq %fs:0, %rdx
-
-#ifdef SHARED
- movq __vdso_getcpu(%rip), %rax
- PTR_DEMANGLE (%rax)
- callq *%rax
-#else
-# ifdef __NR_getcpu
- movl $__NR_getcpu, %eax
- syscall
-# ifndef __ASSUME_GETCPU_SYSCALL
- cmpq $-ENOSYS, %rax
- jne 1f
-# endif
-# endif
-# ifndef __ASSUME_GETCPU_SYSCALL
- movq $VSYSCALL_ADDR_vgetcpu, %rax
- callq *%rax
-1:
-# else
-# ifndef __NR_getcpu
-# error "cannot happen"
-# endif
-# endif
-#endif
-
- /* Local variable is result if the call is successful. */
- movl (%rsp), %edx
- /* Restore stack pointer before we might jump to
- SYSCALL_ERROR_LABEL which returns to the caller. */
- add $0x8, %rsp
- cfi_adjust_cfa_offset(-8)
-
- cmpq $-4095, %rax
- jae SYSCALL_ERROR_LABEL
-
- movl %edx, %eax
- ret
-PSEUDO_END(sched_getcpu)
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 2e4135f..b4f2075 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -14,7 +14,6 @@ semop - semop i:ipi __semop semop
semtimedop - semtimedop i:ipip semtimedop
semget - semget i:iii __semget semget
semctl - semctl i:iiii __semctl semctl
-syscall_clock_gettime EXTRA clock_gettime Ei:ip __syscall_clock_gettime
# proper socket implementations:
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index bea3192..5a62cce 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -255,6 +255,7 @@
/* List of system calls which are supported as vsyscalls. */
# define HAVE_CLOCK_GETTIME_VSYSCALL 1
# define HAVE_GETTIMEOFDAY_VSYSCALL 1
+# define HAVE_GETCPU_VSYSCALL 1
# define LOAD_ARGS_0()
# define LOAD_REGS_0
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/Makefile b/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
index ecbdefb..8c3253b 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/Makefile
@@ -4,7 +4,3 @@ default-abi := x32
ifeq ($(subdir),misc)
sysdep_routines += arch_prctl
endif
-
-ifeq ($(subdir),posix)
-sysdep_routines += getcpu sched_getcpu-static
-endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c b/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c
deleted file mode 100644
index 31ec80f..0000000
--- a/sysdeps/unix/sysv/linux/x86_64/x32/init-first.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Initialization code run first thing by the ELF startup code. Linux/x32.
- Copyright (C) 2012-2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef SHARED
-# include <dl-vdso.h>
-# include <libc-vdso.h>
-
-long int (*__vdso_clock_gettime) (clockid_t, struct timespec *)
- attribute_hidden;
-
-static inline void
-_libc_vdso_platform_setup (void)
-{
- PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
-
- void *p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux26);
- PTR_MANGLE (p);
- __vdso_clock_gettime = p;
-}
-
-# define VDSO_SETUP _libc_vdso_platform_setup
-#endif
-
-#include <csu/init-first.c>
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu-static.c b/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu-static.c
deleted file mode 100644
index 38bbf9a..0000000
--- a/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu-static.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#ifndef SHARED
-#include "../../sched_getcpu.c"
-#endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S b/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S
deleted file mode 100644
index 35ad01b..0000000
--- a/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright (C) 2012-2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifdef SHARED
-#include <sysdep.h>
-#include <tls.h>
-#define _ERRNO_H 1
-#include <bits/errno.h>
-
-ENTRY (sched_getcpu)
- /* Align stack and create local variable for result. */
- sub $0x8, %esp
- cfi_adjust_cfa_offset(8)
-
- mov %esp, %edi
- xor %esi, %esi
- mov $VGETCPU_CACHE_OFFSET, %edx
- add %fs:0, %edx
-
- call __getcpu
-
- /* Local variable is result if the call is successful. */
- mov (%rsp), %edx
- /* Restore stack pointer before we might jump to
- SYSCALL_ERROR_LABEL which returns to the caller. */
- add $0x8, %esp
- cfi_adjust_cfa_offset(-8)
-
- cmp $-4095, %eax
- jae SYSCALL_ERROR_LABEL
-
- mov %edx, %eax
- ret
-PSEUDO_END(sched_getcpu)
-#endif
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=0bddc8410ab714481b36b8c4403ac17f3a1a1ff8
commit 0bddc8410ab714481b36b8c4403ac17f3a1a1ff8
Author: Adhemerval Zanella <adhemerval.zanella@linaro.com>
Date: Fri Apr 17 14:28:03 2015 -0300
x86: clock_gettime and timespec_get vDSO cleanup
This patch removes the x86 specific timespec_get and clock_gettime
implementation to use generic HAVE_CLOCK_GETTIME_VSYSCALL way.
diff --git a/ChangeLog b/ChangeLog
index e7538e6..01f9215 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2015-04-24 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysdeps/unix/sysv/linux/i386/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL):
+ Define.
+ (HAVE_GETTIMEOFDAY_VSYSCALL): Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/sysdep.h
+ (HAVE_CLOCK_GETTIME_VSYSCALL): Likewise.
+ (HAVE_GETTIMEOFDAY_VSYSCALL): Likewise.
+ * sysdeps/unix/sysv/linux/timespec_get.c: Include errno.h.
+ * sysdeps/unix/sysv/linux/x86/clock_gettime.c: Remove file.
+ * sysdeps/unix/sysv/linux/x86/timespec_get.c: Likewise.
+
* sysdeps/unix/sysv/linux/aarch64/gettimeofday.c: Remove file.
* sysdeps/unix/sysv/linux/s390/gettimeofday.c: Likewise.
* sysdeps/unix/sysv/linux/tile/gettimeofday.c: Likewise.
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h
index 7f6fcf3..d76aca5 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.h
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.h
@@ -328,6 +328,10 @@ struct libc_do_syscall_args
} \
(int) resultvar; })
+/* List of system calls which are supported as vsyscalls. */
+# define HAVE_CLOCK_GETTIME_VSYSCALL 1
+# define HAVE_GETTIMEOFDAY_VSYSCALL 1
+
/* Define a macro which expands inline into the wrapper code for a system
call. This use is for internal calls that do not need to handle errors
normally. It will never touch errno. This returns just what the kernel
diff --git a/sysdeps/unix/sysv/linux/timespec_get.c b/sysdeps/unix/sysv/linux/timespec_get.c
index 0e5f513..b42a44f 100644
--- a/sysdeps/unix/sysv/linux/timespec_get.c
+++ b/sysdeps/unix/sysv/linux/timespec_get.c
@@ -17,6 +17,7 @@
#include <time.h>
#include <sysdep.h>
+#include <errno.h>
#ifdef HAVE_CLOCK_GETTIME_VSYSCALL
# define HAVE_VSYSCALL
diff --git a/sysdeps/unix/sysv/linux/x86/clock_gettime.c b/sysdeps/unix/sysv/linux/x86/clock_gettime.c
deleted file mode 100644
index 98ffb01..0000000
--- a/sysdeps/unix/sysv/linux/x86/clock_gettime.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Get the current value of a clock. Linux/x86 version.
- Copyright (C) 2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <libc-vdso.h>
-
-#ifdef SHARED
-# define SYSCALL_GETTIME(id, tp) \
- ({ long int (*f) (clockid_t, struct timespec *) = __vdso_clock_gettime; \
- long int v_ret; \
- PTR_DEMANGLE (f); \
- v_ret = (*f) (id, tp); \
- if (INTERNAL_SYSCALL_ERROR_P (v_ret, )) { \
- __set_errno (INTERNAL_SYSCALL_ERRNO (v_ret, )); \
- v_ret = -1; \
- } \
- v_ret; })
-#endif
-
-#include <sysdeps/unix/sysv/linux/clock_gettime.c>
diff --git a/sysdeps/unix/sysv/linux/x86/timespec_get.c b/sysdeps/unix/sysv/linux/x86/timespec_get.c
deleted file mode 100644
index b21efce..0000000
--- a/sysdeps/unix/sysv/linux/x86/timespec_get.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* timespec_get -- returns the calendar time based on a given time base.
- Linux/x86 version.
- Copyright (C) 2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <libc-vdso.h>
-
-#ifdef SHARED
-# define INTERNAL_GETTIME(id, tp) \
- ({ long int (*f) (clockid_t, struct timespec *) = __vdso_clock_gettime; \
- PTR_DEMANGLE (f); \
- (*f) (id, tp); })
-#endif
-
-#include <sysdeps/unix/sysv/linux/timespec_get.c>
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index cc66093..bea3192 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -252,6 +252,10 @@
# undef INTERNAL_SYSCALL_ERRNO
# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
+/* List of system calls which are supported as vsyscalls. */
+# define HAVE_CLOCK_GETTIME_VSYSCALL 1
+# define HAVE_GETTIMEOFDAY_VSYSCALL 1
+
# define LOAD_ARGS_0()
# define LOAD_REGS_0
# define ASM_ARGS_0
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=26f27dd7dce319ced192d524213435e7775666f8
commit 26f27dd7dce319ced192d524213435e7775666f8
Author: Adhemerval Zanella <adhemerval.zanella@linaro.com>
Date: Fri Apr 17 11:48:51 2015 -0300
Consolidate gettimeofday across aarch64/s390/tile
This patch removes the architecture specific gettimeofday implementation
to use the vDSO symbol and consolidate it on a common Linux one.
Similat to gettime and getres vDSO implementation, each arch that supports
gettimeofday through vDSO should just implement INLINE_VSYSCALL to access
the symbol and define HAVE_GETTIMEOFDAY_VSYSCAL as 1.
diff --git a/ChangeLog b/ChangeLog
index 1b6ce00..e7538e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2015-04-24 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+ * sysdeps/unix/sysv/linux/aarch64/gettimeofday.c: Remove file.
+ * sysdeps/unix/sysv/linux/s390/gettimeofday.c: Likewise.
+ * sysdeps/unix/sysv/linux/tile/gettimeofday.c: Likewise.
+ * sysdeps/unix/sysv/linux/aarch64/sysdep.h
+ [HAVE_GETTIMEOFDAY_VSYSCALL]: Define.
+ * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
+ [HAVE_GETTIMEOFDAY_VSYSCALL]: Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
+ [HAVE_GETTIMEOFDAY_VSYSCALL]: Likewise.
+ * sysdeps/unix/sysv/linux/tile/sysdep.h
+ [HAVE_GETTIMEOFDAY_VSYSCALL]: Likewise.
+ * sysdeps/unix/sysv/linux/gettimeofday.c: New file: gettimeofday
+ using vDSO syscall macro.
+
* sysdeps/unix/sysv/linux/aarch64/gettimeofday.c (HAVE_VSYSCALL):
define and include sysdep-vdso.h.
* sysdeps/unix/sysv/linux/s390/gettimeofday.c (HAVE_VSYSCALL):
diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
index 80716c7..0a0a278 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
@@ -155,6 +155,7 @@
/* List of system calls which are supported as vsyscalls. */
# define HAVE_CLOCK_GETRES_VSYSCALL 1
# define HAVE_CLOCK_GETTIME_VSYSCALL 1
+# define HAVE_GETTIMEOFDAY_VSYSCALL 1
# define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \
({ \
diff --git a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c b/sysdeps/unix/sysv/linux/gettimeofday.c
similarity index 86%
rename from sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
rename to sysdeps/unix/sysv/linux/gettimeofday.c
index daa6538..d88c39f 100644
--- a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
+++ b/sysdeps/unix/sysv/linux/gettimeofday.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2015 Free Software Foundation, Inc.
+/* Copyright (C) 2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -21,16 +21,16 @@
#undef __gettimeofday
-#define HAVE_VSYSCALL
+#ifdef HAVE_GETTIMEOFDAY_VSYSCALL
+# define HAVE_VSYSCALL
+#endif
#include <sysdep-vdso.h>
/* Get the current time of day and timezone information,
putting it into *tv and *tz. If tz is null, *tz is not filled.
Returns 0 on success, -1 on errors. */
int
-__gettimeofday (tv, tz)
- struct timeval *tv;
- struct timezone *tz;
+__gettimeofday (struct timeval *tv, struct timezone *tz)
{
return INLINE_VSYSCALL (gettimeofday, 2, tv, tz);
}
diff --git a/sysdeps/unix/sysv/linux/s390/gettimeofday.c b/sysdeps/unix/sysv/linux/s390/gettimeofday.c
deleted file mode 100644
index 9f98f29..0000000
--- a/sysdeps/unix/sysv/linux/s390/gettimeofday.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2008-2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <stddef.h>
-#include <sys/time.h>
-#include <time.h>
-#include <hp-timing.h>
-
-#define HAVE_VSYSCALL
-#include <sysdep-vdso.h>
-
-/* Get the current time of day and timezone information,
- putting it into *TV and *TZ. If TZ is NULL, *TZ is not filled.
- Returns 0 on success, -1 on errors. */
-
-int
-__gettimeofday (tv, tz)
- struct timeval *tv;
- struct timezone *tz;
-{
- return INLINE_VSYSCALL (gettimeofday, 2, tv, tz);
-}
-libc_hidden_def (__gettimeofday)
-weak_alias (__gettimeofday, gettimeofday)
-libc_hidden_weak (gettimeofday)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
index 6808651..7b1c0a3 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
@@ -281,6 +281,7 @@
/* List of system calls which are supported as vsyscalls. */
#define HAVE_CLOCK_GETRES_VSYSCALL 1
#define HAVE_CLOCK_GETTIME_VSYSCALL 1
+#define HAVE_GETTIMEOFDAY_VSYSCALL 1
/* This version is for internal uses when there is no desire
to set errno */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
index be76452..31c3b05 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
@@ -287,6 +287,7 @@
/* List of system calls which are supported as vsyscalls. */
#define HAVE_CLOCK_GETRES_VSYSCALL 1
#define HAVE_CLOCK_GETTIME_VSYSCALL 1
+#define HAVE_GETTIMEOFDAY_VSYSCALL 1
/* This version is for internal uses when there is no desire
to set errno */
diff --git a/sysdeps/unix/sysv/linux/tile/gettimeofday.c b/sysdeps/unix/sysv/linux/tile/gettimeofday.c
deleted file mode 100644
index 13382ab..0000000
--- a/sysdeps/unix/sysv/linux/tile/gettimeofday.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 2012-2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <stddef.h>
-#include <sys/time.h>
-#include <time.h>
-
-#define HAVE_VSYSCALL
-#include <sysdep-vdso.h>
-
-int
-__gettimeofday (struct timeval *tv, struct timezone *tz)
-{
- return INLINE_VSYSCALL (gettimeofday, 2, tv, tz);
-}
-
-libc_hidden_def (__gettimeofday)
-weak_alias (__gettimeofday, gettimeofday)
-libc_hidden_weak (gettimeofday)
diff --git a/sysdeps/unix/sysv/linux/tile/sysdep.h b/sysdeps/unix/sysv/linux/tile/sysdep.h
index 019e800..0866fc7 100644
--- a/sysdeps/unix/sysv/linux/tile/sysdep.h
+++ b/sysdeps/unix/sysv/linux/tile/sysdep.h
@@ -212,6 +212,7 @@
/* List of system calls which are supported as vsyscalls. */
#define HAVE_CLOCK_GETTIME_VSYSCALL 1
+#define HAVE_GETTIMEOFDAY_VSYSCALL 1
#endif /* __ASSEMBLER__ */
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=5f5f81e3372b88a295e408b0854352f72847bceb
commit 5f5f81e3372b88a295e408b0854352f72847bceb
Author: Adhemerval Zanella <adhemerval.zanella@linaro.com>
Date: Fri Apr 17 10:58:31 2015 -0300
Consolidate vDSO macros and usage
This patch consolidate the Linux vDSO define and usage across all ports
that uses it. The common vDSO definitions and calling through
{INLINE/INTERNAL}_VSYSCALL macros are moved to a common header
sysdep-vdso.h and vDSO name declaration and prototype is defined
using a common macro.
Also PTR_{MANGLE,DEMANGLE} is added to ports that does not use them
for vDSO calls (aarch64, powerpc, s390, and tile).
diff --git a/ChangeLog b/ChangeLog
index 97fb9fe..1b6ce00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,106 @@
+2015-04-24 Adhemerval Zanella <adhemerval.zanella@linaro.org>
+
+ * sysdeps/unix/sysv/linux/aarch64/gettimeofday.c (HAVE_VSYSCALL):
+ define and include sysdep-vdso.h.
+ * sysdeps/unix/sysv/linux/s390/gettimeofday.c (HAVE_VSYSCALL):
+ Likewise.
+ * sysdeps/unix/sysv/linux/tile/gettimeofday.c (HAVE_VSYSCALL):
+ Likewise.
+ * sysdeps/unix/sysv/linux/aarch64/init-first.c (__vdso_gettimeofday):
+ Use VDSO_SYMBOL macro to define and use PTR_MANGLE.
+ (__vdso_clock_gettime): Likewise.
+ (__vdso_clock_getres): Likewise.
+ (_libc_vdso_platform_setup): Likewise.
+ * sysdeps/unix/sysv/linux/i386/init-first.c (__vdso_clock_gettime):
+ Likewise.
+ (_libc_vdso_platform_setup): Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/init-first.c (__vdso_gettimeofday):
+ Likewise.
+ (__vdso_clock_gettime): Likewise.
+ (__vdso_clock_getres): Likewise.
+ (__vdso_get_tbfreq): Likewise.
+ (__vdso_getcpu): Likewise.
+ (__vdso_time): Likewise.
+ (__vdso_sigtramp_rt64): Likewise.
+ (__vdso_signtramp32): Likewise.
+ (__vdso_sigtramp_rt32): Likewise.
+ (_libc_vdso_platform_setup): Likewise.
+ * sysdeps/unix/sysv/linux/s390/init-first.c (__vdso_gettimeofay):
+ Likewise.
+ (__vdso_clock_gettime): Likewise.
+ (__vdso_clock_getres): Likewise.
+ (_libc_vdso_platform_setup): Likewise.
+ * sysdeps/unix/sysv/linux/tile/init-first.c (__vdso_gettimeofday):
+ Likewise.
+ (__vdso_clock_gettime): Likewise.
+ (_libc_vdso_platform_setup): Likewise.
+ * sysdeps/unix/sysv/linux/x86_64/init-first.c (__vdso_clock_gettime):
+ Likewise.
+ (__vdso_getcpu): Likewise.
+ * sysdeps/unix/sysv/linux/aarch64/libc-vdso.h (__vdso_gettimeoday):
+ Use VDSO_SYMBOL macro to define.
+ (__vdso_clock_gettime): Likewise.
+ (__vdso_clock_getres): Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/libc-vdso.h (__vdso_gettimeofday):
+ Likewise.
+ (__vdso_clock_gettime): Likewise.
+ (__vdso_clock_getres): Likewise.
+ (__vdso_get_tbfreq): Likewise.
+ (__vdso_getcpu): Likewise.
+ (__vdso_time): Likewise.
+ (__vdso_sigtramp_rt64): Likewise.
+ (__vdso_signtramp32): Likewise.
+ (__vdso_sigtramp_rt32): Likewise.
+ * sysdeps/unix/sysv/linux/s390/libc-vdso.h (__vdso_gettimeofday):
+ Likewise.
+ (__vdso_clock_gettime): Likewise.
+ (__vdso_clock_getres): Likewise.
+ * sysdeps/unix/sysv/linux/tile/libc-vdso.h (__vdso_gettimeofday):
+ Likewise.
+ (__vdso_clock_gettime): Likewise.
+ * sysdeps/unix/sysv/linux/x86/libc-vdso.h (__vdso_clock_gettime):
+ Likewise.
+ * sysdeps/unix/sysv/linux/aarch64/sysdep.h (INLINE_VSYSCALL): Remove
+ macro.
+ (INTERNAL_VSYSCALL): Likewise.
+ * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h (INLINE_VSYSCALL):
+ Remove macro.
+ (INTERNAL_VSYSCALL): Likewise.
+ (INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK): Use PTR_DEMANGLE.
+ * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h (INLINE_VSYSCALL):
+ Likewise.
+ (INTERNAL_VSYSCALL): Likewise.
+ (INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK): Use PTR_DEMANGLE.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
+ (INLINE_VSYSCALL): Remove macro.
+ (INTERNAL_VSYSCALL): Remove macro.
+ (INTERNAL_VSYSCALL_NCS): Define using INTERNAL_VSYSCALL_NCS_TYPE.
+ (INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK): Likewise.
+ (INTERNAL_VSYSCALL_NCS_TYPE): New macro.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
+ (INLINE_VSYSCALL): Remove macro.
+ (INTERNAL_VSYSCALL): Remove macro.
+ (INTERNAL_VSYSCALL_NCS): Define using INTERNAL_VSYSCALL_NCS_TYPE.
+ (INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK): Likewise.
+ (INTERNAL_VSYSCALL_NCS_TYPE): New macro.
+ * sysdeps/unix/sysv/linux/tile/sysdep.h (INLINE_VSYSCALL): Remove
+ macro.
+ (INTERNAL_SYSCALL): Likewise.
+ (INTERNAL_VSYSCALL_NCS): New macro.
+ * sysdeps/unix/sysv/linux/x86_64/sysdep.h (INLINE_VSYSCALL):
+ Remove macro.
+ (INTERNAL_VSYSCALL): Likewise.
+ * sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c: Include
+ sysdep-vdso.h instead of libc-vdso.h.
+ * sysdeps/unix/sysv/linux/clock_getres.c (INTERNAL_VSYSCALL): Use
+ default definition from sysdep-vdso.h.
+ (INLINE_VSYSCALL): Likewise.
+ * sysdeps/unix/sysv/linux/clock_gettime.c (INTERNAL_VSYSCALL): Likewise.
+ (INLINE_VSYSCALL): Likewise.
+ * sysdeps/unix/sysv/linux/timespec_get.c (INTERNAL_VSYSCALL): Likewise.
+ * sysdeps/unix/sysv/linux/sysdep-vdso.h: New file: default vDSO macros
+ and definition for Linux.
+
2015-04-24 Stefan Liebler <stli@linux.vnet.ibm.com>
* sysdeps/s390/fpu/libm-test-upls: Regenerate.
diff --git a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c b/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
index 67b7f6d..daa6538 100644
--- a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
+++ b/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c
@@ -21,7 +21,8 @@
#undef __gettimeofday
-#include <libc-vdso.h>
+#define HAVE_VSYSCALL
+#include <sysdep-vdso.h>
/* Get the current time of day and timezone information,
putting it into *tv and *tz. If tz is null, *tz is not filled.
diff --git a/sysdeps/unix/sysv/linux/aarch64/init-first.c b/sysdeps/unix/sysv/linux/aarch64/init-first.c
index d99c821..854189a 100644
--- a/sysdeps/unix/sysv/linux/aarch64/init-first.c
+++ b/sysdeps/unix/sysv/linux/aarch64/init-first.c
@@ -23,18 +23,26 @@
# undef __clock_getres
# include <libc-vdso.h>
-void (*__vdso_gettimeofday) (struct timeval *, void *) attribute_hidden;
-void (*__vdso_clock_gettime) (clockid_t, struct timespec *);
-void (*__vdso_clock_getres) (clockid_t, struct timespec *);
+int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *) attribute_hidden;
+int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *);
+int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *);
static inline void
_libc_vdso_platform_setup (void)
{
PREPARE_VERSION (linux2639, "LINUX_2.6.39", 123718537);
- __vdso_gettimeofday = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2639);
- __vdso_clock_gettime = _dl_vdso_vsym ("__kernel_clock_gettime", &linux2639);
- __vdso_clock_getres = _dl_vdso_vsym ("__kernel_clock_getres", &linux2639);
+ void *p = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2639);
+ PTR_MANGLE (p);
+ VDSO_SYMBOL(gettimeofday) = p;
+
+ p = _dl_vdso_vsym ("__kernel_clock_gettime", &linux2639);
+ PTR_MANGLE (p);
+ VDSO_SYMBOL(clock_gettime) = p;
+
+ p = _dl_vdso_vsym ("__kernel_clock_getres", &linux2639);
+ PTR_MANGLE (p);
+ VDSO_SYMBOL(clock_getres) = p;
}
# define VDSO_SETUP _libc_vdso_platform_setup
diff --git a/sysdeps/unix/sysv/linux/aarch64/libc-vdso.h b/sysdeps/unix/sysv/linux/aarch64/libc-vdso.h
index 1f6bb36..c5678a0 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libc-vdso.h
+++ b/sysdeps/unix/sysv/linux/aarch64/libc-vdso.h
@@ -21,10 +21,12 @@
#ifdef SHARED
-extern void (*__vdso_gettimeofday) (struct timeval *, void *)
+# include <sysdep-vdso.h>
+
+extern int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *)
attribute_hidden;
-extern void (*__vdso_clock_gettime) (clockid_t, struct timespec *);
-extern void (*__vdso_clock_getres) (clockid_t, struct timespec *);
+extern int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *);
+extern int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *);
#endif
diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
index 91e03fc..80716c7 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
@@ -151,59 +151,6 @@
#else /* not __ASSEMBLER__ */
-# ifdef SHARED
-# define INLINE_VSYSCALL(name, nr, args...) \
- ({ \
- __label__ out; \
- __label__ iserr; \
- long sc_ret; \
- INTERNAL_SYSCALL_DECL (sc_err); \
- \
- if (__vdso_##name != NULL) \
- { \
- sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, nr, ##args); \
- if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
- goto out; \
- if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \
- goto iserr; \
- } \
- \
- sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args); \
- if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
- { \
- iserr: \
- __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \
- sc_ret = -1L; \
- } \
- out: \
- sc_ret; \
- })
-# else
-# define INLINE_VSYSCALL(name, nr, args...) \
- INLINE_SYSCALL (name, nr, ##args)
-# endif
-
-# ifdef SHARED
-# define INTERNAL_VSYSCALL(name, err, nr, args...) \
- ({ \
- __label__ out; \
- long v_ret; \
- \
- if (__vdso_##name != NULL) \
- { \
- v_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \
- if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \
- || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \
- goto out; \
- } \
- v_ret = INTERNAL_SYSCALL (name, err, nr, ##args); \
- out: \
- v_ret; \
- })
-# else
-# define INTERNAL_VSYSCALL(name, err, nr, args...) \
- INTERNAL_SYSCALL (name, err, nr, ##args)
-# endif
/* List of system calls which are supported as vsyscalls. */
# define HAVE_CLOCK_GETRES_VSYSCALL 1
diff --git a/sysdeps/unix/sysv/linux/clock_getres.c b/sysdeps/unix/sysv/linux/clock_getres.c
index 9b31d8c..5641967 100644
--- a/sysdeps/unix/sysv/linux/clock_getres.c
+++ b/sysdeps/unix/sysv/linux/clock_getres.c
@@ -21,14 +21,10 @@
#include <time.h>
#include "kernel-posix-cpu-timers.h"
-#ifndef HAVE_CLOCK_GETRES_VSYSCALL
-# undef INTERNAL_VSYSCALL
-# define INTERNAL_VSYSCALL INTERNAL_SYSCALL
-# undef INLINE_VSYSCALL
-# define INLINE_VSYSCALL INLINE_SYSCALL
-#else
-# include <libc-vdso.h>
+#ifdef HAVE_CLOCK_GETRES_VSYSCALL
+# define HAVE_VSYSCALL
#endif
+#include <sysdep-vdso.h>
#define SYSCALL_GETRES \
retval = INLINE_VSYSCALL (clock_getres, 2, clock_id, res); \
diff --git a/sysdeps/unix/sysv/linux/clock_gettime.c b/sysdeps/unix/sysv/linux/clock_gettime.c
index 93aa095..457114f 100644
--- a/sysdeps/unix/sysv/linux/clock_gettime.c
+++ b/sysdeps/unix/sysv/linux/clock_gettime.c
@@ -21,23 +21,10 @@
#include <time.h>
#include "kernel-posix-cpu-timers.h"
-#ifndef HAVE_CLOCK_GETTIME_VSYSCALL
-# undef INTERNAL_VSYSCALL
-# define INTERNAL_VSYSCALL INTERNAL_SYSCALL
-# undef INLINE_VSYSCALL
-# define INLINE_VSYSCALL INLINE_SYSCALL
-#else
-# include <libc-vdso.h>
-#endif
-
-#ifndef SYSCALL_GETTIME
-# define SYSCALL_GETTIME(id, tp) \
- INLINE_VSYSCALL (clock_gettime, 2, id, tp)
-#endif
-#ifndef INTERNAL_GETTIME
-# define INTERNAL_GETTIME(id, tp) \
- INTERNAL_VSYSCALL (clock_gettime, err, 2, id, tp)
+#ifdef HAVE_CLOCK_GETTIME_VSYSCALL
+# define HAVE_VSYSCALL
#endif
+#include <sysdep-vdso.h>
/* The REALTIME and MONOTONIC clock are definitely supported in the
kernel. */
@@ -45,7 +32,7 @@
SYSDEP_GETTIME_CPUTIME; \
case CLOCK_REALTIME: \
case CLOCK_MONOTONIC: \
- retval = SYSCALL_GETTIME (clock_id, tp); \
+ retval = INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp); \
break
/* We handled the REALTIME clock here. */
@@ -53,7 +40,7 @@
#define HANDLED_CPUTIME 1
#define SYSDEP_GETTIME_CPU(clock_id, tp) \
- retval = SYSCALL_GETTIME (clock_id, tp); \
+ retval = INLINE_VSYSCALL (clock_gettime, 2, clock_id, tp); \
break
#define SYSDEP_GETTIME_CPUTIME /* Default catches them too. */
diff --git a/sysdeps/unix/sysv/linux/i386/init-first.c b/sysdeps/unix/sysv/linux/i386/init-first.c
index 5d09bec..98d1827 100644
--- a/sysdeps/unix/sysv/linux/i386/init-first.c
+++ b/sysdeps/unix/sysv/linux/i386/init-first.c
@@ -20,9 +20,9 @@
# include <time.h>
# include <sysdep.h>
# include <dl-vdso.h>
-# include <libc-vdso.h>
+# include <sysdep-vdso.h>
-long int (*__vdso_clock_gettime) (clockid_t, struct timespec *)
+long int (*VDSO_SYMBOL (clock_gettime)) (clockid_t, struct timespec *)
attribute_hidden;
static long int
@@ -41,7 +41,7 @@ __vdso_platform_setup (void)
if (p == NULL)
p = clock_gettime_syscall;
PTR_MANGLE (p);
- __vdso_clock_gettime = p;
+ VDSO_SYMBOL (clock_gettime) = p;
}
# define VDSO_SETUP __vdso_platform_setup
diff --git a/sysdeps/unix/sysv/linux/powerpc/init-first.c b/sysdeps/unix/sysv/linux/powerpc/init-first.c
index b4917d1..ee91c0b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/init-first.c
+++ b/sysdeps/unix/sysv/linux/powerpc/init-first.c
@@ -23,17 +23,19 @@
# undef __clock_getres
# include <libc-vdso.h>
-void *__vdso_gettimeofday attribute_hidden;
-void *__vdso_clock_gettime;
-void *__vdso_clock_getres;
-void *__vdso_get_tbfreq;
-void *__vdso_getcpu;
-void *__vdso_time;
+int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *)
+ attribute_hidden;
+int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *);
+int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *);
+unsigned long long (*VDSO_SYMBOL(get_tbfreq)) (void);
+int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *);
+time_t (*VDSO_SYMBOL(time)) (time_t *);
+
#if defined(__PPC64__) || defined(__powerpc64__)
-void *__vdso_sigtramp_rt64;
+void *VDSO_SYMBOL(sigtramp_rt64);
#else
-void *__vdso_sigtramp32;
-void *__vdso_sigtramp_rt32;
+void *VDSO_SYMBOL(sigtramp32);
+void *VDSO_SYMBOL(sigtramp_rt32);
#endif
static inline void
@@ -41,26 +43,42 @@ _libc_vdso_platform_setup (void)
{
PREPARE_VERSION (linux2615, "LINUX_2.6.15", 123718565);
- __vdso_gettimeofday = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2615);
+ void *p = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2615);
+ PTR_MANGLE (p);
+ VDSO_SYMBOL (gettimeofday) = p;
- __vdso_clock_gettime = _dl_vdso_vsym ("__kernel_clock_gettime", &linux2615);
+ p = _dl_vdso_vsym ("__kernel_clock_gettime", &linux2615);
+ PTR_MANGLE (p);
+ VDSO_SYMBOL (clock_gettime) = p;
- __vdso_clock_getres = _dl_vdso_vsym ("__kernel_clock_getres", &linux2615);
+ p = _dl_vdso_vsym ("__kernel_clock_getres", &linux2615);
+ PTR_MANGLE (p);
+ VDSO_SYMBOL (clock_getres) = p;
- __vdso_get_tbfreq = _dl_vdso_vsym ("__kernel_get_tbfreq", &linux2615);
+ p = _dl_vdso_vsym ("__kernel_get_tbfreq", &linux2615);
+ PTR_MANGLE (p);
+ VDSO_SYMBOL (get_tbfreq) = p;
- __vdso_getcpu = _dl_vdso_vsym ("__kernel_getcpu", &linux2615);
+ p = _dl_vdso_vsym ("__kernel_getcpu", &linux2615);
+ PTR_MANGLE (p);
+ VDSO_SYMBOL (getcpu) = p;
- __vdso_time = _dl_vdso_vsym ("__kernel_time", &linux2615);
+ p = _dl_vdso_vsym ("__kernel_time", &linux2615);
+ PTR_MANGLE (p);
+ VDSO_SYMBOL (time) = p;
/* PPC64 uses only one signal trampoline symbol, while PPC32 will use
two depending if SA_SIGINFO is used (__kernel_sigtramp_rt32) or not
- (__kernel_sigtramp32). */
+ (__kernel_sigtramp32).
+ There is no need to pointer mangle these symbol because they will
+ used only for pointer comparison. */
#if defined(__PPC64__) || defined(__powerpc64__)
- __vdso_sigtramp_rt64 = _dl_vdso_vsym ("__kernel_sigtramp_rt64", &linux2615);
+ VDSO_SYMBOL(sigtramp_rt64) = _dl_vdso_vsym ("__kernel_sigtramp_rt64",
+ &linux2615);
#else
- __vdso_sigtramp32 = _dl_vdso_vsym ("__kernel_sigtramp32", &linux2615);
- __vdso_sigtramp_rt32 = _dl_vdso_vsym ("__kernel_sigtramp_rt32", &linux2615);
+ VDSO_SYMBOL(sigtramp32) = _dl_vdso_vsym ("__kernel_sigtramp32", &linux2615);
+ VDSO_SYMBOL(sigtramp_rt32) = _dl_vdso_vsym ("__kernel_sigtramp_rt32",
+ &linux2615);
#endif
}
diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h b/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h
index 63a7a9b..5868d24 100644
--- a/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h
+++ b/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h
@@ -22,23 +22,21 @@
#ifdef SHARED
-extern void *__vdso_gettimeofday attribute_hidden;
+#include <sysdep-vdso.h>
-extern void *__vdso_clock_gettime;
-
-extern void *__vdso_clock_getres;
-
-extern void *__vdso_get_tbfreq;
-
-extern void *__vdso_getcpu;
-
-extern void *__vdso_time;
+extern int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *)
+ attribute_hidden;
+extern int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *);
+extern int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *);
+extern unsigned long long (*VDSO_SYMBOL(get_tbfreq)) (void);
+extern int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *);
+extern time_t (*VDSO_SYMBOL(time)) (time_t *);
#if defined(__PPC64__) || defined(__powerpc64__)
-extern void *__vdso_sigtramp_rt64;
+extern void *VDSO_SYMBOL(sigtramp_rt64);
#else
-extern void *__vdso_sigtramp32;
-extern void *__vdso_sigtramp_rt32;
+extern void *VDSO_SYMBOL(sigtramp32);
+extern void *VDSO_SYMBOL(sigtramp_rt32);
#endif
#if (defined(__PPC64__) || defined(__powerpc64__)) && _CALL_ELF != 2
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
index 0b41e8c..8bd42ec 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
@@ -50,77 +50,6 @@
# include <errno.h>
-# ifdef SHARED
-# define INLINE_VSYSCALL(name, nr, args...) \
- ({ \
- __label__ out; \
- __label__ iserr; \
- INTERNAL_SYSCALL_DECL (sc_err); \
- long int sc_ret; \
- \
- if (__vdso_##name != NULL) \
- { \
- sc_ret = \
- INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, long int, nr, ##args);\
- if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
- goto out; \
- if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \
- goto iserr; \
- } \
- \
- sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args); \
- if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
- { \
- iserr: \
- __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \
- sc_ret = -1L; \
- } \
- out: \
- sc_ret; \
- })
-# else
-# define INLINE_VSYSCALL(name, nr, args...) \
- INLINE_SYSCALL (name, nr, ##args)
-# endif
-
-# ifdef SHARED
-# define INTERNAL_VSYSCALL(name, err, nr, args...) \
- ({ \
- __label__ out; \
- long int v_ret; \
- \
- if (__vdso_##name != NULL) \
- { \
- v_ret = \
- INTERNAL_VSYSCALL_NCS (__vdso_##name, err, long int, nr, ##args); \
- if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \
- || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \
- goto out; \
- } \
- v_ret = INTERNAL_SYSCALL (name, err, nr, ##args); \
- out: \
- v_ret; \
- })
-# else
-# define INTERNAL_VSYSCALL(name, err, nr, args...) \
- INTERNAL_SYSCALL (name, err, nr, ##args)
-# endif
-
-# define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, type, nr, args...) \
- ({ \
- type sc_ret = ENOSYS; \
- \
- if (__vdso_##name != NULL) \
- sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, type, nr, ##args); \
- else \
- err = 1 << 28; \
- sc_ret; \
- })
-
-/* List of system calls which are supported as vsyscalls. */
-# define HAVE_CLOCK_GETRES_VSYSCALL 1
-# define HAVE_CLOCK_GETTIME_VSYSCALL 1
-
/* Define a macro which expands inline into the wrapper code for a VDSO
call. This use is for internal calls that do not need to handle errors
normally. It will never touch errno.
@@ -128,7 +57,7 @@
function call, with the exception of LR (which is needed for the
"sc; bnslr+" sequence) and CR (where only CR0.SO is clobbered to signal
an error return status). */
-# define INTERNAL_VSYSCALL_NCS(funcptr, err, type, nr, args...) \
+# define INTERNAL_VSYSCALL_NCS_TYPE(funcptr, err, nr, type, args...) \
({ \
register void *r0 __asm__ ("r0"); \
register long int r3 __asm__ ("r3"); \
@@ -155,6 +84,9 @@
rval; \
})
+#define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \
+ INTERNAL_VSYSCALL_NCS_TYPE(funcptr, err, nr, long int, args)
+
# undef INLINE_SYSCALL
# define INLINE_SYSCALL(name, nr, args...) \
({ \
@@ -216,6 +148,25 @@
# undef INTERNAL_SYSCALL_ERRNO
# define INTERNAL_SYSCALL_ERRNO(val, err) (val)
+# define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, type, nr, args...) \
+ ({ \
+ type sc_ret = ENOSYS; \
+ \
+ __typeof (__vdso_##name) vdsop = __vdso_##name; \
+ PTR_DEMANGLE (vdsop); \
+ if (vdsop != NULL) \
+ sc_ret = \
+ INTERNAL_VSYSCALL_NCS_TYPE (vdsop, err, nr, type, ##args); \
+ else \
+ err = 1 << 28; \
+ sc_ret; \
+ })
+
+/* List of system calls which are supported as vsyscalls. */
+# define HAVE_CLOCK_GETRES_VSYSCALL 1
+# define HAVE_CLOCK_GETTIME_VSYSCALL 1
+
+
# define LOADARGS_0(name, dummy) \
r0 = name
# define LOADARGS_1(name, __arg1) \
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
index 324e19b..1bad856 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h
@@ -61,74 +61,17 @@
#endif /* __ASSEMBLER__ */
-/* This version is for kernels that implement system calls that
- behave like function calls as far as register saving.
- It falls back to the syscall in the case that the vDSO doesn't
- exist or fails for ENOSYS */
-#ifdef SHARED
-# define INLINE_VSYSCALL(name, nr, args...) \
- ({ \
- __label__ out; \
- __label__ iserr; \
- INTERNAL_SYSCALL_DECL (sc_err); \
- long int sc_ret; \
- \
- if (__vdso_##name != NULL) \
- { \
- sc_ret = \
- INTERNAL_VSYSCALL_NCS (__vdso_##name, sc_err, long int, nr, ##args);\
- if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
- goto out; \
- if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \
- goto iserr; \
- } \
- \
- sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args); \
- if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
- { \
- iserr: \
- __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \
- sc_ret = -1L; \
- } \
- out: \
- sc_ret; \
- })
-#else
-# define INLINE_VSYSCALL(name, nr, args...) \
- INLINE_SYSCALL (name, nr, ##args)
-#endif
-
-#ifdef SHARED
-# define INTERNAL_VSYSCALL(name, err, nr, args...) \
- ({ \
- __label__ out; \
- long int v_ret; \
- \
- if (__vdso_##name != NULL) \
- { \
- v_ret = \
- INTERNAL_VSYSCALL_NCS (__vdso_##name, err, long int, nr, ##args); \
- if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \
- || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \
- goto out; \
- } \
- v_ret = INTERNAL_SYSCALL (name, err, nr, ##args); \
- out: \
- v_ret; \
- })
-#else
-# define INTERNAL_VSYSCALL(name, err, nr, args...) \
- INTERNAL_SYSCALL (name, err, nr, ##args)
-#endif
-
/* This version is for internal uses when there is no desire
to set errno */
#define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, type, nr, args...) \
({ \
type sc_ret = ENOSYS; \
\
- if (__vdso_##name != NULL) \
- sc_ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, type, nr, ##args); \
+ __typeof (__vdso_##name) vdsop = __vdso_##name; \
+ PTR_DEMANGLE (vdsop); \
+ if (vdsop != NULL) \
+ sc_ret = \
+ INTERNAL_VSYSCALL_NCS_TYPE (vdsop, err, type, nr, ##args); \
else \
err = 1 << 28; \
sc_ret; \
@@ -144,7 +87,7 @@
gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set)
the negation of the return value in the kernel gets reverted. */
-#define INTERNAL_VSYSCALL_NCS(funcptr, err, type, nr, args...) \
+#define INTERNAL_VSYSCALL_NCS_TYPE(funcptr, err, type, nr, args...) \
({ \
register void *r0 __asm__ ("r0"); \
register long int r3 __asm__ ("r3"); \
@@ -168,6 +111,9 @@
rval; \
})
+#define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \
+ INTERNAL_VSYSCALL_NCS_TYPE(funcptr, err, long int, nr, args)
+
#undef INLINE_SYSCALL
/* This version is for kernels that implement system calls that
diff --git a/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c b/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c
index 5bf540c..f93be01 100644
--- a/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c
+++ b/sysdeps/unix/sysv/linux/powerpc/sched_getcpu.c
@@ -17,8 +17,7 @@
#include <sched.h>
#include <sysdep.h>
-#include <libc-vdso.h>
-
+#include <sysdep-vdso.h>
int
sched_getcpu (void)
diff --git a/sysdeps/unix/sysv/linux/s390/gettimeofday.c b/sysdeps/unix/sysv/linux/s390/gettimeofday.c
index e8dee26..9f98f29 100644
--- a/sysdeps/unix/sysv/linux/s390/gettimeofday.c
+++ b/sysdeps/unix/sysv/linux/s390/gettimeofday.c
@@ -21,7 +21,8 @@
#include <time.h>
#include <hp-timing.h>
-#include <libc-vdso.h>
+#define HAVE_VSYSCALL
+#include <sysdep-vdso.h>
/* Get the current time of day and timezone information,
putting it into *TV and *TZ. If TZ is NULL, *TZ is not filled.
diff --git a/sysdeps/unix/sysv/linux/s390/init-first.c b/sysdeps/unix/sysv/linux/s390/init-first.c
index 2e00a99..8129967 100644
--- a/sysdeps/unix/sysv/linux/s390/init-first.c
+++ b/sysdeps/unix/sysv/linux/s390/init-first.c
@@ -23,15 +23,14 @@
# undef __clock_getres
# include <libc-vdso.h>
-long int (*__vdso_gettimeofday) (struct timeval *, void *) attribute_hidden;
+long int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *)
+ attribute_hidden;
-long int (*__vdso_clock_gettime) (clockid_t, struct timespec *)
+long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
__attribute__ ((nocommon));
-strong_alias (__vdso_clock_gettime, __GI___vdso_clock_gettime attribute_hidden)
-long int (*__vdso_clock_getres) (clockid_t, struct timespec *)
+long int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *)
__attribute__ ((nocommon));
-strong_alias (__vdso_clock_getres, __GI___vdso_clock_getres attribute_hidden)
static inline void
@@ -39,9 +38,17 @@ _libc_vdso_platform_setup (void)
{
PREPARE_VERSION (linux2629, "LINUX_2.6.29", 123718585);
- __vdso_gettimeofday = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2629);
- __vdso_clock_gettime = _dl_vdso_vsym ("__kernel_clock_gettime", &linux2629);
- __vdso_clock_getres = _dl_vdso_vsym ("__kernel_clock_getres", &linux2629);
+ void *p = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2629);
+ PTR_MANGLE (p);
+ VDSO_SYMBOL (gettimeofday) = p;
+
+ p = _dl_vdso_vsym ("__kernel_clock_gettime", &linux2629);
+ PTR_MANGLE (p);
+ VDSO_SYMBOL (clock_gettime) = p;
+
+ p = _dl_vdso_vsym ("__kernel_clock_getres", &linux2629);
+ PTR_MANGLE (p);
+ VDSO_SYMBOL (clock_getres) = p;
}
# define VDSO_SETUP _libc_vdso_platform_setup
diff --git a/sysdeps/unix/sysv/linux/s390/libc-vdso.h b/sysdeps/unix/sysv/linux/s390/libc-vdso.h
index 3fd3d06..9bb562e 100644
--- a/sysdeps/unix/sysv/linux/s390/libc-vdso.h
+++ b/sysdeps/unix/sysv/linux/s390/libc-vdso.h
@@ -22,12 +22,14 @@
#ifdef SHARED
-extern long int (*__vdso_gettimeofday) (struct timeval *, void *)
- attribute_hidden;
-
-extern long int (*__vdso_clock_gettime) (clockid_t, struct timespec *);
-
-extern long int (*__vdso_clock_getres) (clockid_t, struct timespec *);
+#include <sysdep-vdso.h>
+
+extern long int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *)
+ attribute_hidden;
+
+extern long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *);
+
+extern long int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *);
#endif
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
index 9c194b8..6808651 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
@@ -282,71 +282,16 @@
#define HAVE_CLOCK_GETRES_VSYSCALL 1
#define HAVE_CLOCK_GETTIME_VSYSCALL 1
-/* This version is for kernels that implement system calls that
- behave like function calls as far as register saving.
- It falls back to the syscall in the case that the vDSO doesn't
- exist or fails for ENOSYS */
-#ifdef SHARED
-# define INLINE_VSYSCALL(name, nr, args...) \
- ({ \
- __label__ out; \
- __label__ iserr; \
- long int _ret; \
- \
- if (__vdso_##name != NULL) \
- { \
- _ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, , nr, ##args); \
- if (!INTERNAL_SYSCALL_ERROR_P (_ret, )) \
- goto out; \
- if (INTERNAL_SYSCALL_ERRNO (_ret, ) != ENOSYS) \
- goto iserr; \
- } \
- \
- _ret = INTERNAL_SYSCALL (name, , nr, ##args); \
- if (INTERNAL_SYSCALL_ERROR_P (_ret, )) \
- { \
- iserr: \
- __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, )); \
- _ret = -1L; \
- } \
- out: \
- (int) _ret; \
- })
-#else
-# define INLINE_VSYSCALL(name, nr, args...) \
- INLINE_SYSCALL (name, nr, ##args)
-#endif
-
-#ifdef SHARED
-# define INTERNAL_VSYSCALL(name, err, nr, args...) \
- ({ \
- __label__ out; \
- long int _ret; \
- \
- if (__vdso_##name != NULL) \
- { \
- _ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \
- if (!INTERNAL_SYSCALL_ERROR_P (_ret, err) \
- || INTERNAL_SYSCALL_ERRNO (_ret, err) != ENOSYS) \
- goto out; \
- } \
- _ret = INTERNAL_SYSCALL (name, err, nr, ##args); \
- out: \
- _ret; \
- })
-#else
-# define INTERNAL_VSYSCALL(name, err, nr, args...) \
- INTERNAL_SYSCALL (name, err, nr, ##args)
-#endif
-
/* This version is for internal uses when there is no desire
to set errno */
#define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...) \
({ \
long int _ret = ENOSYS; \
\
- if (__vdso_##name != NULL) \
- _ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \
+ __typeof (__vdso_##name) vdsop = __vdso_##name; \
+ PTR_DEMANGLE (vdsop); \
+ if (vdsop != NULL) \
+ _ret = INTERNAL_VSYSCALL_NCS (vdsop, err, nr, ##args); \
else \
err = 1 << 28; \
_ret; \
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
index 4631cb1..be76452 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
@@ -288,71 +288,16 @@
#define HAVE_CLOCK_GETRES_VSYSCALL 1
#define HAVE_CLOCK_GETTIME_VSYSCALL 1
-/* This version is for kernels that implement system calls that
- behave like function calls as far as register saving.
- It falls back to the syscall in the case that the vDSO doesn't
- exist or fails for ENOSYS */
-#ifdef SHARED
-# define INLINE_VSYSCALL(name, nr, args...) \
- ({ \
- __label__ out; \
- __label__ iserr; \
- long int _ret; \
- \
- if (__vdso_##name != NULL) \
- { \
- _ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, , nr, ##args); \
- if (!INTERNAL_SYSCALL_ERROR_P (_ret, )) \
- goto out; \
- if (INTERNAL_SYSCALL_ERRNO (_ret, ) != ENOSYS) \
- goto iserr; \
- } \
- \
- _ret = INTERNAL_SYSCALL (name, , nr, ##args); \
- if (INTERNAL_SYSCALL_ERROR_P (_ret, )) \
- { \
- iserr: \
- __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, )); \
- _ret = -1L; \
- } \
- out: \
- (int) _ret; \
- })
-#else
-# define INLINE_VSYSCALL(name, nr, args...) \
- INLINE_SYSCALL (name, nr, ##args)
-#endif
-
-#ifdef SHARED
-# define INTERNAL_VSYSCALL(name, err, nr, args...) \
- ({ \
- __label__ out; \
- long int _ret; \
- \
- if (__vdso_##name != NULL) \
- { \
- _ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \
- if (!INTERNAL_SYSCALL_ERROR_P (_ret, err) \
- || INTERNAL_SYSCALL_ERRNO (_ret, err) != ENOSYS) \
- goto out; \
- } \
- _ret = INTERNAL_SYSCALL (name, err, nr, ##args); \
- out: \
- _ret; \
- })
-#else
-# define INTERNAL_VSYSCALL(name, err, nr, args...) \
- INTERNAL_SYSCALL (name, err, nr, ##args)
-#endif
-
/* This version is for internal uses when there is no desire
to set errno */
#define INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK(name, err, nr, args...) \
({ \
long int _ret = ENOSYS; \
\
- if (__vdso_##name != NULL) \
- _ret = INTERNAL_VSYSCALL_NCS (__vdso_##name, err, nr, ##args); \
+ __typeof (__vdso_##name) vdsop = __vdso_##name; \
+ PTR_DEMANGLE (vdsop); \
+ if (vdsop != NULL) \
+ _ret = INTERNAL_VSYSCALL_NCS (vdsop, err, nr, ##args); \
else \
err = 1 << 28; \
_ret; \
diff --git a/sysdeps/unix/sysv/linux/sysdep-vdso.h b/sysdeps/unix/sysv/linux/sysdep-vdso.h
new file mode 100644
index 0000000..6938575
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sysdep-vdso.h
@@ -0,0 +1,98 @@
+/* vDSO common definition for Linux.
+ Copyright (C) 2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef SYSDEP_VDSO_LINUX_H
+# define SYSDEP_VDSO_LINUX_H
+
+#define VDSO_SYMBOL(__name) __vdso_##__name
+
+#ifndef INTERNAL_VSYSCALL_NCS
+# define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \
+ funcptr (args)
+#endif
+
+#ifdef SHARED
+
+# ifdef HAVE_VSYSCALL
+
+#include <libc-vdso.h>
+
+# define INLINE_VSYSCALL(name, nr, args...) \
+ ({ \
+ __label__ out; \
+ __label__ iserr; \
+ INTERNAL_SYSCALL_DECL (sc_err); \
+ long int sc_ret; \
+ \
+ __typeof (__vdso_##name) vdsop = __vdso_##name; \
+ PTR_DEMANGLE (vdsop); \
+ if (vdsop != NULL) \
+ { \
+ sc_ret = INTERNAL_VSYSCALL_NCS (vdsop, sc_err, nr, ##args); \
+ if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
+ goto out; \
+ if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \
+ goto iserr; \
+ } \
+ \
+ sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args); \
+ if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
+ { \
+ iserr: \
+ __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \
+ sc_ret = -1L; \
+ } \
+ out: \
+ sc_ret; \
+ })
+
+# define INTERNAL_VSYSCALL(name, err, nr, args...) \
+ ({ \
+ __label__ out; \
+ long v_ret; \
+ \
+ __typeof (__vdso_##name) vdsop = __vdso_##name; \
+ PTR_DEMANGLE (vdsop); \
+ if (vdsop != NULL) \
+ { \
+ v_ret = INTERNAL_VSYSCALL_NCS (vdsop, err, nr, ##args); \
+ if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \
+ || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \
+ goto out; \
+ } \
+ v_ret = INTERNAL_SYSCALL (name, err, nr, ##args); \
+ out: \
+ v_ret; \
+ })
+# else
+# define INLINE_VSYSCALL(name, nr, args...) \
+ INLINE_SYSCALL (name, nr, ##args)
+# define INTERNAL_VSYSCALL(name, err, nr, args...) \
+ INTERNAL_SYSCALL (name, err, nr, ##args)
+# endif /* HAVE_VSYSCALL */
+
+# else
+
+# define INLINE_VSYSCALL(name, nr, args...) \
+ INLINE_SYSCALL (name, nr, ##args)
+# define INTERNAL_VSYSCALL(name, err, nr, args...) \
+ INTERNAL_SYSCALL (name, err, nr, ##args)
+
+#endif /* SHARED */
+
+#endif /* SYSDEP_VDSO_LINUX_H */
diff --git a/sysdeps/unix/sysv/linux/tile/gettimeofday.c b/sysdeps/unix/sysv/linux/tile/gettimeofday.c
index 8d34b40..13382ab 100644
--- a/sysdeps/unix/sysv/linux/tile/gettimeofday.c
+++ b/sysdeps/unix/sysv/linux/tile/gettimeofday.c
@@ -19,7 +19,9 @@
#include <stddef.h>
#include <sys/time.h>
#include <time.h>
-#include <libc-vdso.h>
+
+#define HAVE_VSYSCALL
+#include <sysdep-vdso.h>
int
__gettimeofday (struct timeval *tv, struct timezone *tz)
diff --git a/sysdeps/unix/sysv/linux/tile/init-first.c b/sysdeps/unix/sysv/linux/tile/init-first.c
index 6b0e26a..29356c2 100644
--- a/sysdeps/unix/sysv/linux/tile/init-first.c
+++ b/sysdeps/unix/sysv/linux/tile/init-first.c
@@ -19,21 +19,27 @@
#include <dl-vdso.h>
#include <libc-vdso.h>
-struct syscall_return_value (*__vdso_gettimeofday) (struct timeval *, void *)
+struct syscall_return_value (*VDSO_SYMBOL(gettimeofday)) (struct timeval *,
+ void *)
attribute_hidden;
-struct syscall_return_value (*__vdso_clock_gettime) (clockid_t,
- struct timespec *)
+struct syscall_return_value (*VDSO_SYMBOL(clock_gettime)) (clockid_t,
+ struct timespec *)
__attribute__ ((nocommon));
-strong_alias (__vdso_clock_gettime, __GI___vdso_clock_gettime attribute_hidden)
static inline void
_libc_vdso_platform_setup (void)
{
PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
- __vdso_gettimeofday = _dl_vdso_vsym ("__vdso_gettimeofday", &linux26);
- __vdso_clock_gettime = _dl_vdso_vsym ("__vdso_clock_gettime", &linux26);
+
+ void *p = _dl_vdso_vsym ("__vdso_gettimeofday", &linux26);
+ PTR_MANGLE (p);
+ VDSO_SYMBOL (gettimeofday) = p;
+
+ p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux26);
+ PTR_MANGLE (p);
+ VDSO_SYMBOL (clock_gettime) = p;
}
#define VDSO_SETUP _libc_vdso_platform_setup
diff --git a/sysdeps/unix/sysv/linux/tile/libc-vdso.h b/sysdeps/unix/sysv/linux/tile/libc-vdso.h
index 44f8286..2f5b23d 100644
--- a/sysdeps/unix/sysv/linux/tile/libc-vdso.h
+++ b/sysdeps/unix/sysv/linux/tile/libc-vdso.h
@@ -22,19 +22,21 @@
#ifdef SHARED
+#include <sysdep-vdso.h>
+
struct syscall_return_value
{
long int value;
long int error;
};
-extern struct syscall_return_value (*__vdso_gettimeofday) (struct timeval *,
- void *)
+extern struct syscall_return_value (*VDSO_SYMBOL (gettimeofday)) (struct
+ timeval *,
+ void *)
attribute_hidden;
-extern struct syscall_return_value (*__vdso_clock_gettime) (clockid_t,
- struct timespec *);
-
+extern struct syscall_return_value (*VDSO_SYMBOL (clock_gettime)) (clockid_t,
+ struct
+ timespec *);
#endif
-
#endif /* _LIBC_VDSO_H */
diff --git a/sysdeps/unix/sysv/linux/tile/sysdep.h b/sysdeps/unix/sysv/linux/tile/sysdep.h
index 64c8920..019e800 100644
--- a/sysdeps/unix/sysv/linux/tile/sysdep.h
+++ b/sysdeps/unix/sysv/linux/tile/sysdep.h
@@ -202,71 +202,19 @@
"=R02" (_clobber_r2), "=R03" (_clobber_r3), "=R04" (_clobber_r4), \
"=R05" (_clobber_r5), "=R10" (_clobber_r10)
-/* This version is for kernels that implement system calls that
- behave like function calls as far as register saving.
- It falls back to the syscall in the case that the vDSO doesn't
- exist or fails for ENOSYS */
-# ifdef SHARED
-# define INLINE_VSYSCALL(name, nr, args...) \
- ({ \
- __label__ out; \
- __label__ iserr; \
- INTERNAL_SYSCALL_DECL (sc_err); \
- long int sc_ret; \
- \
- __typeof (__vdso_##name) vdsop = __vdso_##name; \
- if (vdsop != NULL) \
- { \
- struct syscall_return_value rv = vdsop (args); \
- sc_ret = rv.value; \
- sc_err = rv.error; \
- if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
- goto out; \
- if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \
- goto iserr; \
- } \
- \
- sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args); \
- if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
- { \
- iserr: \
- __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \
- sc_ret = -1L; \
- } \
- out: \
- sc_ret; \
- })
-# define INTERNAL_VSYSCALL(name, err, nr, args...) \
- ({ \
- __label__ out; \
- long int v_ret; \
- \
- __typeof (__vdso_##name) vdsop = __vdso_##name; \
- if (vdsop != NULL) \
- { \
- struct syscall_return_value rv = vdsop (args); \
- v_ret = rv.value; \
- err = rv.error; \
- if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \
- || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \
- goto out; \
- } \
- v_ret = INTERNAL_SYSCALL (name, err, nr, ##args); \
- out: \
- v_ret; \
- })
-# else
-# define INLINE_VSYSCALL(name, nr, args...) \
- INLINE_SYSCALL (name, nr, ##args)
-# define INTERNAL_VSYSCALL(name, err, nr, args...) \
- INTERNAL_SYSCALL (name, err, nr, ##args)
-# endif
-#endif /* not __ASSEMBLER__ */
+#define INTERNAL_VSYSCALL_NCS(funcptr, err, nr, args...) \
+ ({ \
+ struct syscall_return_value rv = funcptr (args); \
+ err = rv.error; \
+ rv.value; \
+ })
/* List of system calls which are supported as vsyscalls. */
#define HAVE_CLOCK_GETTIME_VSYSCALL 1
+#endif /* __ASSEMBLER__ */
+
/* Pointer mangling support. */
#if IS_IN (rtld)
/* We cannot use the thread descriptor because in ld.so we use setjmp
diff --git a/sysdeps/unix/sysv/linux/timespec_get.c b/sysdeps/unix/sysv/linux/timespec_get.c
index 2561649..0e5f513 100644
--- a/sysdeps/unix/sysv/linux/timespec_get.c
+++ b/sysdeps/unix/sysv/linux/timespec_get.c
@@ -18,31 +18,21 @@
#include <time.h>
#include <sysdep.h>
-#ifndef HAVE_CLOCK_GETTIME_VSYSCALL
-# undef INTERNAL_VSYSCALL
-# define INTERNAL_VSYSCALL INTERNAL_SYSCALL
-#else
-# include <libc-vdso.h>
+#ifdef HAVE_CLOCK_GETTIME_VSYSCALL
+# define HAVE_VSYSCALL
#endif
-
-#ifndef INTERNAL_GETTIME
-# define INTERNAL_GETTIME(id, tp) \
- INTERNAL_VSYSCALL (clock_gettime, err, 2, id, tp)
-#endif
-
+#include <sysdep-vdso.h>
/* Set TS to calendar time based in time base BASE. */
int
-timespec_get (ts, base)
- struct timespec *ts;
- int base;
+timespec_get (struct timespec *ts, int base)
{
switch (base)
{
int res;
INTERNAL_SYSCALL_DECL (err);
case TIME_UTC:
- res = INTERNAL_GETTIME (CLOCK_REALTIME, ts);
+ res = INTERNAL_VSYSCALL (clock_gettime, err, 2, CLOCK_REALTIME, ts);
if (INTERNAL_SYSCALL_ERROR_P (res, err))
return 0;
break;
diff --git a/sysdeps/unix/sysv/linux/x86/libc-vdso.h b/sysdeps/unix/sysv/linux/x86/libc-vdso.h
index 79b6411..fea9c2b 100644
--- a/sysdeps/unix/sysv/linux/x86/libc-vdso.h
+++ b/sysdeps/unix/sysv/linux/x86/libc-vdso.h
@@ -24,7 +24,9 @@
#ifdef SHARED
-extern long int (*__vdso_clock_gettime) (clockid_t, struct timespec *)
+# include <sysdep-vdso.h>
+
+extern long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
attribute_hidden;
#endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c
index 25c38e4..b7bdbd1 100644
--- a/sysdeps/unix/sysv/linux/x86_64/init-first.c
+++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c
@@ -22,9 +22,10 @@
# include <dl-vdso.h>
# include <libc-vdso.h>
-long int (*__vdso_clock_gettime) (clockid_t, struct timespec *)
+long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *)
+ attribute_hidden;
+long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *)
attribute_hidden;
-long int (*__vdso_getcpu) (unsigned *, unsigned *, void *) attribute_hidden;
extern long int __syscall_clock_gettime (clockid_t, struct timespec *);
@@ -38,7 +39,7 @@ __vdso_platform_setup (void)
if (p == NULL)
p = __syscall_clock_gettime;
PTR_MANGLE (p);
- __vdso_clock_gettime = p;
+ VDSO_SYMBOL(clock_gettime) = p;
p = _dl_vdso_vsym ("__vdso_getcpu", &linux26);
/* If the vDSO is not available we fall back on the old vsyscall. */
@@ -46,7 +47,7 @@ __vdso_platform_setup (void)
if (p == NULL)
p = (void *) VSYSCALL_ADDR_vgetcpu;
PTR_MANGLE (p);
- __vdso_getcpu = p;
+ VDSO_SYMBOL(getcpu) = p;
}
# define VDSO_SETUP __vdso_platform_setup
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index 3dbd7d2..cc66093 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -252,61 +252,6 @@
# undef INTERNAL_SYSCALL_ERRNO
# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
-# ifdef SHARED
-# define INLINE_VSYSCALL(name, nr, args...) \
- ({ \
- __label__ out; \
- __label__ iserr; \
- INTERNAL_SYSCALL_DECL (sc_err); \
- long int sc_ret; \
- \
- __typeof (__vdso_##name) vdsop = __vdso_##name; \
- PTR_DEMANGLE (vdsop); \
- if (vdsop != NULL) \
- { \
- sc_ret = vdsop (args); \
- if (!INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
- goto out; \
- if (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err) != ENOSYS) \
- goto iserr; \
- } \
- \
- sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, ##args); \
- if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \
- { \
- iserr: \
- __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \
- sc_ret = -1L; \
- } \
- out: \
- sc_ret; \
- })
-# define INTERNAL_VSYSCALL(name, err, nr, args...) \
- ({ \
- __label__ out; \
- long int v_ret; \
- \
- __typeof (__vdso_##name) vdsop = __vdso_##name; \
- PTR_DEMANGLE (vdsop); \
- if (vdsop != NULL) \
- { \
- v_ret = vdsop (args); \
- if (!INTERNAL_SYSCALL_ERROR_P (v_ret, err) \
- || INTERNAL_SYSCALL_ERRNO (v_ret, err) != ENOSYS) \
- goto out; \
- } \
- v_ret = INTERNAL_SYSCALL (name, err, nr, ##args); \
- out: \
- v_ret; \
- })
-
-# else
-# define INLINE_VSYSCALL(name, nr, args...) \
- INLINE_SYSCALL (name, nr, ##args)
-# define INTERNAL_VSYSCALL(name, err, nr, args...) \
- INTERNAL_SYSCALL (name, err, nr, ##args)
-# endif
-
# define LOAD_ARGS_0()
# define LOAD_REGS_0
# define ASM_ARGS_0
-----------------------------------------------------------------------
hooks/post-receive
--
GNU C Library master sources