From patchwork Thu Sep 5 20:56:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 173178 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:ce:0:0:0:0 with SMTP id r14csp1237737ilq; Thu, 5 Sep 2019 13:56:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqz238/DorhdUow0idPq0NeVNqwIfgyBrldxkTOLvjZJJIw42D3QUK3k/dzO0+pRZeAsTtQ/ X-Received: by 2002:a65:50c8:: with SMTP id s8mr4932121pgp.339.1567717004722; Thu, 05 Sep 2019 13:56:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567717004; cv=none; d=google.com; s=arc-20160816; b=LFOd+zo/36RkcoVE9AXUspYcyWM5jfB7wYLYZznzzzSz1Afyv5XzXxO8deaOl1aolu SDe19LN0uij1WeM8FgjfLzeCe9/L6n4HMtK/tRNXVAnozZ79eGqd5ECN/Ez1uUeuj1Au 8PniCyG1c0mrjXL7gDVthkXO5GKqWwrsYavcJkEmvg3cg5abmd/XgATM6/FTagpL0wiD tKlzZxi9mKu/jfjZ1fJao6OuxBukNBoZS0FbQRoSASPrTLhFGJHdlzUh4duIuto9pKUV n5aOIG5lWDS/dtE2RPbo3UY8lEPMRBmDv/rVLVHQpMYAEFN2feNy/TnhLLCDuJbIZ34v 4TcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:to:from:dkim-signature:delivered-to:sender :list-help:list-post:list-archive:list-subscribe:list-unsubscribe :list-id:precedence:mailing-list:dkim-signature:domainkey-signature; bh=8uQvuZYeByzIBKvmR1ODMtf8YKFI8Ns4Sq2oLvKwtEI=; b=A4eQChR249CIyY/AQl4st2f7WOMpRSInvTb/itt5uNtquyadRXj0FCUAT7eDz2myLf 2QUSCVaTp4qvGkesQvxFBCs7ZWVaH66fI+rfYDqB4HmoJpf3r9cQwEGF6SKBrxrLVWjW YxWd4gwgSjtRtumjPvmdIRMLv3xwk9P6AlTS4two3GWoq7f1/wRcLBf+ZsmO+DoYn05q fV5H3Yk4p7dlSfF49l/Lsys+4j7ejxiJlmukn+KQUoCiz73BDDifVm9wAk6PfD5nAK4L a11wafUOBndjGOzSBR3DMGVHdvjx2e8/TMziX0FOMDwFgewXx/mRqISXZcQiQge+xPkV k0YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="OKg8/X20"; dkim=pass header.i=@linaro.org header.s=google header.b=PV5l0yWt; spf=pass (google.com: domain of libc-alpha-return-105063-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-105063-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id n16si3516835pfq.233.2019.09.05.13.56.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Sep 2019 13:56:44 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-105063-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b="OKg8/X20"; dkim=pass header.i=@linaro.org header.s=google header.b=PV5l0yWt; spf=pass (google.com: domain of libc-alpha-return-105063-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-105063-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=IUI4PfV31FdbTlID8qy/zjDGp04zYmEn/qsx+MNeu4a7ro7/7z4RV m/HpH8S5m3GjHdWJFAME8mFOB0lmCfiiQIeAz3ebd2cGz1p7rsQ9uX9G4M83s3a3 WqDPq+W5RI73vcZdtiHzB84bOXyGKgR0t5UG72JksZQlI5PUUSoO0M= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; s=default; bh=oRZJBGn6yZx6+gkyIl+/PRahUbY=; b=OKg8/X20HzR1cGONP8mJpO6iMlaM w/EE/TD8EY5JLYAwLJl2VbybZ8WjNVvTH02ROmZsrbSKCRRjaAm1hIMhhfp3zJ5w a+23SrXygviEvfmGZFDe1kk9NLRWODHmvc3NkvWq22blBkloar6omxbpG/r5qb5m 4Ta/bAFPrejmacs= Received: (qmail 116523 invoked by alias); 5 Sep 2019 20:56:32 -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 116513 invoked by uid 89); 5 Sep 2019 20:56:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=H*MI:4646, HX-Spam-Relays-External:209.85.222.194, H*RU:209.85.222.194 X-HELO: mail-qk1-f194.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id; bh=8uQvuZYeByzIBKvmR1ODMtf8YKFI8Ns4Sq2oLvKwtEI=; b=PV5l0yWtz0I7bk/LIiV1INFQ3yuVAm3u4uOzSoSogu22VwkrA/525F/uzmXUihLe/w gnRllBn47AsvATrp/7gX/ysI2LZXnUbDvdzlgpDOtJD66/Kik7NEk1NoIAljK+3C3W8q 1nQRkmM/9Y+DYHmT3Pd7vLQt9NEE19gARmafAdUGmLWRym2P2Db/VDyWTC1XL/hQuBqT d0ofEk3pp3uGKP7m6hW+3Tzwm3hh7MC0ozn7OF62kOGf0yRXc8HNhismViCAYvsVyd8p CyEOcW9TzhUrK2R5ZDhvz7ie/6F/AcqkXLMpdubzmNyNwA6sYG8mnZ5qBff8j5vMVTu+ NzNQ== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH v2 1/8] Remove PREPARE_VERSION and PREPARE_VERSION_KNOW Date: Thu, 5 Sep 2019 17:56:13 -0300 Message-Id: <20190905205620.4646-1-adhemerval.zanella@linaro.org> Changes from previous version: - Remove trailing whitespaces. -- This patch removes the PREPARE_VERSION and PREPARE_VERSION_KNOW macro and uses a static inline function instead, get_vdso_symbol. Each architecture that supports vDSO must define the Linux version and its hash for symbol resolution (VDSO_NAME and VDSO_HASH macro respectively). It also organizes the HAVE_*_VSYSCALL for mips, powerpc, and s390 to set them on a common header. The idea is to require less code to configure and enable vDSO support for newer ports. No semantic changes are expected. Checked with a build against all affected architectures. * sysdeps/unix/make-syscalls.sh: Make vDSO call use get_vdso_symbol. * sysdeps/unix/sysv/linux/aarch64/gettimeofday.c (__gettimeofday): Use get_vdso_symbol instead of _dl_vdso_vsym. * sysdeps/unix/sysv/linux/powerpc/time.c (time): Likewise. * sysdeps/unix/sysv/linux/riscv/flush-icache.c (__lookup_riscv_flush_icache): Likewise. * sysdeps/unix/sysv/linux/x86/gettimeofday.c (__gettimeofday): Likewise. * sysdeps/unix/sysv/linux/x86/time.c (time): Likewise. * sysdeps/unix/sysv/linux/powerpc/gettimeofday.c: Likewise. * sysdeps/unix/sysv/linux/aarch64/init-first.c: Likewise. * sysdeps/unix/sysv/linux/arm/init-first.c: Likewise. * sysdeps/unix/sysv/linux/i386/init-first.c: Likewise. * sysdeps/unix/sysv/linux/mips/init-first.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/init-first.c: Likewise. * sysdeps/unix/sysv/linux/riscv/init-first.c: Likewise. * sysdeps/unix/sysv/linux/sparc/init-first.c: Likewise. * sysdeps/unix/sysv/linux/s390/init-first.c: Likewise. * sysdeps/unix/sysv/linux/x86_64/init-first.c: Likewise. * sysdeps/unix/sysv/linux/aarch64/sysdep.h (VDSO_NAME, VDSO_HASH): Define. * sysdeps/unix/sysv/linux/arm/sysdep.h (VDSO_NAME, VDSO_HASH): Likewise. * sysdeps/unix/sysv/linux/i386/sysdep.h (VDSO_NAME, VDSO_HASH): Likewise. * sysdeps/unix/sysv/linux/riscv/sysdep.h (VDSO_NAME, VDSO_HASH): Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep.h (VDSO_NAME, VDSO_HASH): Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h (VDSO_NAME, VDSO_HASH): Likewise. * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Remove definition. * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h (HAVE_CLOCK_GETRES_VSYSCALL, HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL, HAVE_GETCPU_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h (HAVE_CLOCK_GETRES_VSYSCALL, HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL, HAVE_GETCPU_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/mips/sysdep.h: New file. * sysdeps/unix/sysv/linux/powerpc/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/s390/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/dl-vdso.h (PREPARE_VERSION, PREPARE_VERSION_KNOWN, VDSO_NAME_LINUX_2_6, VDSO_HASH_LINUX_2_6, VDSO_NAME_LINUX_2_6_15, VDSO_HASH_LINUX_2_6_15, VDSO_NAME_LINUX_2_6_29, VDSO_HASH_LINUX_2_6_29, VDSO_NAME_LINUX_4_15, VDSO_HASH_LINUX_4_15): Remove defines. (get_vdso_symbol): New function. --- sysdeps/unix/make-syscalls.sh | 5 +-- .../unix/sysv/linux/aarch64/gettimeofday.c | 27 ++++--------- sysdeps/unix/sysv/linux/aarch64/init-first.c | 12 ++---- sysdeps/unix/sysv/linux/aarch64/sysdep.h | 7 ++++ sysdeps/unix/sysv/linux/arm/init-first.c | 6 +-- sysdeps/unix/sysv/linux/arm/sysdep.h | 3 ++ sysdeps/unix/sysv/linux/dl-vdso.h | 38 ++++--------------- sysdeps/unix/sysv/linux/i386/init-first.c | 4 +- sysdeps/unix/sysv/linux/i386/sysdep.h | 3 ++ sysdeps/unix/sysv/linux/mips/init-first.c | 6 +-- sysdeps/unix/sysv/linux/mips/mips32/sysdep.h | 5 +-- .../unix/sysv/linux/mips/mips64/n32/sysdep.h | 5 +-- .../unix/sysv/linux/mips/mips64/n64/sysdep.h | 5 +-- sysdeps/unix/sysv/linux/mips/sysdep.h | 24 ++++++++++++ .../unix/sysv/linux/powerpc/gettimeofday.c | 7 ++-- sysdeps/unix/sysv/linux/powerpc/init-first.c | 22 +++++------ .../sysv/linux/powerpc/powerpc32/sysdep.h | 7 +--- .../sysv/linux/powerpc/powerpc64/sysdep.h | 6 +-- sysdeps/unix/sysv/linux/powerpc/sysdep.h | 26 +++++++++++++ sysdeps/unix/sysv/linux/powerpc/time.c | 5 +-- sysdeps/unix/sysv/linux/riscv/flush-icache.c | 4 +- sysdeps/unix/sysv/linux/riscv/init-first.c | 10 ++--- sysdeps/unix/sysv/linux/riscv/sysdep.h | 3 ++ sysdeps/unix/sysv/linux/s390/init-first.c | 10 ++--- sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h | 7 +--- sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 7 +--- sysdeps/unix/sysv/linux/s390/sysdep.h | 27 +++++++++++++ sysdeps/unix/sysv/linux/sparc/init-first.c | 6 +-- sysdeps/unix/sysv/linux/sparc/sysdep.h | 3 ++ sysdeps/unix/sysv/linux/x86/gettimeofday.c | 10 +++-- sysdeps/unix/sysv/linux/x86/time.c | 7 ++-- sysdeps/unix/sysv/linux/x86_64/init-first.c | 6 +-- sysdeps/unix/sysv/linux/x86_64/sysdep.h | 3 ++ 33 files changed, 168 insertions(+), 158 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/mips/sysdep.h create mode 100644 sysdeps/unix/sysv/linux/powerpc/sysdep.h create mode 100644 sysdeps/unix/sysv/linux/s390/sysdep.h -- 2.17.1 diff --git a/sysdeps/unix/make-syscalls.sh b/sysdeps/unix/make-syscalls.sh index 6a5c10d54e..b49e6b6305 100644 --- a/sysdeps/unix/make-syscalls.sh +++ b/sysdeps/unix/make-syscalls.sh @@ -283,10 +283,9 @@ while read file srcfile caller syscall args strong weak; do (echo '#define ${strong} __redirect_${strong}'; \\ echo '#include '; \\ echo '#undef ${strong}'; \\ - echo '#define vdso_ifunc_init() \\'; \\ - echo ' PREPARE_VERSION_KNOWN (symver, ${vdso_symver})'; \\ + echo '#define vdso_ifunc_init()'; \\ echo '__ifunc (__redirect_${strong}, ${strong},'; \\ - echo ' _dl_vdso_vsym ("${vdso_symbol}", &symver), void,'; \\ + echo ' get_vdso_symbol ("${vdso_symbol}"), void,'; \\ echo ' vdso_ifunc_init)'; \\ EOF # This is doing "hidden_def (${strong})", but the compiler diff --git a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c b/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c index 9180b50bf7..9499a11fda 100644 --- a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c +++ b/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c @@ -20,12 +20,10 @@ putting it into *tv and *tz. If tz is null, *tz is not filled. Returns 0 on success, -1 on errors. */ +#include + #ifdef SHARED -# define __gettimeofday __redirect___gettimeofday -# include -# undef __gettimeofday -# define HAVE_VSYSCALL # include # include @@ -38,25 +36,14 @@ __gettimeofday_vsyscall (struct timeval *tv, struct timezone *tz) return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); } -/* PREPARE_VERSION_KNOWN will need an __LP64__ ifdef when ILP32 support - goes in. See _libc_vdso_platform_setup in - sysdeps/unix/sysv/linux/aarch64/init-first.c. */ - -# undef INIT_ARCH -# define INIT_ARCH() \ - PREPARE_VERSION_KNOWN (linux_version, LINUX_2_6_39); \ - void *vdso_gettimeofday = \ - _dl_vdso_vsym ("__kernel_gettimeofday", &linux_version); - -libc_ifunc_hidden (__redirect___gettimeofday, __gettimeofday, - vdso_gettimeofday ?: (void *) __gettimeofday_vsyscall) - -__hidden_ver1 (__gettimeofday_vsyscall, __GI___gettimeofday, - __gettimeofday_vsyscall); +# define INIT_ARCH() +libc_ifunc_hidden (__gettimeofday, __gettimeofday, + (get_vdso_symbol ("__vdso_gettimeofday") + ?: __gettimeofday_vsyscall)) +libc_hidden_def (__gettimeofday) #else -# include # include int __gettimeofday (struct timeval *tv, struct timezone *tz) diff --git a/sysdeps/unix/sysv/linux/aarch64/init-first.c b/sysdeps/unix/sysv/linux/aarch64/init-first.c index 80f7ed91ef..c3c27cfd4b 100644 --- a/sysdeps/unix/sysv/linux/aarch64/init-first.c +++ b/sysdeps/unix/sysv/linux/aarch64/init-first.c @@ -26,21 +26,15 @@ int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *); static inline void _libc_vdso_platform_setup (void) { -#ifdef __LP64__ - PREPARE_VERSION_KNOWN (linux_version, LINUX_2_6_39); -#else - PREPARE_VERSION_KNOWN (linux_version, LINUX_4_9); -#endif - - void *p = _dl_vdso_vsym ("__kernel_gettimeofday", &linux_version); + void *p = get_vdso_symbol ("__kernel_gettimeofday"); PTR_MANGLE (p); VDSO_SYMBOL(gettimeofday) = p; - p = _dl_vdso_vsym ("__kernel_clock_gettime", &linux_version); + p = get_vdso_symbol ("__kernel_clock_gettime"); PTR_MANGLE (p); VDSO_SYMBOL(clock_gettime) = p; - p = _dl_vdso_vsym ("__kernel_clock_getres", &linux_version); + p = get_vdso_symbol ("__kernel_clock_getres"); PTR_MANGLE (p); VDSO_SYMBOL(clock_getres) = p; } diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h index a2f4061b58..662d321235 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h @@ -151,6 +151,13 @@ #else /* not __ASSEMBLER__ */ +# ifdef __LP64__ +# define VDSO_NAME "LINUX_2_6_39" +# define VDSO_HASH 123718537 +# else +# define VDSO_NAME "LINUX_4.9" +# define VDSO_HASH 61765625 +# endif /* List of system calls which are supported as vsyscalls. */ # define HAVE_CLOCK_GETRES_VSYSCALL 1 diff --git a/sysdeps/unix/sysv/linux/arm/init-first.c b/sysdeps/unix/sysv/linux/arm/init-first.c index e1846df661..2852ab135c 100644 --- a/sysdeps/unix/sysv/linux/arm/init-first.c +++ b/sysdeps/unix/sysv/linux/arm/init-first.c @@ -27,13 +27,11 @@ int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *); static inline void _libc_vdso_platform_setup (void) { - PREPARE_VERSION_KNOWN (linux26, LINUX_2_6); - - void *p = _dl_vdso_vsym ("__vdso_gettimeofday", &linux26); + void *p = get_vdso_symbol ("__vdso_gettimeofday"); PTR_MANGLE (p); VDSO_SYMBOL (gettimeofday) = p; - p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux26); + p = get_vdso_symbol ("__vdso_clock_gettime"); PTR_MANGLE (p); VDSO_SYMBOL (clock_gettime) = p; } diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.h b/sysdeps/unix/sysv/linux/arm/sysdep.h index 6d8d9a47f9..467ccf2631 100644 --- a/sysdeps/unix/sysv/linux/arm/sysdep.h +++ b/sysdeps/unix/sysv/linux/arm/sysdep.h @@ -388,6 +388,9 @@ __local_syscall_error: \ #undef INTERNAL_SYSCALL_ERRNO #define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) +#define VDSO_NAME "LINUX_2_6" +#define VDSO_HASH 61765110 + /* List of system calls which are supported as vsyscalls. */ #define HAVE_CLOCK_GETTIME_VSYSCALL 1 #define HAVE_GETTIMEOFDAY_VSYSCALL 1 diff --git a/sysdeps/unix/sysv/linux/dl-vdso.h b/sysdeps/unix/sysv/linux/dl-vdso.h index d83afe130e..bab3779615 100644 --- a/sysdeps/unix/sysv/linux/dl-vdso.h +++ b/sysdeps/unix/sysv/linux/dl-vdso.h @@ -22,40 +22,18 @@ #include #include #include - -/* Create version number record for lookup. */ -static inline struct r_found_version -prepare_version_base (const char *name, ElfW(Word) hash) -{ - assert (hash == _dl_elf_hash (name)); - return (struct r_found_version) { name, hash, 1, NULL }; -} -#define prepare_version(vname) \ - prepare_version_base (VDSO_NAME_##vname, VDSO_HASH_##vname) - -/* Use this for the known version sets defined below, where we - record their precomputed hash values only once, in this file. */ -#define PREPARE_VERSION_KNOWN(var, vname) \ - struct r_found_version var = prepare_version (vname); - -#define VDSO_NAME_LINUX_2_6 "LINUX_2.6" -#define VDSO_HASH_LINUX_2_6 61765110 -#define VDSO_NAME_LINUX_2_6_15 "LINUX_2.6.15" -#define VDSO_HASH_LINUX_2_6_15 123718565 -#define VDSO_NAME_LINUX_2_6_29 "LINUX_2.6.29" -#define VDSO_HASH_LINUX_2_6_29 123718585 -#define VDSO_NAME_LINUX_2_6_39 "LINUX_2.6.39" -#define VDSO_HASH_LINUX_2_6_39 123718537 -#define VDSO_NAME_LINUX_4 "LINUX_4" -#define VDSO_HASH_LINUX_4 14921332 -#define VDSO_NAME_LINUX_4_9 "LINUX_4.9" -#define VDSO_HASH_LINUX_4_9 61765625 -#define VDSO_NAME_LINUX_4_15 "LINUX_4.15" -#define VDSO_HASH_LINUX_4_15 182943605 +#include /* Functions for resolving symbols in the VDSO link map. */ extern void *_dl_vdso_vsym (const char *name, const struct r_found_version *version) attribute_hidden; +static inline void * +get_vdso_symbol (const char *symbol) +{ + struct r_found_version rfv = { VDSO_NAME, VDSO_HASH, 1, NULL }; + return _dl_vdso_vsym (symbol, &rfv); +} + #endif /* dl-vdso.h */ diff --git a/sysdeps/unix/sysv/linux/i386/init-first.c b/sysdeps/unix/sysv/linux/i386/init-first.c index 60d69777cd..9c03f87b67 100644 --- a/sysdeps/unix/sysv/linux/i386/init-first.c +++ b/sysdeps/unix/sysv/linux/i386/init-first.c @@ -34,9 +34,7 @@ clock_gettime_syscall (clockid_t id, struct timespec *tp) static inline void __vdso_platform_setup (void) { - PREPARE_VERSION_KNOWN (linux26, LINUX_2_6); - - void *p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux26); + void *p = get_vdso_symbol ("__vdso_clock_gettime"); if (p == NULL) p = clock_gettime_syscall; PTR_MANGLE (p); diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index 77154b904a..278028f52e 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -309,6 +309,9 @@ struct libc_do_syscall_args #define INLINE_SYSCALL_ERROR_RETURN_VALUE(resultvar) \ __syscall_error (-(resultvar)) +# define VDSO_NAME "LINUX_2.6" +# define VDSO_HASH 61765110 + /* List of system calls which are supported as vsyscalls. */ # define HAVE_CLOCK_GETTIME_VSYSCALL 1 # define HAVE_GETTIMEOFDAY_VSYSCALL 1 diff --git a/sysdeps/unix/sysv/linux/mips/init-first.c b/sysdeps/unix/sysv/linux/mips/init-first.c index 25884ffd80..2a43bdc8b0 100644 --- a/sysdeps/unix/sysv/linux/mips/init-first.c +++ b/sysdeps/unix/sysv/linux/mips/init-first.c @@ -26,13 +26,11 @@ int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *); static inline void _libc_vdso_platform_setup (void) { - PREPARE_VERSION_KNOWN (linux26, LINUX_2_6); - - void *p = _dl_vdso_vsym ("__vdso_gettimeofday", &linux26); + void *p = get_vdso_symbol ("__vdso_gettimeofday"); PTR_MANGLE (p); VDSO_SYMBOL (gettimeofday) = p; - p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux26); + p = get_vdso_symbol ("__vdso_clock_gettime"); PTR_MANGLE (p); VDSO_SYMBOL (clock_gettime) = p; } diff --git a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h index a310a0acbc..ebe397b701 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h @@ -19,6 +19,7 @@ #define _LINUX_MIPS_MIPS32_SYSDEP_H 1 /* There is some commonality. */ +#include #include #include @@ -360,10 +361,6 @@ libc_hidden_proto (__mips_syscall7, nomips16) _ret; \ }) -/* List of system calls which are supported as vsyscalls. */ -#define HAVE_CLOCK_GETTIME_VSYSCALL 1 -#define HAVE_GETTIMEOFDAY_VSYSCALL 1 - #endif /* __ASSEMBLER__ */ /* Pointer mangling is not yet supported for MIPS. */ diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h index d83e08f96a..bb49429c30 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h @@ -19,6 +19,7 @@ #define _LINUX_MIPS_SYSDEP_H 1 /* There is some commonality. */ +#include #include #include @@ -308,10 +309,6 @@ _ret; \ }) -/* List of system calls which are supported as vsyscalls. */ -#define HAVE_CLOCK_GETTIME_VSYSCALL 1 -#define HAVE_GETTIMEOFDAY_VSYSCALL 1 - #endif /* __ASSEMBLER__ */ /* Pointer mangling is not yet supported for MIPS. */ diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h index bcfaf561a1..84a1ff186b 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h @@ -19,6 +19,7 @@ #define _LINUX_MIPS_SYSDEP_H 1 /* There is some commonality. */ +#include #include #include @@ -304,10 +305,6 @@ _ret; \ }) -/* List of system calls which are supported as vsyscalls. */ -#define HAVE_CLOCK_GETTIME_VSYSCALL 1 -#define HAVE_GETTIMEOFDAY_VSYSCALL 1 - #endif /* __ASSEMBLER__ */ /* Pointer mangling is not yet supported for MIPS. */ diff --git a/sysdeps/unix/sysv/linux/mips/sysdep.h b/sysdeps/unix/sysv/linux/mips/sysdep.h new file mode 100644 index 0000000000..cabc590961 --- /dev/null +++ b/sysdeps/unix/sysv/linux/mips/sysdep.h @@ -0,0 +1,24 @@ +/* Syscall definitions, Linux MIPS generic version. + Copyright (C) 2019 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 + . */ + +#define VDSO_NAME "LINUX_2_6" +#define VDSO_HASH 61765110 + +/* List of system calls which are supported as vsyscalls. */ +#define HAVE_CLOCK_GETTIME_VSYSCALL 1 +#define HAVE_GETTIMEOFDAY_VSYSCALL 1 diff --git a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c index 463b678ad9..c59d5ddc10 100644 --- a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c +++ b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c @@ -57,10 +57,9 @@ __gettimeofday_syscall (struct timeval *tv, struct timezone *tz) return INLINE_SYSCALL (gettimeofday, 2, tv, tz); } -# define INIT_ARCH() \ - PREPARE_VERSION_KNOWN (linux2615, LINUX_2_6_15); \ - void *vdso_gettimeofday = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2615); - +# define INIT_ARCH() \ + void *vdso_gettimeofday = get_vdso_symbol ("__kernel_gettimeofday") + /* If the vDSO is not available we fall back syscall. */ libc_ifunc_hidden (__redirect___gettimeofday, __gettimeofday, vdso_gettimeofday diff --git a/sysdeps/unix/sysv/linux/powerpc/init-first.c b/sysdeps/unix/sysv/linux/powerpc/init-first.c index 831f910788..0d46563ce3 100644 --- a/sysdeps/unix/sysv/linux/powerpc/init-first.c +++ b/sysdeps/unix/sysv/linux/powerpc/init-first.c @@ -37,29 +37,27 @@ void *VDSO_SYMBOL(sigtramp_rt32); static inline void _libc_vdso_platform_setup (void) { - PREPARE_VERSION_KNOWN (linux2615, LINUX_2_6_15); - - void *p = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2615); + void *p = get_vdso_symbol ("__kernel_gettimeofday"); PTR_MANGLE (p); VDSO_SYMBOL (gettimeofday) = p; - p = _dl_vdso_vsym ("__kernel_clock_gettime", &linux2615); + p = get_vdso_symbol ("__kernel_clock_gettime"); PTR_MANGLE (p); VDSO_SYMBOL (clock_gettime) = p; - p = _dl_vdso_vsym ("__kernel_clock_getres", &linux2615); + p = get_vdso_symbol ("__kernel_clock_getres"); PTR_MANGLE (p); VDSO_SYMBOL (clock_getres) = p; - p = _dl_vdso_vsym ("__kernel_get_tbfreq", &linux2615); + p = get_vdso_symbol ("__kernel_get_tbfreq"); PTR_MANGLE (p); VDSO_SYMBOL (get_tbfreq) = p; - p = _dl_vdso_vsym ("__kernel_getcpu", &linux2615); + p = get_vdso_symbol ("__kernel_getcpu"); PTR_MANGLE (p); VDSO_SYMBOL (getcpu) = p; - p = _dl_vdso_vsym ("__kernel_time", &linux2615); + p = get_vdso_symbol ("__kernel_time"); PTR_MANGLE (p); VDSO_SYMBOL (time) = p; @@ -69,12 +67,10 @@ _libc_vdso_platform_setup (void) There is no need to pointer mangle these symbol because they will used only for pointer comparison. */ #if defined(__PPC64__) || defined(__powerpc64__) - VDSO_SYMBOL(sigtramp_rt64) = _dl_vdso_vsym ("__kernel_sigtramp_rt64", - &linux2615); + VDSO_SYMBOL(sigtramp_rt64) = get_vdso_symbol ("__kernel_sigtramp_rt64"); #else - VDSO_SYMBOL(sigtramp32) = _dl_vdso_vsym ("__kernel_sigtramp32", &linux2615); - VDSO_SYMBOL(sigtramp_rt32) = _dl_vdso_vsym ("__kernel_sigtramp_rt32", - &linux2615); + VDSO_SYMBOL(sigtramp32) = get_vdso_symbol ("__kernel_sigtramp32"); + VDSO_SYMBOL(sigtramp_rt32) = get_vdso_symbol ("__kernel_sigtramp_rt32"); #endif } diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h index 62caa265d7..f459543fcd 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h @@ -18,6 +18,7 @@ #ifndef _LINUX_POWERPC_SYSDEP_H #define _LINUX_POWERPC_SYSDEP_H 1 +#include #include #include #include @@ -144,12 +145,6 @@ sc_ret; \ }) -/* 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) \ 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 4122e5c4a9..06222f52e6 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h @@ -20,6 +20,7 @@ #ifndef _LINUX_POWERPC_SYSDEP_H #define _LINUX_POWERPC_SYSDEP_H 1 +#include #include #include #include @@ -60,11 +61,6 @@ sc_ret; \ }) -/* 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 normally. It will never touch errno. This returns just what the kernel diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/sysdep.h new file mode 100644 index 0000000000..5b411d0e8e --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h @@ -0,0 +1,26 @@ +/* Syscall definitions, Linux PowerPC generic version. + Copyright (C) 2019 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 + . */ + +#define VDSO_NAME "LINUX_2.6.15" +#define VDSO_HASH 123718565 + +/* 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 + diff --git a/sysdeps/unix/sysv/linux/powerpc/time.c b/sysdeps/unix/sysv/linux/powerpc/time.c index cb3e8b9a73..38477bce8b 100644 --- a/sysdeps/unix/sysv/linux/powerpc/time.c +++ b/sysdeps/unix/sysv/linux/powerpc/time.c @@ -66,9 +66,8 @@ time_syscall (time_t *t) return result; } -# define INIT_ARCH() \ - PREPARE_VERSION_KNOWN (linux2615, LINUX_2_6_15); \ - void *vdso_time = _dl_vdso_vsym ("__kernel_time", &linux2615); +# define INIT_ARCH() \ + void *vdso_time = get_vdso_symbol ("__kernel_time"); /* If the vDSO is not available we fall back to the syscall. */ libc_ifunc_hidden (__redirect_time, time, diff --git a/sysdeps/unix/sysv/linux/riscv/flush-icache.c b/sysdeps/unix/sysv/linux/riscv/flush-icache.c index f2dfcc50d0..6fbda9a088 100644 --- a/sysdeps/unix/sysv/linux/riscv/flush-icache.c +++ b/sysdeps/unix/sysv/linux/riscv/flush-icache.c @@ -38,9 +38,7 @@ __riscv_flush_icache_syscall (void *start, void *end, unsigned long int flags) static func_type __lookup_riscv_flush_icache (void) { - PREPARE_VERSION_KNOWN (linux_version, LINUX_4_15); - - func_type func = _dl_vdso_vsym ("__vdso_flush_icache", &linux_version); + func_type func = get_vdso_symbol ("__vdso_flush_icache"); /* If there is no vDSO entry then call the system call directly. All Linux versions provide the vDSO entry, but QEMU's user-mode emulation doesn't diff --git a/sysdeps/unix/sysv/linux/riscv/init-first.c b/sysdeps/unix/sysv/linux/riscv/init-first.c index 98a8ce33ad..f3d243a192 100644 --- a/sysdeps/unix/sysv/linux/riscv/init-first.c +++ b/sysdeps/unix/sysv/linux/riscv/init-first.c @@ -32,21 +32,19 @@ long int (*VDSO_SYMBOL (clock_getres)) (clockid_t, struct timespec *) static inline void _libc_vdso_platform_setup (void) { - PREPARE_VERSION_KNOWN (linux_version, LINUX_4_15); - - void *p = _dl_vdso_vsym ("__vdso_getcpu", &linux_version); + void *p = get_vdso_symbol ("__vdso_getcpu"); PTR_MANGLE (p); VDSO_SYMBOL (getcpu) = p; - p = _dl_vdso_vsym ("__vdso_gettimeofday", &linux_version); + p = get_vdso_symbol ("__vdso_gettimeofday"); PTR_MANGLE (p); VDSO_SYMBOL (gettimeofday) = p; - p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux_version); + p = get_vdso_symbol ("__vdso_clock_gettime"); PTR_MANGLE (p); VDSO_SYMBOL (clock_gettime) = p; - p = _dl_vdso_vsym ("__vdso_clock_getres", &linux_version); + p = get_vdso_symbol ("__vdso_clock_getres"); PTR_MANGLE (p); VDSO_SYMBOL (clock_getres) = p; } diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h index 5470ea3d2a..5de773744c 100644 --- a/sysdeps/unix/sysv/linux/riscv/sysdep.h +++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h @@ -121,6 +121,9 @@ #ifndef __ASSEMBLER__ +# define VDSO_NAME "LINUX_4.15" +# define VDSO_HASH 182943605 + /* List of system calls which are supported as vsyscalls. */ # define HAVE_CLOCK_GETRES_VSYSCALL 1 # define HAVE_CLOCK_GETTIME_VSYSCALL 1 diff --git a/sysdeps/unix/sysv/linux/s390/init-first.c b/sysdeps/unix/sysv/linux/s390/init-first.c index a1ad9458e3..3e36270eac 100644 --- a/sysdeps/unix/sysv/linux/s390/init-first.c +++ b/sysdeps/unix/sysv/linux/s390/init-first.c @@ -34,21 +34,19 @@ long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *) static inline void _libc_vdso_platform_setup (void) { - PREPARE_VERSION_KNOWN (linux2629, LINUX_2_6_29); - - void *p = _dl_vdso_vsym ("__kernel_gettimeofday", &linux2629); + void *p = get_vdso_symbol ("__kernel_gettimeofday"); PTR_MANGLE (p); VDSO_SYMBOL (gettimeofday) = p; - p = _dl_vdso_vsym ("__kernel_clock_gettime", &linux2629); + p = get_vdso_symbol ("__kernel_clock_gettime"); PTR_MANGLE (p); VDSO_SYMBOL (clock_gettime) = p; - p = _dl_vdso_vsym ("__kernel_clock_getres", &linux2629); + p = get_vdso_symbol ("__kernel_clock_getres"); PTR_MANGLE (p); VDSO_SYMBOL (clock_getres) = p; - p = _dl_vdso_vsym ("__kernel_getcpu", &linux2629); + p = get_vdso_symbol ("__kernel_getcpu"); PTR_MANGLE (p); VDSO_SYMBOL (getcpu) = p; } diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h index 640fb52de1..b780d22d8f 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h @@ -21,6 +21,7 @@ #include #include +#include #include #include /* For RTLD_PRIVATE_ERRNO. */ #include @@ -271,12 +272,6 @@ #define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6) #define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7) -/* 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 HAVE_GETCPU_VSYSCALL 1 - /* 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/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h index 9a9834c750..07cfa64cab 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h @@ -22,6 +22,7 @@ #include #include +#include #include #include /* For RTLD_PRIVATE_ERRNO. */ #include @@ -277,12 +278,6 @@ #define ASMFMT_5 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6) #define ASMFMT_6 , "0" (gpr2), "d" (gpr3), "d" (gpr4), "d" (gpr5), "d" (gpr6), "d" (gpr7) -/* 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 HAVE_GETCPU_VSYSCALL 1 - #define SINGLE_THREAD_BY_GLOBAL 1 /* Pointer mangling support. */ diff --git a/sysdeps/unix/sysv/linux/s390/sysdep.h b/sysdeps/unix/sysv/linux/s390/sysdep.h new file mode 100644 index 0000000000..eefbd8f007 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/sysdep.h @@ -0,0 +1,27 @@ +/* Syscall definitions, Linux PowerPC generic version. + Copyright (C) 2000-2019 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 + . */ + +#define VDSO_NAME "LINUX_2_6_29" +#define VDSO_HASH 123718585 + +/* 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 HAVE_GETCPU_VSYSCALL 1 + diff --git a/sysdeps/unix/sysv/linux/sparc/init-first.c b/sysdeps/unix/sysv/linux/sparc/init-first.c index 643d6c7c88..bdaa78fd32 100644 --- a/sysdeps/unix/sysv/linux/sparc/init-first.c +++ b/sysdeps/unix/sysv/linux/sparc/init-first.c @@ -28,13 +28,11 @@ long int (*VDSO_SYMBOL (clock_gettime)) (clockid_t, struct timespec *) static inline void _libc_vdso_platform_setup (void) { - PREPARE_VERSION_KNOWN (linux_version, LINUX_2_6); - - void *p = _dl_vdso_vsym ("__vdso_gettimeofday", &linux_version); + void *p = get_vdso_symbol ("__vdso_gettimeofday"); PTR_MANGLE (p); VDSO_SYMBOL (gettimeofday) = p; - p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux_version); + p = get_vdso_symbol ("__vdso_clock_gettime"); PTR_MANGLE (p); VDSO_SYMBOL (clock_gettime) = p; } diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sysdep.h index 981b2a26b7..3bfb1fc60e 100644 --- a/sysdeps/unix/sysv/linux/sparc/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sysdep.h @@ -41,6 +41,9 @@ _ret; \ }) +# define VDSO_NAME "LINUX_2_6" +# define VDSO_HASH 61765110 + /* List of system calls which are supported as vsyscalls. */ # define HAVE_CLOCK_GETTIME_VSYSCALL 1 # define HAVE_GETTIMEOFDAY_VSYSCALL 1 diff --git a/sysdeps/unix/sysv/linux/x86/gettimeofday.c b/sysdeps/unix/sysv/linux/x86/gettimeofday.c index 8886ccd707..3ceab633e5 100644 --- a/sysdeps/unix/sysv/linux/x86/gettimeofday.c +++ b/sysdeps/unix/sysv/linux/x86/gettimeofday.c @@ -22,6 +22,8 @@ # include # include +# include +# include static int __gettimeofday_syscall (struct timeval *tv, struct timezone *tz) @@ -36,12 +38,12 @@ __gettimeofday_syscall (struct timeval *tv, struct timezone *tz) # define __gettimeofday_type __gettimeofday # endif -# undef INIT_ARCH -# define INIT_ARCH() PREPARE_VERSION_KNOWN (linux26, LINUX_2_6) +# define INIT_ARCH() + /* If the vDSO is not available we fall back to syscall. */ libc_ifunc_hidden (__gettimeofday_type, __gettimeofday, - (_dl_vdso_vsym ("__vdso_gettimeofday", &linux26) - ?: &__gettimeofday_syscall)) + (get_vdso_symbol ("__vdso_gettimeofday") + ?: __gettimeofday_syscall)); libc_hidden_def (__gettimeofday) #else diff --git a/sysdeps/unix/sysv/linux/x86/time.c b/sysdeps/unix/sysv/linux/x86/time.c index 3d72488500..60e6d1b7c0 100644 --- a/sysdeps/unix/sysv/linux/x86/time.c +++ b/sysdeps/unix/sysv/linux/x86/time.c @@ -22,6 +22,7 @@ #include #include +#include static time_t __time_syscall (time_t *t) @@ -38,11 +39,11 @@ __time_syscall (time_t *t) # endif #undef INIT_ARCH -#define INIT_ARCH() PREPARE_VERSION_KNOWN (linux26, LINUX_2_6); +#define INIT_ARCH() + /* If the vDSO is not available we fall back on the syscall. */ libc_ifunc_hidden (time_type, time, - (_dl_vdso_vsym ("__vdso_time", &linux26) - ?: &__time_syscall)) + (get_vdso_symbol ("__vdso_time") ?: __time_syscall)) libc_hidden_def (time) #else diff --git a/sysdeps/unix/sysv/linux/x86_64/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c index 85333e5ff3..aede1c858d 100644 --- a/sysdeps/unix/sysv/linux/x86_64/init-first.c +++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c @@ -32,15 +32,13 @@ extern __typeof (clock_gettime) __syscall_clock_gettime attribute_hidden; static inline void __vdso_platform_setup (void) { - PREPARE_VERSION_KNOWN (linux26, LINUX_2_6); - - void *p = _dl_vdso_vsym ("__vdso_clock_gettime", &linux26); + void *p = get_vdso_symbol ("__vdso_clock_gettime"); if (p == NULL) p = __syscall_clock_gettime; PTR_MANGLE (p); VDSO_SYMBOL(clock_gettime) = p; - p = _dl_vdso_vsym ("__vdso_getcpu", &linux26); + p = get_vdso_symbol ("__vdso_getcpu"); PTR_MANGLE (p); VDSO_SYMBOL(getcpu) = p; } diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h index 0a3ddd37e1..197329f4dc 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -370,6 +370,9 @@ # undef INTERNAL_SYSCALL_ERRNO # define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) +# define VDSO_NAME "LINUX_2.6" +# define VDSO_HASH 61765110 + /* List of system calls which are supported as vsyscalls. */ # define HAVE_CLOCK_GETTIME_VSYSCALL 1 # define HAVE_GETTIMEOFDAY_VSYSCALL 1