From patchwork Wed Apr 18 20:17:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Albert ARIBAUD X-Patchwork-Id: 26794 Received: (qmail 105041 invoked by alias); 18 Apr 2018 20:19:41 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 104919 invoked by uid 89); 18 Apr 2018 20:19:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, RCVD_IN_RP_RNBL autolearn=ham version=3.3.2 spammy= X-HELO: smtp3-g21.free.fr From: "Albert ARIBAUD (3ADEV)" To: libc-alpha@sourceware.org Cc: "Albert ARIBAUD (3ADEV)" Subject: [[PATCH RFC 2] 15/63] Y2038: powerpc: implement clock_gettime64 as a VDSO symbol Date: Wed, 18 Apr 2018 22:17:31 +0200 Message-Id: <20180418201819.15952-16-albert.aribaud@3adev.fr> In-Reply-To: <20180418201819.15952-15-albert.aribaud@3adev.fr> References: <20180418201819.15952-1-albert.aribaud@3adev.fr> <20180418201819.15952-2-albert.aribaud@3adev.fr> <20180418201819.15952-3-albert.aribaud@3adev.fr> <20180418201819.15952-4-albert.aribaud@3adev.fr> <20180418201819.15952-5-albert.aribaud@3adev.fr> <20180418201819.15952-6-albert.aribaud@3adev.fr> <20180418201819.15952-7-albert.aribaud@3adev.fr> <20180418201819.15952-8-albert.aribaud@3adev.fr> <20180418201819.15952-9-albert.aribaud@3adev.fr> <20180418201819.15952-10-albert.aribaud@3adev.fr> <20180418201819.15952-11-albert.aribaud@3adev.fr> <20180418201819.15952-12-albert.aribaud@3adev.fr> <20180418201819.15952-13-albert.aribaud@3adev.fr> <20180418201819.15952-14-albert.aribaud@3adev.fr> <20180418201819.15952-15-albert.aribaud@3adev.fr> --- sysdeps/powerpc/powerpc32/backtrace.c | 1 + sysdeps/unix/sysv/linux/powerpc/init-first.c | 16 ++++++++++++++++ sysdeps/unix/sysv/linux/powerpc/libc-vdso.h | 2 ++ 3 files changed, 19 insertions(+) diff --git a/sysdeps/powerpc/powerpc32/backtrace.c b/sysdeps/powerpc/powerpc32/backtrace.c index 5422fdd50d..6db460dbc1 100644 --- a/sysdeps/powerpc/powerpc32/backtrace.c +++ b/sysdeps/powerpc/powerpc32/backtrace.c @@ -20,6 +20,7 @@ #include #include #include +#include #include /* This is the stack layout we see with every stack frame. diff --git a/sysdeps/unix/sysv/linux/powerpc/init-first.c b/sysdeps/unix/sysv/linux/powerpc/init-first.c index 0a4becbed6..b17ea92a1f 100644 --- a/sysdeps/unix/sysv/linux/powerpc/init-first.c +++ b/sysdeps/unix/sysv/linux/powerpc/init-first.c @@ -28,6 +28,15 @@ unsigned long long (*VDSO_SYMBOL(get_tbfreq)) (void); int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *); time_t (*VDSO_SYMBOL(time)) (time_t *); +long (*VDSO_SYMBOL(clock_gettime64)) (clockid_t, struct __timespec64 *); + +int __y2038_linux_support; + +int __y2038_kernel_support (void) +{ + return __y2038_linux_support; +} + #if defined(__PPC64__) || defined(__powerpc64__) void *VDSO_SYMBOL(sigtramp_rt64); #else @@ -64,6 +73,13 @@ _libc_vdso_platform_setup (void) PTR_MANGLE (p); VDSO_SYMBOL (time) = p; + /* (aaribaud) TODO: map to version where clock_gettime64 officially appears */ + p = _dl_vdso_vsym ("__vdso_clock_gettime64", NULL); + PTR_MANGLE (p); + VDSO_SYMBOL (clock_gettime64) = p; + + __y2038_linux_support = (p != NULL) ? 1 : 0; + /* 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). diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h b/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h index 5fe817d6cb..de8d44e95e 100644 --- a/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h +++ b/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h @@ -32,6 +32,8 @@ extern unsigned long long (*VDSO_SYMBOL(get_tbfreq)) (void); extern int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *); extern time_t (*VDSO_SYMBOL(time)) (time_t *); +extern long (*VDSO_SYMBOL(clock_gettime64)) (clockid_t, struct __timespec64 *); + #if defined(__PPC64__) || defined(__powerpc64__) extern void *VDSO_SYMBOL(sigtramp_rt64); #else