From patchwork Fri Jun 14 15:28:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 166829 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2200785ilk; Fri, 14 Jun 2019 08:29:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxnDLpRU0zOQ+HhspoHsszKkyOwwwM1NyOCA2/NihW8pssJSnScTeHhlsZMBOJb2oJgISyQ X-Received: by 2002:a17:902:9041:: with SMTP id w1mr80666934plz.132.1560526170839; Fri, 14 Jun 2019 08:29:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560526170; cv=none; d=google.com; s=arc-20160816; b=VOKnwKyMkxK26le3B7/PskztsCk+9+NjFUxvNcC2+5w0a7BFZgReuLVDGuAxgOsUko P7taplKKFzQ1FCHym0LihFd0SEHravz3FiO/8ZJzw+yuwe/FPxYFyDnx16+AdyHH2Vbl GkcySiqcuQ5yPPtNyGxIvtU9p5XQJPizh4qDluMULJBn9WTUFTMVI4UeY4kWHPFGOs2t Dm3kXtxhWzI6I0mT8kyxENpHGjRViKIQ6utES//hLxw4OWpy4LqCM/nqnAQM+zfjBZhh szz5D73K9+oV2NS7Mo9sElfM4ePHw8Qva7wxj+P8xCaBXEu8p4OFloo4wxPujq+8lqt+ NG7g== 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=sh4Lsz/b9fl0xLWtmr7mGV/rN3cFaoERP3ybQ5K1W1c=; b=IDNMA7AZ6Tl3aX+My9A+q51bAijb8BmV962+X7q/j+W4gxOWyFWdt+Lp7EX2Lkzlnt CokX5Xkn2V+e1UNC1fxjdA2PEknxFyTUS9cAYZYh0egxKvkKMn+omlHCyS6Ca6ds6ItO 28m+YCjGf9V5W2LzFvzyzOqfx+9zIwacU1cLcswmEwJZ1EsJAcndw7hKAyzviyK7yCDw mbMQlgvz/QahP+Yx4SD9k0KXrYrtB7XqkY4FtDlcckFjMEmRXpfDAcoelUJPExEDUjjf bmXC52wcVLkmIF9qd6tQDUeIp5GYTK7bqWuhvFDhL+c1jiKRduVTqDkKpKNsCgszBcjX RTaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=Fic3FYgv; dkim=pass header.i=@linaro.org header.s=google header.b=SqpwBqlT; spf=pass (google.com: domain of libc-alpha-return-102735-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102735-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 d5si2705263pjo.80.2019.06.14.08.29.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jun 2019 08:29:30 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-102735-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=Fic3FYgv; dkim=pass header.i=@linaro.org header.s=google header.b=SqpwBqlT; spf=pass (google.com: domain of libc-alpha-return-102735-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102735-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=jA/GVTUI1LmQHJt3q5ImOq1A4JnJgYVi0RmGLQ00k9HFZzTLJUp8B B1aesL2VcIg6Z6ZvXvCmxTj7L+q7Va90bgOhm++yD4RCi1aUEs1zMK0YOgIZ3Qmi TZn9Cdkt+hbIv8k7oX66biPPemDY2yjUiizks15yzAunJ0BDN1b7zo= 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=+TAX+JgHOmAtqSuRT0WeYR3fTPo=; b=Fic3FYgvqbn328XmiwfrcND915eO f92LWXkP6mpkScOElLgfMIfY+ynIh4uc/GF++gYma6fl+TWZTPHM7LXjBmXfM17N Lvf8vlir2AQkJHBfc9QOLYPlqrpeas6ZaABE2zT8QMxbicIVwG+CB3/EPVR7MMip 18EXu23BOnmpNC0= Received: (qmail 116754 invoked by alias); 14 Jun 2019 15:29:18 -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 116745 invoked by uid 89); 14 Jun 2019 15:29:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.8 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=respects, Contributed, Maxim, maxim X-HELO: mail-ua1-f67.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=sh4Lsz/b9fl0xLWtmr7mGV/rN3cFaoERP3ybQ5K1W1c=; b=SqpwBqlTly3wGqJZ0v1EsjVa4xck3JBT0/ATnq0GGiHDnzpSDiUtQFVfjV5RnhC99D p8x1H3DkIuoeaTEPYN0VU6oRo4wK8/7Vl0w8WJpGZCblGC76VoVKnu82JFRp6+LpFt0P xlF1ymvG28bXg1IYx9jJexWusfrBcZ4VbTUnZyUr2P4VECp4CiyNza9DFp/eEy9Upl9e t+HGskWgaukohMUhvbX2QlqEoYF7g3MItq2jTkxNCwDs8IgsgD0oOSHTo2P9jcns9f+e f3WJLFbm2tf3/K7W46mW7mXYEkBfKTYUHzouTN0wyA26rHQepQyojynvcOxp9iwzFJfC ZSlA== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 01/12] m68k: Remove vDSO support Date: Fri, 14 Jun 2019 12:28:57 -0300 Message-Id: <20190614152908.8101-1-adhemerval.zanella@linaro.org> Although defined in initial TLS/NPTL ABI for m68k and ColdFire [1], kernel support was never pushed upstream. This patch removes the unused m68k vDSO support. Checked with a build against m68k and m68k-coldfire and some basic tests on ARAnyM. * sysdeps/unix/sysv/linux/m68k/Makefile (sysdep_routines, sysdep-rtld-routines): Remove rules. * sysdeps/unix/sysv/linux/m68k/Versions (libc) [GLIBC_PRIVATE]: Remove __vdso_atomic_cmpxchg_32 and __vdso_atomic_barrier. (ld) [GLIBC_PRIVATE]: __rtld___vdso_read_tp, __rtld___vdso_atomic_cmpxchg_32, and __rtld___vdso_atomic_barrier. * sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h (atomic_compare_and_exchange_val_acq, atomic_full_barrier): Remove vDSO path for SHARED. * sysdeps/unix/sysv/linux/m68k/init-first.c: Remove file. * sysdeps/unix/sysv/linux/m68k/libc-m68k-vdso.c: Likewise. * sysdeps/unix/sysv/linux/m68k/m68k-helpers.S: Likewise. * sysdeps/unix/sysv/linux/m68k/m68k-vdso.c: Likewise. * sysdeps/unix/sysv/linux/m68k/m68k-vdso.h: Likewise. * sysdeps/unix/sysv/linux/m68k/m68k-helpers.c: New file. [1] https://lists.debian.org/debian-68k/2007/11/msg00071.html --- sysdeps/unix/sysv/linux/m68k/Makefile | 2 - sysdeps/unix/sysv/linux/m68k/Versions | 11 --- .../sysv/linux/m68k/coldfire/atomic-machine.h | 45 +-------- sysdeps/unix/sysv/linux/m68k/init-first.c | 74 --------------- sysdeps/unix/sysv/linux/m68k/libc-m68k-vdso.c | 1 - sysdeps/unix/sysv/linux/m68k/m68k-helpers.S | 95 ------------------- sysdeps/unix/sysv/linux/m68k/m68k-helpers.c | 26 +++++ sysdeps/unix/sysv/linux/m68k/m68k-vdso.c | 34 ------- sysdeps/unix/sysv/linux/m68k/m68k-vdso.h | 60 ------------ 9 files changed, 27 insertions(+), 321 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/m68k/init-first.c delete mode 100644 sysdeps/unix/sysv/linux/m68k/libc-m68k-vdso.c delete mode 100644 sysdeps/unix/sysv/linux/m68k/m68k-helpers.S create mode 100644 sysdeps/unix/sysv/linux/m68k/m68k-helpers.c delete mode 100644 sysdeps/unix/sysv/linux/m68k/m68k-vdso.c delete mode 100644 sysdeps/unix/sysv/linux/m68k/m68k-vdso.h -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/m68k/Makefile b/sysdeps/unix/sysv/linux/m68k/Makefile index ce1f696a6f..be40fae68a 100644 --- a/sysdeps/unix/sysv/linux/m68k/Makefile +++ b/sysdeps/unix/sysv/linux/m68k/Makefile @@ -18,8 +18,6 @@ endif ifeq ($(subdir),elf) sysdep-dl-routines += dl-static -sysdep_routines += dl-vdso libc-m68k-vdso -sysdep-rtld-routines += m68k-vdso sysdep-others += lddlibc4 install-bin += lddlibc4 endif diff --git a/sysdeps/unix/sysv/linux/m68k/Versions b/sysdeps/unix/sysv/linux/m68k/Versions index 7ecc96ea97..8e72cd18cb 100644 --- a/sysdeps/unix/sysv/linux/m68k/Versions +++ b/sysdeps/unix/sysv/linux/m68k/Versions @@ -40,15 +40,4 @@ libc { GLIBC_2.12 { __m68k_read_tp; } - GLIBC_PRIVATE { - __vdso_atomic_cmpxchg_32; __vdso_atomic_barrier; - } -} - -ld { - GLIBC_PRIVATE { - __rtld___vdso_read_tp; - __rtld___vdso_atomic_cmpxchg_32; - __rtld___vdso_atomic_barrier; - } } diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h b/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h index 7465a98fef..0a2aa9ffa5 100644 --- a/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/atomic-machine.h @@ -21,7 +21,6 @@ #include #include -#include /* Coldfire has no atomic compare-and-exchange operation, but the kernel provides userspace atomicity operations. Use them. */ @@ -43,33 +42,7 @@ typedef uintmax_t uatomic_max_t; #define ATOMIC_EXCHANGE_USES_CAS 1 /* The only basic operation needed is compare and exchange. */ -/* For ColdFire we'll have to trap into the kernel mode anyway, - so trap from the library rather then from the kernel wrapper. */ -#ifdef SHARED -# define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ - ({ \ - /* Use temporary variables to workaround call-clobberness of \ - the registers. */ \ - __typeof (mem) _mem = mem; \ - __typeof (oldval) _oldval = oldval; \ - __typeof (newval) _newval = newval; \ - register uint32_t *_a0 asm ("a0") = (uint32_t *) _mem; \ - register uint32_t _d0 asm ("d0") = (uint32_t) _oldval; \ - register uint32_t _d1 asm ("d1") = (uint32_t) _newval; \ - void *tmp; \ - \ - asm ("movel #_GLOBAL_OFFSET_TABLE_@GOTPC, %2\n\t" \ - "lea (-6, %%pc, %2), %2\n\t" \ - "movel " STR_M68K_VDSO_SYMBOL (__vdso_atomic_cmpxchg_32) \ - "@GOT(%2), %2\n\t" \ - "movel (%2), %2\n\t" \ - "jsr (%2)\n\t" \ - : "+d" (_d0), "+m" (*_a0), "=&a" (tmp) \ - : "a" (_a0), "d" (_d1)); \ - (__typeof (oldval)) _d0; \ - }) -#else -# define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ +#define atomic_compare_and_exchange_val_acq(mem, newval, oldval) \ ({ \ /* Use temporary variables to workaround call-clobberness of \ the registers. */ \ @@ -86,24 +59,8 @@ typedef uintmax_t uatomic_max_t; : "a" (_a0), "d" (_d2), "d" (_d1)); \ (__typeof (oldval)) _d0; \ }) -#endif -#ifdef SHARED -# define atomic_full_barrier() \ - ({ \ - void *tmp; \ - \ - asm ("movel #_GLOBAL_OFFSET_TABLE_@GOTPC, %0\n\t" \ - "lea (-6, %pc, %0), %0\n\t" \ - "movel " STR_M68K_VDSO_SYMBOL (__vdso_atomic_barrier) \ - "@GOT(%0), %0\n\t" \ - "movel (%0), %0\n\t" \ - "jsr (%0)\n\t" \ - : "=&a" (tmp)); \ - }) -#else # define atomic_full_barrier() \ (INTERNAL_SYSCALL (atomic_barrier, , 0), (void) 0) -#endif #endif diff --git a/sysdeps/unix/sysv/linux/m68k/init-first.c b/sysdeps/unix/sysv/linux/m68k/init-first.c deleted file mode 100644 index f8f0910839..0000000000 --- a/sysdeps/unix/sysv/linux/m68k/init-first.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Initialization code run first thing by the ELF startup code. Linux/m68k. - Copyright (C) 2010-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Maxim Kuvyrkov , 2010. - - 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 - . */ - -/* Note: linking in vDSO to a static binary requires changes to - the main GLIBC proper. Not yet implemented. */ -#ifdef SHARED - -#include -#include - -static inline void -_libc_vdso_platform_setup (void) -{ - void *p; - - PREPARE_VERSION (linux26, "LINUX_2.6", 61765110); - - /* It may happen that rtld didn't initialize the vDSO, so fallback - to the syscall implementations if _dl_vdso_vsym returns NULL. - This may happen when a static executable dlopen's a dynamic library. - This really is nothing more than a workaround for rtld/csu - deficiency. Ideally, init code would setup the vDSO for static - binaries too. */ - - p = _dl_vdso_vsym ("__kernel_read_tp", &linux26); - if (p != NULL) - { - __vdso_read_tp = p; - __rtld___vdso_read_tp = p; - } - else - assert (__vdso_read_tp == (void *) __vdso_read_tp_stub); - - p = _dl_vdso_vsym ("__kernel_atomic_cmpxchg_32", &linux26); - if (p != NULL) - { - __vdso_atomic_cmpxchg_32 = p; - __rtld___vdso_atomic_cmpxchg_32 = p; - } - else - assert (__vdso_atomic_cmpxchg_32 - == (void *) __vdso_atomic_cmpxchg_32_stub); - - p = _dl_vdso_vsym ("__kernel_atomic_barrier", &linux26); - if (p != NULL) - { - __vdso_atomic_barrier = p; - __rtld___vdso_atomic_barrier = p; - } - else - assert (__vdso_atomic_barrier == (void *) __vdso_atomic_barrier_stub); -} - -#define VDSO_SETUP _libc_vdso_platform_setup - -#endif /* SHARED */ - -#include diff --git a/sysdeps/unix/sysv/linux/m68k/libc-m68k-vdso.c b/sysdeps/unix/sysv/linux/m68k/libc-m68k-vdso.c deleted file mode 100644 index 45982e99b9..0000000000 --- a/sysdeps/unix/sysv/linux/m68k/libc-m68k-vdso.c +++ /dev/null @@ -1 +0,0 @@ -#include "m68k-vdso.c" diff --git a/sysdeps/unix/sysv/linux/m68k/m68k-helpers.S b/sysdeps/unix/sysv/linux/m68k/m68k-helpers.S deleted file mode 100644 index 5e3ffb0a7f..0000000000 --- a/sysdeps/unix/sysv/linux/m68k/m68k-helpers.S +++ /dev/null @@ -1,95 +0,0 @@ -/* Copyright (C) 2010-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Maxim Kuvyrkov , 2010. - - 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. - - In addition to the permissions in the GNU Lesser General Public - License, the Free Software Foundation gives you unlimited - permission to link the compiled version of this file with other - programs, and to distribute those programs without any restriction - coming from the use of this file. (The GNU Lesser General Public - License restrictions do apply in other respects; for example, they - cover modification of the file, and distribution when not linked - into another program.) - - Note that people who make modified versions of this file are not - obligated to grant this special exception for their modified - versions; it is their choice whether to do so. The GNU Lesser - General Public License gives permission to release a modified - version without this exception; this exception also makes it - possible to release a modified version which carries forward this - exception. - - 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 - . */ - -#include -#include - - .text - - .hidden __vdso_read_tp_stub -ENTRY (__vdso_read_tp_stub) - move.l #__NR_get_thread_area, %d0 - trap #0 - move.l %d0, %a0 - rts -END (__vdso_read_tp_stub) - -# ifdef SHARED -/* GCC will emit calls to this routine. Linux has an - equivalent helper function (which clobbers fewer registers than - a normal function call) in a vdso; tail call to the - helper. */ -# if IS_IN (rtld) -/* rtld gets a hidden copy of __m68k_read_tp. */ - .hidden __m68k_read_tp -# endif -ENTRY (__m68k_read_tp) - LOAD_GOT (%a0) - move.l M68K_VDSO_SYMBOL (__vdso_read_tp)@GOT(%a0), %a0 - move.l (%a0), %a0 - jmp (%a0) -END (__m68k_read_tp) - -/* The following two stubs are for macros in atomic.h, they can't - clobber anything. */ - - .hidden __vdso_atomic_cmpxchg_32_stub -ENTRY (__vdso_atomic_cmpxchg_32_stub) - move.l %d2, -(%sp) - cfi_adjust_cfa_offset (4) - cfi_rel_offset (%d2, 0) - move.l %d0, %d2 - move.l #SYS_ify (atomic_cmpxchg_32), %d0 - trap #0 - move.l (%sp)+, %d2 - cfi_adjust_cfa_offset (-4) - cfi_restore (%d2) - rts -END (__vdso_atomic_cmpxchg_32_stub) - - .hidden __vdso_atomic_barrier_stub -ENTRY (__vdso_atomic_barrier_stub) - move.l %d0, -(%sp) - cfi_adjust_cfa_offset (4) - move.l #SYS_ify (atomic_barrier), %d0 - trap #0 - move.l (%sp)+, %d0 - cfi_adjust_cfa_offset (-4) - rts -END (__vdso_atomic_barrier_stub) -# else /* !SHARED */ -/* If the vDSO is not available, use a syscall to get TP. */ - strong_alias (__vdso_read_tp_stub, __m68k_read_tp) -# endif /* SHARED */ diff --git a/sysdeps/unix/sysv/linux/m68k/m68k-helpers.c b/sysdeps/unix/sysv/linux/m68k/m68k-helpers.c new file mode 100644 index 0000000000..df02d560aa --- /dev/null +++ b/sysdeps/unix/sysv/linux/m68k/m68k-helpers.c @@ -0,0 +1,26 @@ +/* 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 + . */ + +#include + +void * +__m68k_read_tp (void) +{ + INTERNAL_SYSCALL_DECL (err); + return (void*) INTERNAL_SYSCALL_CALL (get_thread_area, err); +} diff --git a/sysdeps/unix/sysv/linux/m68k/m68k-vdso.c b/sysdeps/unix/sysv/linux/m68k/m68k-vdso.c deleted file mode 100644 index a1345a3a5b..0000000000 --- a/sysdeps/unix/sysv/linux/m68k/m68k-vdso.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 2010-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Maxim Kuvyrkov , 2010. - - 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 - . */ - -#ifdef SHARED - -#include - -/* Because these pointers are used from other libraries than libc, - they are exported at GLIBC_PRIVATE version. - We initialize them to syscall implementation so that they will be ready - to use from the very beginning. */ -void * M68K_VDSO_SYMBOL (__vdso_read_tp) -= (void *) __vdso_read_tp_stub; -void * M68K_VDSO_SYMBOL (__vdso_atomic_cmpxchg_32) -= (void *) __vdso_atomic_cmpxchg_32_stub; -void * M68K_VDSO_SYMBOL (__vdso_atomic_barrier) -= (void *) __vdso_atomic_barrier_stub; - -#endif /* SHARED */ diff --git a/sysdeps/unix/sysv/linux/m68k/m68k-vdso.h b/sysdeps/unix/sysv/linux/m68k/m68k-vdso.h deleted file mode 100644 index fc71c0f4e1..0000000000 --- a/sysdeps/unix/sysv/linux/m68k/m68k-vdso.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Resolve function pointers to VDSO functions. - Copyright (C) 2010-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Maxim Kuvyrkov , 2010. - - 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 - . */ - - -#ifndef _M68K_VDSO_H -#define _M68K_VDSO_H - -#ifdef SHARED - -# if IS_IN (rtld) -# define M68K_VDSO_SYMBOL(name) __rtld_##name -# define STR_M68K_VDSO_SYMBOL(name) "__rtld_" #name -# else -# define M68K_VDSO_SYMBOL(name) name -# define STR_M68K_VDSO_SYMBOL(name) #name -# endif - -# ifndef __ASSEMBLER__ - -/* We define __rtld_* copies for rtld. - We need them visible in libc to initialize. */ -# if IS_IN (rtld) || IS_IN (libc) -extern void *__rtld___vdso_read_tp; -extern void *__rtld___vdso_atomic_cmpxchg_32; -extern void *__rtld___vdso_atomic_barrier; - -/* These stubs are meant to be invoked only from the assembly. */ -extern void __vdso_read_tp_stub (void); -extern void __vdso_atomic_cmpxchg_32_stub (void); -extern void __vdso_atomic_barrier_stub (void); -# endif /* IS_IN (rtld) || IS_IN (libc) */ - -/* RTLD should only use its own copies. */ -# if !IS_IN (rtld) -extern void *__vdso_read_tp; -extern void *__vdso_atomic_cmpxchg_32; -extern void *__vdso_atomic_barrier; -# endif /* !IS_IN (rtld) */ - -# endif /* !__ASSEMBLER__ */ - -#endif /* SHARED */ - -#endif /* _M68K_VDSO_H */ From patchwork Fri Jun 14 15:28:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 166830 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2200980ilk; Fri, 14 Jun 2019 08:29:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqxrYaxZ/EOfvE5HxJhVxfsiCCqrO/Dglep23Pg1DalVF07rNwAxkTs9ArbzFH3fZ6mqhSFq X-Received: by 2002:a62:d0:: with SMTP id 199mr67445166pfa.253.1560526179991; Fri, 14 Jun 2019 08:29:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560526179; cv=none; d=google.com; s=arc-20160816; b=agMNtoVN3jXTOmFt5EnqzxOLU99x/xyiBnl5I7WXPewtDc9apX8nKh0z3l+eq/6vPO B6L+hOcmiwXEPOodZAgCVZ32t50HJs6yWgTiWev+X5XhArZlVxNrOv9VT2gsZaQ1ZB8b bYbM62KqFqvgQmf3KsGP4qj470co1vvDav/MIHqyIb2Lt6ZAlERDlThXMi2qL8oXEH+6 hjv/2lszYCAv+TWz95mtNJRrF5AQN+3pDoO3V3sIubF0hZhl3nGyyNRivYrnCFnI+zME 8LDANA7E+gXn1K7ya3whUzLi/XV+hmjTr8qyCi7foDBUKmaGCRfrhuB0fRyNSM6adLbh yf2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to: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=Qb081wnbH1reaEliqBrnt5t6jRPvLqb/xuNtp32baTg=; b=VdItpcg30uQeEz8XTS6zSdOVY0WB/Y2IemOdetSJf3F9MWnDNuH0qk4ij2fl2aFtGM c/khzEdou5sYEwlIY4t4jeevzl1ePT76/or8BIoss24Ej3YRUMrdKJy2BD5X9JyrCAkw WRJxN/E81llGcFv2ZDNepBzQ7YA6MhAXnboYP/Dnkl5bT9Q4bnlZdZhckuexmPmwUEf5 EXBhPxYuHStpiZGRFs5WpzpqOUhmLnPUi4FOsKX0Pn3qHDphJcCUK0WeLkyPsoL2IDXK d8hVcEWekhV0f2lckg0gOWXduS6FB/9qhWyeuQPrRfsGzBv34XlqWTC3EkvLio9yXcVJ Ruag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=gzMebXb7; dkim=pass header.i=@linaro.org header.s=google header.b=pp0x9a72; spf=pass (google.com: domain of libc-alpha-return-102736-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102736-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 o24si2597577pll.280.2019.06.14.08.29.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jun 2019 08:29:39 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-102736-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=gzMebXb7; dkim=pass header.i=@linaro.org header.s=google header.b=pp0x9a72; spf=pass (google.com: domain of libc-alpha-return-102736-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102736-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:in-reply-to :references; q=dns; s=default; b=kRtkbJbBaPXbCe+K/4pxgD+3VDt7Uwo Z2AfakJK4QF7s5zCm4FtoNbxpqL3UwyTlhVeJDuLpXGO9EFrmASadcef2wuunJR3 Vltcjb2GxAI3U9bH7LG+uE4+9V14CRCGL0m27L3sa50n/wRZGps7Z8FjOloBwvnr mKgSoqSJGy88= 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:in-reply-to :references; s=default; bh=hhhmMqB1vT7jLa6t7mLRGOtXmS0=; b=gzMeb Xb7gnfvkaUD9JHsAwsI+jZrMw89A24sbHIVmdds6t2p4L0big9NOpVv9+abVsLks 8q1Vs80S31TXbt4mE5YvwbYTls0mix+2aNFxQnwI7aWXGePp/VyA5TuN9mQ0nlTv pb/9d0xXTOlZ2He8OzYLBGdMjNcfPVUQzVj8ds= Received: (qmail 116877 invoked by alias); 14 Jun 2019 15:29:20 -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 116793 invoked by uid 89); 14 Jun 2019 15:29:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.8 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= X-HELO: mail-ua1-f65.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=Qb081wnbH1reaEliqBrnt5t6jRPvLqb/xuNtp32baTg=; b=pp0x9a72dh09FODiJpCzyk1Z9D2TF8pWQxJQ0o1os2wSXNBDVxnyRH+JyHmBGV4WuG zyJmp7zUt4ovtAZ+yE5tmKqTwnPPUo6TqKLIG2jQBTRXcPsUqc8x4+0M3eC/jUZauRhe No/1sBrd6Ge/nIQLz3R5fLG6wYQESC1rjNozEcpKRnTg7JpUT+eZQdAtdUC2hKO7d/JI O9Y3GJ205dvu75rIXQzrVxsnUFW+jrVkNQlNxNlD9VnFYmrD6dfkzdUlf3tWYyHm0cCL WO1DIWKu6EC6L7uTtQS/POhj8iLiqE7r37kh1QX+LcTDQmkc473MYAJqpF2aG9M1esYr hLeA== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 02/12] riscv: Enable VDSO for static linking Date: Fri, 14 Jun 2019 12:28:58 -0300 Message-Id: <20190614152908.8101-2-adhemerval.zanella@linaro.org> In-Reply-To: <20190614152908.8101-1-adhemerval.zanella@linaro.org> References: <20190614152908.8101-1-adhemerval.zanella@linaro.org> Checked on riscv64-linux-gnu-rv64imafdc-lp64d qemu system with some static tests. [BZ #19767] * sysdeps/unix/sysv/linux/riscv/init-first.c: Remove #ifdef SHARED. * sysdeps/unix/sysv/linux/riscv/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/riscv/sysdep.h (ALWAYS_USE_VSYSCALL): Define. --- sysdeps/unix/sysv/linux/riscv/init-first.c | 8 +++----- sysdeps/unix/sysv/linux/riscv/libc-vdso.h | 6 +----- sysdeps/unix/sysv/linux/riscv/sysdep.h | 3 +++ 3 files changed, 7 insertions(+), 10 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/riscv/init-first.c b/sysdeps/unix/sysv/linux/riscv/init-first.c index 8134c79695..98a8ce33ad 100644 --- a/sysdeps/unix/sysv/linux/riscv/init-first.c +++ b/sysdeps/unix/sysv/linux/riscv/init-first.c @@ -17,9 +17,8 @@ License along with the GNU C Library; if not, see . */ -#ifdef SHARED -# include -# include +#include +#include long int (*VDSO_SYMBOL (getcpu)) (unsigned int *, unsigned int *, void *) attribute_hidden; @@ -52,7 +51,6 @@ _libc_vdso_platform_setup (void) VDSO_SYMBOL (clock_getres) = p; } -# define VDSO_SETUP _libc_vdso_platform_setup -#endif +#define VDSO_SETUP _libc_vdso_platform_setup #include diff --git a/sysdeps/unix/sysv/linux/riscv/libc-vdso.h b/sysdeps/unix/sysv/linux/riscv/libc-vdso.h index b0c46f3cb7..2373292ab9 100644 --- a/sysdeps/unix/sysv/linux/riscv/libc-vdso.h +++ b/sysdeps/unix/sysv/linux/riscv/libc-vdso.h @@ -20,9 +20,7 @@ #ifndef _LIBC_VDSO_H #define _LIBC_VDSO_H -#ifdef SHARED - -# include +#include extern long int (*VDSO_SYMBOL (getcpu)) (unsigned int *, unsigned int *, void *) attribute_hidden; @@ -33,6 +31,4 @@ extern long int (*VDSO_SYMBOL (clock_gettime)) (clockid_t, struct timespec *) extern long int (*VDSO_SYMBOL (clock_getres)) (clockid_t, struct timespec *) attribute_hidden; -#endif - #endif /* _LIBC_VDSO_H */ diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h index 5470ea3d2a..caf013a9a1 100644 --- a/sysdeps/unix/sysv/linux/riscv/sysdep.h +++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h @@ -19,6 +19,9 @@ #ifndef _LINUX_RISCV_SYSDEP_H #define _LINUX_RISCV_SYSDEP_H 1 +/* Always enable vsyscalls on riscv */ +#define ALWAYS_USE_VSYSCALL 1 + #include #include From patchwork Fri Jun 14 15:28:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 166832 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2201327ilk; Fri, 14 Jun 2019 08:29:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwUwvEl2ygHc6d3H8WOvTI3CyEF4uGLUK/YOdhg90UO1ssxtHGBamLfb3J9mvyXGO9cf1c4 X-Received: by 2002:a62:1c92:: with SMTP id c140mr99603525pfc.258.1560526197221; Fri, 14 Jun 2019 08:29:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560526197; cv=none; d=google.com; s=arc-20160816; b=r1uDS+sN09gP2maNsZ2IKGpTlr6O7r51In3YQGkw+7cJ0rnTL92KnIzKLCNRxjnFhZ sfFJiDQbosqg5EYHBaCRER5HU8ipZIMcKhtw/76qHsQThx3UjUoLvq3eSV0HuPyi9f7x wfFIL0mAdAvbLQ437bbpxJJ9SSZxaudchzoyMiJv+GQ8iZkCR/CXNjg1nFJFL3oyxvAS NS3QwFvDRekCRj909QUaV/3h0XFZcPMHN+jC/W0D/doVIN96ZUjtF9skQOnJ9fkJVQAd N05X67MgCORZwDPdanjxnvVW99PFROxIY3gGNshV5CmiqEyHkEe5liYFUBO9hkijd6tg 1oTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to: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=skMkSn123M8HodGMEX6t/aWbaEts2+lujxKyQYG0Pks=; b=D4LOoSslb59Mb6FU8U34YqkGx7nCCKbsFFMpzUSv5YisMs7fuImnVInsCC/no3D5Nd XVzlvciIGurJk6ur6W9mUiGBCqC6V4nET7Im3r84S9n8Z80yBiCk6FuBPn/m1V/eGXTI 9Dy3VMIcIMc6FZYLL6ats4mcMLZKzB1E2n8T67NLnLh1irdjy3/KpSwbsXg7Tg1wvq2r zPpYhTvdOmeQYAiXUnMLdXXxnhchJBrBI0ZC6lQzpBP++36FerCgfwTCfQ9b/SllR2Do sqjmPwNMloQaQnF3bvUZ4KR3unlGwn25sR/Hm7ibg/n5KZsCHtedotbzHQfWwTRTEunR DnAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=AM8nlGLq; dkim=pass header.i=@linaro.org header.s=google header.b=BOdXIuz7; spf=pass (google.com: domain of libc-alpha-return-102738-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102738-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 d62si2937541pga.447.2019.06.14.08.29.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jun 2019 08:29:57 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-102738-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=AM8nlGLq; dkim=pass header.i=@linaro.org header.s=google header.b=BOdXIuz7; spf=pass (google.com: domain of libc-alpha-return-102738-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102738-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:in-reply-to :references; q=dns; s=default; b=ClXWlF4Hi9CzOxrwq7K8o4hsDUtiY2p hvqcOG2g7poOucSMEg3G9EDJ/N9PEj43aHWZvdmYjQUSuMD1rY9e85dLk2dBlOcX 4VdEFTrKpSRGVRxG3KDZn3w2F9Njf/M6v59EO1jZdqv07OEOuZ4libRsEc1/+ZdZ LId0YKM4JX8Q= 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:in-reply-to :references; s=default; bh=y4LZ9uF+9AC2HyCsJYMBpnusKFc=; b=AM8nl GLqghN4y995o6KLZcULvTwKJ3CE4MQpK2t1hkrD+hOoUUIoniV5WQPuUk81F4vFC Vd/yArkJKhQ8CotjdSbsCN+L1wcGjH9//qMLFH47Fv7OM94MObyT+uYLpdwKHUf2 i0IQOSzppSekoMU7pdT6ZtPjNWChBZGBaj8QPI= Received: (qmail 116997 invoked by alias); 14 Jun 2019 15:29:20 -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 116851 invoked by uid 89); 14 Jun 2019 15:29:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.4 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, RCVD_IN_JMF_BR, SPF_PASS autolearn=ham version=3.3.1 spammy=31, 5 X-HELO: mail-vs1-f66.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=skMkSn123M8HodGMEX6t/aWbaEts2+lujxKyQYG0Pks=; b=BOdXIuz7yf4DONZL/m1BeNORyQ647JOiJW5MHtOzCmhiGKNmR4D0OG5La3Yi2kzVqr P10F3zS8Q1JAqQycmsH0MfiW3f7neDcP6a5c0vHAbB+7cptre53WxjvU/htdbecyt2G+ kz1sZmn72ZlTDGZ6iJvhnQGh/0q4vyjK86XwljemLovqN+bRdwpl2cmn+zHOecXDnA7y JFj/5UAL9T1YtVJmSWpU2MxLS1jyQ+Rotzq4CH7WaTjmdo1iktiqeoSe5D1vc/gW1g/s zIced2o33bvJmFcEJGtFg2Y7IXmn08/h93aKaP9AUL1UABTkWLljFD0DNf4CDmt4qDkJ 8A1Q== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 03/12] s390: Enable VDSO for static linking Date: Fri, 14 Jun 2019 12:28:59 -0300 Message-Id: <20190614152908.8101-3-adhemerval.zanella@linaro.org> In-Reply-To: <20190614152908.8101-1-adhemerval.zanella@linaro.org> References: <20190614152908.8101-1-adhemerval.zanella@linaro.org> Although s390 explicit does not enable vDSO for binaries without (arch/s390/kernel/vdso.c:217), there is no indication in the code the rationale for disabling it. In fact, I rebuilt a kernel with the check removed and the vDSO does work for static build for supplied symbols. Checked on s390x-linux-gnu. [BZ #19767] * sysdeps/unix/sysv/linux/s390/init-first.c: Remove #ifdef SHARED. * sysdeps/unix/sysv/linux/s390/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h (ALWAYS_USE_VSYSCALL): Define. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. --- sysdeps/unix/sysv/linux/s390/init-first.c | 8 ++------ sysdeps/unix/sysv/linux/s390/libc-vdso.h | 3 --- sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h | 3 +++ sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 4 ++++ 4 files changed, 9 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/s390/init-first.c b/sysdeps/unix/sysv/linux/s390/init-first.c index 71dd43f738..847977c0d9 100644 --- a/sysdeps/unix/sysv/linux/s390/init-first.c +++ b/sysdeps/unix/sysv/linux/s390/init-first.c @@ -16,9 +16,8 @@ License along with the GNU C Library; if not, see . */ -#ifdef SHARED -# include -# include +#include +#include long int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *) attribute_hidden; @@ -54,7 +53,4 @@ _libc_vdso_platform_setup (void) VDSO_SYMBOL (getcpu) = p; } -# define VDSO_SETUP _libc_vdso_platform_setup -#endif - #include diff --git a/sysdeps/unix/sysv/linux/s390/libc-vdso.h b/sysdeps/unix/sysv/linux/s390/libc-vdso.h index 5e2d1e4b3f..cc97601383 100644 --- a/sysdeps/unix/sysv/linux/s390/libc-vdso.h +++ b/sysdeps/unix/sysv/linux/s390/libc-vdso.h @@ -20,8 +20,6 @@ #ifndef _LIBC_VDSO_H #define _LIBC_VDSO_H -#ifdef SHARED - #include extern long int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *) @@ -33,6 +31,5 @@ extern long int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *); extern long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *) attribute_hidden; -#endif #endif /* _LIBC_VDSO_H */ diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h index 640fb52de1..47d1c5cdb2 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h @@ -19,6 +19,9 @@ #ifndef _LINUX_S390_SYSDEP_H #define _LINUX_S390_SYSDEP_H +/* Always enable vsyscalls on s390-32. */ +#define ALWAYS_USE_VSYSCALL 1 + #include #include #include diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h index 9a9834c750..95829390e2 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h @@ -20,6 +20,10 @@ #ifndef _LINUX_S390_SYSDEP_H #define _LINUX_S390_SYSDEP_H +/* Always enable vsyscalls on s390-64. */ +#define ALWAYS_USE_VSYSCALL 1 + + #include #include #include From patchwork Fri Jun 14 15:29:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 166831 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2201149ilk; Fri, 14 Jun 2019 08:29:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqzReQw646iyB+MraHcGZ5sPqFd9U7pgC32TQkjbKu/Lm3tqKL8ScRSHZuKBOebO26jCqDMY X-Received: by 2002:a65:668e:: with SMTP id b14mr32058101pgw.407.1560526188264; Fri, 14 Jun 2019 08:29:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560526188; cv=none; d=google.com; s=arc-20160816; b=R2n3fucmFDcx9grpPMp2luU/i8kTZgw+5EkI3lXEpRB+cimdwqSLtBI6Edy/xgWslP GMYaDKDQEG2OxAbC5M8qqO6oCxuRSeVqkvo/O7rTGQ8KzDO5V/15bTvdHlqVa4/9zfra xFDlTcx8Crl8yg3YQs0SFaTTg5GrPovV6UZUK7GBWQatE7mX+k91v5vh2In5iXE0ByAi 42YyZMEEpGtlKSaMA5oXNQngr7XK9wgwZXqthen98/3QCEgXAy7JkwA+d1DW/dz6SLmQ PO1/JFVx1fjfej8OQb5C+7JIkOxgXNWmNoD4rZQM6uaPmv5Xj/cEObdTaUpLFevy//ZS WICw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to: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=N7oA40s05WMR/xv+6FK6Kn/WtyYR12O0c9ArRQALLGs=; b=bbL+wBZsTvJInooldZShvvVrt1fErWDtDxxCKNENNyLSIX8ABPdhzx3oHX1DNIM9FQ 6WN0RIfmpl3Gs2TxFxzQS9EDL3h9r3apZgNBvhF/WNLmgOAKgNl6rszbnxTtLsDAh6xl q36+bFyG0irObGBVUVekDJ6bvBxtfGa0gxuLpSAEF2NON5HpqhT9eAJ89W1nVDAuRkPI ktxvgnbg1azRjTjpndb7UciPr4EMs5rVBsg6gMAiKWq5uT2fZMNh/06ffdN0PCiu2uUa M/Oa9x4tP5HXYK1JNVApUcN5VqDmJN5jIP7eOX/wukTa9eh+OkPqGf8ZfFvjLkapgokH dL7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=NBG2XsWx; dkim=pass header.i=@linaro.org header.s=google header.b=NQw5sizp; spf=pass (google.com: domain of libc-alpha-return-102737-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102737-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 g125si2682709pfb.232.2019.06.14.08.29.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jun 2019 08:29:48 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-102737-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=NBG2XsWx; dkim=pass header.i=@linaro.org header.s=google header.b=NQw5sizp; spf=pass (google.com: domain of libc-alpha-return-102737-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102737-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:in-reply-to :references; q=dns; s=default; b=PZTMokWh+8wcGNjJmQ7Fe6Cn2NbzOsg 83gdJxSGworVqE1b7GVH6pNCVoEtYeVf9vyrD9k5wuJH8Pvi49rzfXQDbwaUkNKr +g+BexZwkiASzouq4K6PRGguq1RXxNhW7lHIaL9gPdMUUKvw9kDxleZWvIgDOi+P jIp02zzJ8pmo= 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:in-reply-to :references; s=default; bh=sbkwnyNxAc1OmuiGqfm5TyDlKLs=; b=NBG2X sWxnR+Jp/9GZdy8sddfJTGV8AvOGhpMgrlN8rVs49hRFv7tybFPMv/digwwJtm8B NlTz2QPGrXmueADLqey0ZSKB+fhCe7e6kcosLKt6UdZJL59uAWMy+W1xFLQnjCug AAhKkyK2NR/VeeD7EK3Ho4HrJoY/zO3RUoLWKc= Received: (qmail 116945 invoked by alias); 14 Jun 2019 15:29:20 -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 116847 invoked by uid 89); 14 Jun 2019 15:29:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.4 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, RCVD_IN_JMF_BR, SPF_PASS autolearn=ham version=3.3.1 spammy=2014 X-HELO: mail-vs1-f66.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=N7oA40s05WMR/xv+6FK6Kn/WtyYR12O0c9ArRQALLGs=; b=NQw5sizpWftPQCqhUXWGb4+TQfvFaMeMBjXaQ0Y8RbVTxh6fyoGvxq8i3YAyCABzaj 5HFJrAT6c2nbljpQXCWgCADXod/vnxsy66I30syU5UcqhsJ61uGVqr1xqfNu9bygiFwK tHQYtmQviC81i8TVla5tKDD3MUvbiWn6+vxTIwPrTPrcG9yn6XdkSXoiIaKfAAKDyYsU J4x2dkgTRRe9mOW9NBD5bvry0hscd4I8x84i10rc9fKYXnbLsSTQZgVlw0w60tXVVRXm SBlR6aYB1mWYwamfroL73QTI7ycqtTawB8i3JSBECLni4JKo4Yqara8eBGwyRAZhCnBw 4hlw== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 04/12] sparc: Enable VDSO for static linking Date: Fri, 14 Jun 2019 12:29:00 -0300 Message-Id: <20190614152908.8101-4-adhemerval.zanella@linaro.org> In-Reply-To: <20190614152908.8101-1-adhemerval.zanella@linaro.org> References: <20190614152908.8101-1-adhemerval.zanella@linaro.org> Checked on sparc64-linux-gnu and sparcv9-linux-gnu. [BZ #19767] * sysdeps/unix/sysv/linux/sparc/init-first.c: Remove #ifdef SHARED. * sysdeps/unix/sysv/linux/sparc/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep.h (ALWAYS_USE_VSYSCALL): Define. --- sysdeps/unix/sysv/linux/sparc/init-first.c | 8 +++----- sysdeps/unix/sysv/linux/sparc/libc-vdso.h | 6 +----- sysdeps/unix/sysv/linux/sparc/sysdep.h | 3 +++ 3 files changed, 7 insertions(+), 10 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/sparc/init-first.c b/sysdeps/unix/sysv/linux/sparc/init-first.c index de83321713..643d6c7c88 100644 --- a/sysdeps/unix/sysv/linux/sparc/init-first.c +++ b/sysdeps/unix/sysv/linux/sparc/init-first.c @@ -17,9 +17,8 @@ License along with the GNU C Library; if not, see . */ -#ifdef SHARED -# include -# include +#include +#include long int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *) attribute_hidden; @@ -40,7 +39,6 @@ _libc_vdso_platform_setup (void) VDSO_SYMBOL (clock_gettime) = p; } -# define VDSO_SETUP _libc_vdso_platform_setup -#endif +#define VDSO_SETUP _libc_vdso_platform_setup #include diff --git a/sysdeps/unix/sysv/linux/sparc/libc-vdso.h b/sysdeps/unix/sysv/linux/sparc/libc-vdso.h index 4009b00a28..d20afcdf04 100644 --- a/sysdeps/unix/sysv/linux/sparc/libc-vdso.h +++ b/sysdeps/unix/sysv/linux/sparc/libc-vdso.h @@ -20,14 +20,10 @@ #ifndef _LIBC_VDSO_H #define _LIBC_VDSO_H -#ifdef SHARED - -# include +#include extern long int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *) attribute_hidden; extern long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *); -#endif - #endif /* _LIBC_VDSO_H */ diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sysdep.h index 981b2a26b7..fc4053c5ce 100644 --- a/sysdeps/unix/sysv/linux/sparc/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sysdep.h @@ -19,6 +19,9 @@ #ifndef _LINUX_SPARC_SYSDEP_H #define _LINUX_SPARC_SYSDEP_H 1 +/* Always enable vsyscalls on sparc */ +#define ALWAYS_USE_VSYSCALL 1 + #include #include #include From patchwork Fri Jun 14 15:29:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 166833 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2201478ilk; Fri, 14 Jun 2019 08:30:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqwmETnFuNOUQpEa33AYbWxzTZw2lfSwIRfAlB48V+n3/4sNr/0bW1JOJujkE8bagt68INfe X-Received: by 2002:a17:902:102c:: with SMTP id b41mr43973825pla.204.1560526206374; Fri, 14 Jun 2019 08:30:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560526206; cv=none; d=google.com; s=arc-20160816; b=JE3/mBjAEYPH0zbr0KJ/OzhoCO/Z+ykjEGJMWzrhYeg0GUAYUzlNSiYHcRCrg+xU+d BratpsyxWQgzj09Di8kfD5zOqN3A0ds/cFkvTgzjO2WD8totWZsL+bbbAaMpYPzQKkXv aFiIW4HAG9CtAhSi5scxijYnce9vxwEzgeT/mXoJqNEPtG3hDg8lWLgy3U6MY1bmoAKy kLUpbld7dtTXgi/FRA1lR1Fv6iW1lJlt/8lYQEUu4MJWqSIb3hfd2WItXABgbLKNakz4 Pd3/hf5BJt8xF583akUv3wxQdHccF1nmKHSYWE0w5KkLWnssLu3Gn0HBsw4y0EieWKfp g/yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to: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=KMgrf5mx/++GprQAsHjwJCFEts05M6cYA+iI29jf3pY=; b=ORTiX3hVdqI90umoPzO4XU0fai4m6yaX8do2/9ElNwzcZK/kqOp2AWqF/+U0P60jLt 0eUyXH/I2beXIvcwFFNZ/RDLT/vsuYJ0bRUDqkIRcIb8+40zh+bjt6Bq7WswmD6WAFdi EB4gsEEs1RqU8xsrlAoTwQG5ycIkUe6zZJDNxW5EFdcyWZpLc0IT1KnQcC479pHJLrvr 2xcooy0yYQwqD61IUkqQ8oMz8u/SFJGEkicOZTmpGY0Xl4HzNSXIJ/DGJ5LPmXgRRtND Ly0s6VAEFcQDx3g9sTTyMMcyvJyf7LMCiDF5ymBIpRllSQ25Dj8NXRxVLfHGOWEOlMla 4tJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=wAWX7gLr; dkim=pass header.i=@linaro.org header.s=google header.b=PI7OVM9N; spf=pass (google.com: domain of libc-alpha-return-102739-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102739-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 p125si2839567pfp.35.2019.06.14.08.30.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jun 2019 08:30:06 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-102739-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=wAWX7gLr; dkim=pass header.i=@linaro.org header.s=google header.b=PI7OVM9N; spf=pass (google.com: domain of libc-alpha-return-102739-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102739-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:in-reply-to :references; q=dns; s=default; b=JrOFhbin7dFVGIh7d5+sV1f8I0Vuzla uMkfCtSIbzcbFPNJAJrk3bmS9oPgnshOqFugw4zvI/aiVIu0yqP5yaFSMx256p5P Ws4WGt9IROtyQk/M5Hw7gYm5mVtMh8UumS6UNiBrPDhp0aaH6Nbum7obPXbd1REF qYe8kbGOGqpg= 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:in-reply-to :references; s=default; bh=V+C6iwEy94CtHXlwhL6GdAlOgb4=; b=wAWX7 gLrRjnV8P39aq9UzVRdgSfpD5mpXLECZb129p6gatBEUJqj7roQ9a7X5/Uv8KF1F 3N8hpc/7lFzzpxsuATuFaC+D/ewKpSIsSVIsbBKlSYyPgoJBFU4o/yqxxKd6aHVP CG/WVTKa878Txp2yAdykVdTx3scoQ9dqonnnYc= Received: (qmail 117205 invoked by alias); 14 Jun 2019 15:29:21 -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 117091 invoked by uid 89); 14 Jun 2019 15:29:21 -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, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=timeh, UD:time.h, time.h X-HELO: mail-vs1-f67.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=KMgrf5mx/++GprQAsHjwJCFEts05M6cYA+iI29jf3pY=; b=PI7OVM9NdyOVDJFW+VwcKMz4sTCcvKo1+uwTEC6QEDx9Z9El22ZI6kA2hzdqOK9NYe 1AifNnu2f49XxxELib+nrqFdsX1W2QJV9Mu5rDkzgFsYEAl/PB+7XF7uOpm2ZcDPUV8i iZFTa8Wbp0TJXL7ohec3cgwzd1VLgvIcO2sBsK9J5xhxunoKitCTcfCR2l/zabcfMyVp j8sZJiPH4hT/7/s0diAfkqjEtR13y+Ggur828w3zv1zsXMdTUFDJw6lvoPkprI3RTGJ/ Y/EAgK1T1mflhcpCt0qCJeHowxYBQLWA/+2KsYi4hBWKcxTZg7vQ8gMY5xEO0c60AGlC wZNA== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 05/12] linux: Enable vDSO for static linking as default (BZ#19767) Date: Fri, 14 Jun 2019 12:29:01 -0300 Message-Id: <20190614152908.8101-5-adhemerval.zanella@linaro.org> In-Reply-To: <20190614152908.8101-1-adhemerval.zanella@linaro.org> References: <20190614152908.8101-1-adhemerval.zanella@linaro.org> This patch assumes static vDSO is supported as default, it is now supported on all current architectures that support vDSO. It allows removing both ALWAYS_USE_VSYSCALL define, which an architecture requires to explicit define and USE_VSYSCALL (which defines vDSO only for shared or if architecture defines ALWAYS_USE_VSYSCALL). Checked with a build against all affected ABIs. [BZ #19767] * sysdeps/unix/sysv/linux/aarch64/sysdep.h (ALWAYS_USE_VSYSCALL): Remove definition. * sysdeps/unix/sysv/linux/arm/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/i386/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/riscv/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h (ALWAYS_USE_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/x86/libc-vdso.h: Remove #if USE_VSYSCALL. * sysdeps/unix/sysv/linux/sysdep-vdso.h: Likewise. * sysdeps/unix/sysv/linux/sysdep.h (ALWAYS_USE_VSYSCALL, USE_VSYSCALL): Remove defitions. --- sysdeps/unix/sysv/linux/aarch64/sysdep.h | 3 --- sysdeps/unix/sysv/linux/arm/sysdep.h | 3 --- sysdeps/unix/sysv/linux/i386/sysdep.h | 3 --- sysdeps/unix/sysv/linux/mips/mips32/sysdep.h | 3 --- sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h | 3 --- sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h | 3 --- sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h | 3 --- sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h | 3 --- sysdeps/unix/sysv/linux/riscv/sysdep.h | 3 --- sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h | 3 --- sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 4 ---- sysdeps/unix/sysv/linux/sparc/sysdep.h | 3 --- sysdeps/unix/sysv/linux/sysdep-vdso.h | 2 +- sysdeps/unix/sysv/linux/sysdep.h | 7 ------- sysdeps/unix/sysv/linux/x86/libc-vdso.h | 6 +----- sysdeps/unix/sysv/linux/x86_64/sysdep.h | 3 --- 16 files changed, 2 insertions(+), 53 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h index 935c507f8c..a2f4061b58 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h @@ -19,9 +19,6 @@ #ifndef _LINUX_AARCH64_SYSDEP_H #define _LINUX_AARCH64_SYSDEP_H 1 -/* Always enable vsyscalls on aarch64 */ -#define ALWAYS_USE_VSYSCALL 1 - #include #include #include diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.h b/sysdeps/unix/sysv/linux/arm/sysdep.h index 9b4ed8d6a5..6d8d9a47f9 100644 --- a/sysdeps/unix/sysv/linux/arm/sysdep.h +++ b/sysdeps/unix/sysv/linux/arm/sysdep.h @@ -20,9 +20,6 @@ #ifndef _LINUX_ARM_SYSDEP_H #define _LINUX_ARM_SYSDEP_H 1 -/* Always enable vsyscalls on arm */ -#define ALWAYS_USE_VSYSCALL 1 - /* There is some commonality. */ #include #include diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index 0be10744ff..77154b904a 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -19,9 +19,6 @@ #ifndef _LINUX_I386_SYSDEP_H #define _LINUX_I386_SYSDEP_H 1 -/* Always enable vsyscalls on i386 */ -#define ALWAYS_USE_VSYSCALL 1 - /* There is some commonality. */ #include #include diff --git a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h index 5a2704e3e8..a310a0acbc 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h @@ -18,9 +18,6 @@ #ifndef _LINUX_MIPS_MIPS32_SYSDEP_H #define _LINUX_MIPS_MIPS32_SYSDEP_H 1 -/* Always enable vsyscalls on mips32. */ -#define ALWAYS_USE_VSYSCALL 1 - /* There is some commonality. */ #include #include diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h index a4f3547030..d83e08f96a 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h @@ -18,9 +18,6 @@ #ifndef _LINUX_MIPS_SYSDEP_H #define _LINUX_MIPS_SYSDEP_H 1 -/* Always enable vsyscalls on n32. */ -#define ALWAYS_USE_VSYSCALL 1 - /* There is some commonality. */ #include #include diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h index 5b4d27757d..bcfaf561a1 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h @@ -18,9 +18,6 @@ #ifndef _LINUX_MIPS_SYSDEP_H #define _LINUX_MIPS_SYSDEP_H 1 -/* Always enable vsyscalls on n64. */ -#define ALWAYS_USE_VSYSCALL 1 - /* There is some commonality. */ #include #include diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h index bdbab8e41b..62caa265d7 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h @@ -18,9 +18,6 @@ #ifndef _LINUX_POWERPC_SYSDEP_H #define _LINUX_POWERPC_SYSDEP_H 1 -/* Always enable vsyscalls on powerpc32 */ -#define ALWAYS_USE_VSYSCALL 1 - #include #include #include diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h index 294517e3f3..4122e5c4a9 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h @@ -20,9 +20,6 @@ #ifndef _LINUX_POWERPC_SYSDEP_H #define _LINUX_POWERPC_SYSDEP_H 1 -/* Always enable vsyscalls on powerpc64 */ -#define ALWAYS_USE_VSYSCALL 1 - #include #include #include diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h index caf013a9a1..5470ea3d2a 100644 --- a/sysdeps/unix/sysv/linux/riscv/sysdep.h +++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h @@ -19,9 +19,6 @@ #ifndef _LINUX_RISCV_SYSDEP_H #define _LINUX_RISCV_SYSDEP_H 1 -/* Always enable vsyscalls on riscv */ -#define ALWAYS_USE_VSYSCALL 1 - #include #include diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h index 47d1c5cdb2..640fb52de1 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h @@ -19,9 +19,6 @@ #ifndef _LINUX_S390_SYSDEP_H #define _LINUX_S390_SYSDEP_H -/* Always enable vsyscalls on s390-32. */ -#define ALWAYS_USE_VSYSCALL 1 - #include #include #include diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h index 95829390e2..9a9834c750 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h @@ -20,10 +20,6 @@ #ifndef _LINUX_S390_SYSDEP_H #define _LINUX_S390_SYSDEP_H -/* Always enable vsyscalls on s390-64. */ -#define ALWAYS_USE_VSYSCALL 1 - - #include #include #include diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sysdep.h index fc4053c5ce..981b2a26b7 100644 --- a/sysdeps/unix/sysv/linux/sparc/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sysdep.h @@ -19,9 +19,6 @@ #ifndef _LINUX_SPARC_SYSDEP_H #define _LINUX_SPARC_SYSDEP_H 1 -/* Always enable vsyscalls on sparc */ -#define ALWAYS_USE_VSYSCALL 1 - #include #include #include diff --git a/sysdeps/unix/sysv/linux/sysdep-vdso.h b/sysdeps/unix/sysv/linux/sysdep-vdso.h index c5a1ae0670..5fec208380 100644 --- a/sysdeps/unix/sysv/linux/sysdep-vdso.h +++ b/sysdeps/unix/sysv/linux/sysdep-vdso.h @@ -26,7 +26,7 @@ funcptr (args) #endif -#if USE_VSYSCALL && defined HAVE_VSYSCALL +#ifdef HAVE_VSYSCALL # include diff --git a/sysdeps/unix/sysv/linux/sysdep.h b/sysdeps/unix/sysv/linux/sysdep.h index f94cfa2fa9..af1c9a26fe 100644 --- a/sysdeps/unix/sysv/linux/sysdep.h +++ b/sysdeps/unix/sysv/linux/sysdep.h @@ -18,13 +18,6 @@ #include #include -/* By default only shared builds use vdso. */ -#ifndef ALWAYS_USE_VSYSCALL -#define ALWAYS_USE_VSYSCALL 0 -#endif - -#define USE_VSYSCALL (defined (SHARED) || ALWAYS_USE_VSYSCALL) - /* Set error number and return -1. A target may choose to return the internal function, __syscall_error, which sets errno and returns -1. We use -1l, instead of -1, so that it can be casted to (void *). */ diff --git a/sysdeps/unix/sysv/linux/x86/libc-vdso.h b/sysdeps/unix/sysv/linux/x86/libc-vdso.h index ea35c71664..c9aa1c8a72 100644 --- a/sysdeps/unix/sysv/linux/x86/libc-vdso.h +++ b/sysdeps/unix/sysv/linux/x86/libc-vdso.h @@ -22,9 +22,7 @@ #include #include -#if USE_VSYSCALL - -# include +#include extern long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *) attribute_hidden; @@ -32,6 +30,4 @@ extern long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *) extern long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *) attribute_hidden; -#endif - #endif /* _LIBC_VDSO_H */ diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h index b88c46b589..0a3ddd37e1 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -18,9 +18,6 @@ #ifndef _LINUX_X86_64_SYSDEP_H #define _LINUX_X86_64_SYSDEP_H 1 -/* Always enable vsyscalls on x86_64 */ -#define ALWAYS_USE_VSYSCALL 1 - /* There is some commonality. */ #include #include From patchwork Fri Jun 14 15:29:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 166837 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2202568ilk; Fri, 14 Jun 2019 08:31:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXNrYliZrVKIgwvFbR9mzx1ALAlaMO5jwBkCOlygHtKUWQ5js5GEleh0GaoErj1CEEi7vN X-Received: by 2002:a17:90a:6544:: with SMTP id f4mr11850045pjs.17.1560526263329; Fri, 14 Jun 2019 08:31:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560526263; cv=none; d=google.com; s=arc-20160816; b=qPUTgHLn53bVRXh9BomMBo3gRoxnyaujAdKFERkuVeqAoaPSIBnOzji5e0eRZnVL8z ahjpSOS7YsxdJBcDIKBCoeQG/L1KDPOfxZn2QNQi5OFOWr5ovDAI4ZCvpk5luBHkJ8e/ G1I5Wy2IGRtLs7O/lGAMiFaSxOV51p/aSbUaWvU7eyccuq+i/S3rk732p83nyhOZzbfu RcEo8/EMFB8NpMxEv6aaFOjwfef1UbN9r5EUJ2+ofDpABaLMkbBY1dhw3Osr1X7/m0wZ DVISLy8Jvm61I0r5rFbFaYyxShL2SY6apZDT2JxJiWcweqO/qd81IMj0tiA9azS5VG67 1V1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to: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=cP0h5sUmL77FaYRpkkb0jfMWdcyf7ggV7COYeEDDLyg=; b=gQQVu5Bvm3+sfJB1x6klMwbPgpy2ZY7T4xgpCwBOE1J+d07gkjbWQV8sNrue2LATQP Zf95iV4IC6UT9FRzuuWv+nLDP0BMseABBnR3ZXeIsTck5JKFm5eBf+ZwKGuvnWEq0LVn Cj22FZzwFJ7AMziNBAQXVcWbTSKDwnkrydEPE9xBr9Maq8Q0CtIbsT28i0s5sDrgQAZx 5iGr7eq9YmwA3bRqPuQ3VU6yNsscu7yLcQmK+EQHm2cRA07+iCQQt5Yk/B8pwErSeWOK M1WWX+W/gF9XhjudEXKEK8OvRtlbK02OiMFnMGOF9PKQsrLR6OhniKxLEdPddUOZhtJS 4L0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=B7c6qPaY; dkim=pass header.i=@linaro.org header.s=google header.b=oGLs+jBr; spf=pass (google.com: domain of libc-alpha-return-102743-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102743-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 x22si869352pfa.267.2019.06.14.08.31.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jun 2019 08:31:03 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-102743-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=B7c6qPaY; dkim=pass header.i=@linaro.org header.s=google header.b=oGLs+jBr; spf=pass (google.com: domain of libc-alpha-return-102743-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102743-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:in-reply-to :references; q=dns; s=default; b=J7znkAq22CGWS/82Kl66EaZnbLFlU74 itdYjt9EPOXU+Xzo476sQRWtBJ4RjaUwDf9KNmncc+wqISMXOp8Jy5YOJamEdgBb W5vGbPGL2FlTxpejy7ugRVKq59cGUlopq8ygPeOkkj8A2ghU1y1EqDThA8RQnTla kEYw/BuASBV0= 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:in-reply-to :references; s=default; bh=ZqV6S4AiVRte3l0aC6w1bOFlCWA=; b=B7c6q PaYwYM/y3TAGuDkOG+JCmeB/3OJ7HTHjr2xk+nPyEdD6ZKfZ51mnvoNqXyLcyZn9 lPVFjU4IoTu9xaoEfr/KDLpropAsM7raDVG3++LggKXszgqPVR9ShoxCLgVNGXn5 enHjkEulZax0ei8tItsNLCFu9Ts6J/tuF3pWAM= Received: (qmail 118086 invoked by alias); 14 Jun 2019 15:29:29 -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 118016 invoked by uid 89); 14 Jun 2019 15:29:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.0 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= X-HELO: mail-vs1-f67.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=cP0h5sUmL77FaYRpkkb0jfMWdcyf7ggV7COYeEDDLyg=; b=oGLs+jBrBSSPISskXQ5bG2ko9MQkywESBNLnsgQganS0oKf350aNxtVGatyLZoMv2L q5bcchca7GjVBb0NhTbOt9xiDNAhqi7AW4uQmEd/OQgGvOv1p4G0WXYY4yKv8frpr1yT J7cq2XaqOMfb+AqaPv3h2Cd0bGeBeAtklkswsLu/z77UbDPSgBs73N9i1+pwTWFTacBB BUehmYy4bpG+RoZkQqCyS6hDA+i2OFpiuI7ZGkfErQRR/d8We8jnu+Ne4rW6IZk5EX8H 4wr6FbmHC2ytN7q0yt/ZzFUhr0eA98HnvTKRUVhj14tbjmottHw1r0F4N7PNrG7z3pu2 9Xsg== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 06/12] Remove PREPARE_VERSION and PREPARE_VERSION_KNOW Date: Fri, 14 Jun 2019 12:29:02 -0300 Message-Id: <20190614152908.8101-6-adhemerval.zanella@linaro.org> In-Reply-To: <20190614152908.8101-1-adhemerval.zanella@linaro.org> References: <20190614152908.8101-1-adhemerval.zanella@linaro.org> This patch removes the PREPARE_VERSION and PREPARE_VERSION_KNOW macro and uses a static inline function instead, get_vdso_symbol. Also, each architecture that supports vDSO must define the Linux version and 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 | 26 ++++----------- 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 | 32 +++++-------------- 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 | 6 ++-- 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 | 3 +- 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, 167 insertions(+), 149 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 6c008ed935..2474a2c575 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,15 @@ __gettimeofday_vsyscall (struct timeval *tv, struct timezone *tz) return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); } -/* PREPARE_VERSION 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 (linux_version, "LINUX_2.6.39", 123718537); \ - void *vdso_gettimeofday = \ - _dl_vdso_vsym ("__kernel_gettimeofday", &linux_version); +# define INIT_ARCH() -libc_ifunc_hidden (__redirect___gettimeofday, __gettimeofday, - vdso_gettimeofday ?: (void *) __gettimeofday_vsyscall) - -__hidden_ver1 (__gettimeofday_vsyscall, __GI___gettimeofday, - __gettimeofday_vsyscall); +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 ce7319f3c9..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 (linux_version, "LINUX_2.6.39", 123718537); -#else - PREPARE_VERSION (linux_version, "LINUX_4.9", 61765625); -#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 50ee29067d..bab3779615 100644 --- a/sysdeps/unix/sysv/linux/dl-vdso.h +++ b/sysdeps/unix/sysv/linux/dl-vdso.h @@ -22,34 +22,18 @@ #include #include #include - -/* Create version number record for lookup. */ -#define PREPARE_VERSION(var, vname, vhash) \ - struct r_found_version var; \ - var.name = vname; \ - var.hidden = 1; \ - var.hash = vhash; \ - assert (var.hash == _dl_elf_hash (var.name)); \ - /* We don't have a specific file where the symbol can be found. */ \ - var.filename = NULL - -/* 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) \ - PREPARE_VERSION (var, VDSO_NAME_##vname, VDSO_HASH_##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_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 c8d7790d8a..6b92e2807b 100644 --- a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c +++ b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c @@ -57,9 +57,9 @@ __gettimeofday_syscall (struct timeval *tv, struct timezone *tz) return INLINE_SYSCALL (gettimeofday, 2, tv, tz); } -# define INIT_ARCH() \ - PREPARE_VERSION (linux2615, "LINUX_2.6.15", 123718565); \ - 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, diff --git a/sysdeps/unix/sysv/linux/powerpc/init-first.c b/sysdeps/unix/sysv/linux/powerpc/init-first.c index 237b5abbf9..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 (linux2615, "LINUX_2.6.15", 123718565); - - 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 c2f171b622..53fd119b00 100644 --- a/sysdeps/unix/sysv/linux/powerpc/time.c +++ b/sysdeps/unix/sysv/linux/powerpc/time.c @@ -67,8 +67,7 @@ time_syscall (time_t *t) } # define INIT_ARCH() \ - PREPARE_VERSION (linux2615, "LINUX_2.6.15", 123718565); \ - void *vdso_time = _dl_vdso_vsym ("__kernel_time", &linux2615); + 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 847977c0d9..63a12d95c8 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 (linux2629, "LINUX_2.6.29", 123718585); - - 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 6a347becbe..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 (linux26, "LINUX_2.6", 61765110); - - 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 From patchwork Fri Jun 14 15:29:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 166840 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2203155ilk; Fri, 14 Jun 2019 08:31:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqwLIR2PYzSkhlRvBIoSILyxVTdNAI7rVYQb3TyU/nXMlcZgw+tJLgQPnUY4KfZK6wNO3Rcp X-Received: by 2002:a17:902:aa8a:: with SMTP id d10mr57359877plr.159.1560526296944; Fri, 14 Jun 2019 08:31:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560526296; cv=none; d=google.com; s=arc-20160816; b=kY7Nw/9MFKieYEuQbsOQ+ADEGJh8kQSOTPxYf3xA92hbMJyTt3XziO7OF2LmNfdvbj 4OD04fmAKU2+Tzed1Fxwg/t9tRlyTXGEfeQ7k6pCzcTyXPJ+/2s8SAGbxmGIUvYSZda1 Vvv6DNNpH/SnwfTv83Fr+ZxScrJ/Y1MOUbTyTHR2Wiis+7C/6yQQs7ApnM4/QWN7+ymU FRjEZq73eefpcROnVjqJYoJPjDKtoCU/PDzflHCUfv7AtCm051WoWeskrLk4Q+BJVqb4 fGrVWzaEsmVl6IsieTMNDKgOnO1QtM2NNFWLnPGxgqVQ5lMWIc3gHpf00Y8pRoFdTgkg /nIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to: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=uGPMe3P2uNLbFVoqdHarweUh7tAqwXO+R634ymuzfPo=; b=NJNiYN97cWWmu4uz3kVB62dvo1AJCu2w/imi7D1c2wafjBz/jG3iVHafRxwf0dN1Yv iOsW9HNGPBK4wIqC9I2El7alCtBr5hXtlLIymxzO6vCipBAeKihsBpMw1ozNYZcwLC5n uOwWS9Yq884K0EtSC9zXol+ay7+rz29C9xYpT2l15cBzWJBrrW8jlTdwg7uCewc6LZwI 8r5IWSv7tqJN/6ddeH4f5wd/vilJdXYjhgGxKRi/sgJTySvbZytOfewchurxlhf9wzEV 6jsfo12Xoi1rDsVWQGeIunhjRdNWF2QaLU9sszrMSlpaOZjZy15yTg9fP7LKTsXpO9FS GbUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=flEuwnjL; dkim=pass header.i=@linaro.org header.s=google header.b=Q8GkEmtV; spf=pass (google.com: domain of libc-alpha-return-102746-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102746-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 x16si2470982pjq.27.2019.06.14.08.31.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jun 2019 08:31:36 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-102746-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=flEuwnjL; dkim=pass header.i=@linaro.org header.s=google header.b=Q8GkEmtV; spf=pass (google.com: domain of libc-alpha-return-102746-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102746-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:in-reply-to :references; q=dns; s=default; b=aUWvsOmIxT4Q7KyNw04iWKKxtYHi1yN e4Ii6fCqq3EkizonBKRzuJ/OBlFVOcbyw5xK9n4TIxKSP7QFvS0SEtQY33HXIpwx nZwPT+ZVqjPI7WMdrtEASbqI+4lHqOitNyyoaDNfq/MQdjFQK2xtXxrlmOR8kxoz fJ56AGRbns58= 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:in-reply-to :references; s=default; bh=BmHARaZTAXpb4v810Wlx0RUHSD0=; b=flEuw njLlA6GWhnkBmEfWP6JZRxV+9G7lT666oDaxRXXyG8AU2tMPxI0qT97NJn4x7Z6D u5Z7kHgseKhML9ZM1ZN2JUaf4C/tarChNPoG5RG3j9X9qJmcAUHp/kyCWDFP0nmw UOjaI1Jf7scvjyw9hI0AQpzC96bG1t+bim6K5I= Received: (qmail 118703 invoked by alias); 14 Jun 2019 15:29:34 -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 118535 invoked by uid 89); 14 Jun 2019 15:29:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.1 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=2018-2019, 20182019, HX-Received:a494, HX-Received:sk:n142mr1 X-HELO: mail-vk1-f193.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=uGPMe3P2uNLbFVoqdHarweUh7tAqwXO+R634ymuzfPo=; b=Q8GkEmtVSf0VwUYp1OpouylZCwYE3IK9qvzq5tUeJkFlWxoJ1Hc2qY2RsIqmoXr/nB p91AVRUlgVv74eiAVT0PMT5jjQMlNPoocLKjPx07+j2jln3pFzPQs1TUxTShyiklg/7o s6r9CZHwadaCgyklxVE+pOegAKkPW9YuuvcuDICoTA4LKAQQO4rK7Axcgc6g+QGZMJ1I KfV+VgXflPfWf3YnpIvD/m2NBPwvxcw0i8jK71zbISqHskXl1tv6RHcGqtmAxduQobV0 Y1wpS7leVdXtMxns0uWAw4psNnahUfBUI0NpDWH1xPPMJKCDhCdsX+CDyqjIruhnOWFV HxCQ== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 07/12] Refactor vDSO initialization code Date: Fri, 14 Jun 2019 12:29:03 -0300 Message-Id: <20190614152908.8101-7-adhemerval.zanella@linaro.org> In-Reply-To: <20190614152908.8101-1-adhemerval.zanella@linaro.org> References: <20190614152908.8101-1-adhemerval.zanella@linaro.org> Linux vDSO initialization code the internal function pointers require a lot of duplicated boilerplate over different architectures. This patch aims to simplify not only the code but the required definition to enable a vDSO symbol to be enabled and used internally on glibc. The changes are: 1. Consolidate all init-first.c on only one implementation and enable the symbol based on HAVE_*_VSYSCALL existence. 2. Set the HAVE_*_VSYSCALL to the architecture expected names string. 3. Add a new internal implementation, get_vdso_mangle_symbol, which returns a mangled function pointer. Currently the clock_gettime, clock_getres, gettimeofday, getcpu, and time are handled in an arch-independent way, powerpc still uses some arch-specific vDSO symbol handled in a specific init-first implementation. Checked on aarch64-linux-gnu, arm-linux-gnueabihf, i386-linux-gnu, mips64-linux-gnu, powerpc64le-linux-gnu, s390x-linux-gu, sparc64-linux-gnu, and x86_64-linux-gnu. * sysdeps/powerpc/powerpc32/backtrace.c (is_sigtramp_address, is_sigtramp_address_rt): Use HAVE_SIGTRAMP_{RT}32 instead of SHARED. * sysdeps/powerpc/powerpc64/backtrace.c (is_sigtramp_address): Likewise. * sysdeps/unix/sysv/linux/aarch64/init-first.c: Remove file. * sysdeps/unix/sysv/linux/aarch64/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/arm/init-first.c: Likewise. * sysdeps/unix/sysv/linux/arm/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/mips/init-first.c: Likewise. * sysdeps/unix/sysv/linux/mips/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/i386/init-first.c: Likewise. * sysdeps/unix/sysv/linux/riscv/init-first.c: Likewise. * sysdeps/unix/sysv/linux/riscv/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/s390/init-first.c: Likewise. * sysdeps/unix/sysv/linux/s390/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/sparc/init-first.c: Likewise. * sysdeps/unix/sysv/linux/sparc/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/x86/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/init-first.c: Likewise. * sysdeps/unix/sysv/linux/aarch64/sysdep.h (HAVE_CLOCK_GETRES_VSYSCALL, HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Define value based on kernel exported name. * sysdeps/unix/sysv/linux/arm/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/i386/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/mips/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/powerpc/sysdep.h (HAVE_CLOCK_GETRES_VSYSCALL, HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETCPU_VSYSCALL, HAVE_TIME_VSYSCALL, HAVE_GET_TBFREQ, HAVE_SIGTRAMP_RT64, HAVE_SIGTRAMP_32, HAVE_SIGTRAMP_RT32): Likewise. * sysdeps/unix/sysv/linux/riscv/sysdep.h (HAVE_CLOCK_GETRES_VSYSCALL, HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL, HAVE_GETCPU_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/s390/sysdep.h (HAVE_CLOCK_GETRES_VSYSCALL, HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL, HAVE_GETCPU_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/sparc/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h (HAVE_CLOCK_GETTIME_VSYSCALL, HAVE_GETTIMEOFDAY_VSYSCALL, HAVE_GETCPU_VSYSCALL): Likewise. * sysdeps/unix/sysv/linux/dl-vdso.h (VDSO_NAME, VDSO_HASH): Define to invalid names if architecture does not define them. (get_vdso_mangle_symbol): New symbol. * sysdeps/unix/sysv/linux/init-first.c: New file. * sysdeps/unix/sysv/linux/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/init-first.c (gettimeofday, clock_gettime, clock_getres, getcpu, time): Remove declaration. (__libc_vdso_platform_setup_arch): Likewise and use get_vdso_mangle_symbol to setup vDSO symbols. (sigtramp_rt64, sigtramp32, sigtramp_rt32, get_tbfreq): Add attribute_hidden. * sysdeps/unix/sysv/linux/powerpc/libc-vdso.h: Likewise. * sysdeps/unix/sysv/linux/sysdep-vdso.h (VDSO_SYMBOL): Remove definition. --- sysdeps/powerpc/powerpc32/backtrace.c | 4 +- sysdeps/powerpc/powerpc64/backtrace.c | 2 +- sysdeps/unix/sysv/linux/aarch64/init-first.c | 44 ---------- sysdeps/unix/sysv/linux/aarch64/sysdep.h | 6 +- sysdeps/unix/sysv/linux/arm/init-first.c | 41 ---------- sysdeps/unix/sysv/linux/arm/libc-vdso.h | 29 ------- sysdeps/unix/sysv/linux/arm/sysdep.h | 4 +- sysdeps/unix/sysv/linux/dl-vdso.h | 21 ++++- sysdeps/unix/sysv/linux/i386/init-first.c | 46 ----------- sysdeps/unix/sysv/linux/i386/sysdep.h | 4 +- sysdeps/unix/sysv/linux/init-first.c | 80 +++++++++++++++++++ .../unix/sysv/linux/{aarch64 => }/libc-vdso.h | 18 ++++- sysdeps/unix/sysv/linux/mips/init-first.c | 40 ---------- sysdeps/unix/sysv/linux/mips/libc-vdso.h | 29 ------- sysdeps/unix/sysv/linux/mips/sysdep.h | 4 +- sysdeps/unix/sysv/linux/powerpc/init-first.c | 51 +++--------- sysdeps/unix/sysv/linux/powerpc/libc-vdso.h | 12 +-- sysdeps/unix/sysv/linux/powerpc/sysdep.h | 14 +++- sysdeps/unix/sysv/linux/riscv/init-first.c | 54 ------------- sysdeps/unix/sysv/linux/riscv/libc-vdso.h | 34 -------- sysdeps/unix/sysv/linux/riscv/sysdep.h | 8 +- sysdeps/unix/sysv/linux/s390/init-first.c | 54 ------------- sysdeps/unix/sysv/linux/s390/libc-vdso.h | 35 -------- sysdeps/unix/sysv/linux/s390/sysdep.h | 8 +- sysdeps/unix/sysv/linux/sparc/init-first.c | 42 ---------- sysdeps/unix/sysv/linux/sparc/libc-vdso.h | 29 ------- sysdeps/unix/sysv/linux/sparc/sysdep.h | 4 +- sysdeps/unix/sysv/linux/sysdep-vdso.h | 2 +- sysdeps/unix/sysv/linux/x86/libc-vdso.h | 33 -------- sysdeps/unix/sysv/linux/x86_64/init-first.c | 48 ----------- sysdeps/unix/sysv/linux/x86_64/sysdep.h | 6 +- 31 files changed, 164 insertions(+), 642 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/aarch64/init-first.c delete mode 100644 sysdeps/unix/sysv/linux/arm/init-first.c delete mode 100644 sysdeps/unix/sysv/linux/arm/libc-vdso.h delete mode 100644 sysdeps/unix/sysv/linux/i386/init-first.c create mode 100644 sysdeps/unix/sysv/linux/init-first.c rename sysdeps/unix/sysv/linux/{aarch64 => }/libc-vdso.h (70%) delete mode 100644 sysdeps/unix/sysv/linux/mips/init-first.c delete mode 100644 sysdeps/unix/sysv/linux/mips/libc-vdso.h delete mode 100644 sysdeps/unix/sysv/linux/riscv/init-first.c delete mode 100644 sysdeps/unix/sysv/linux/riscv/libc-vdso.h delete mode 100644 sysdeps/unix/sysv/linux/s390/init-first.c delete mode 100644 sysdeps/unix/sysv/linux/s390/libc-vdso.h delete mode 100644 sysdeps/unix/sysv/linux/sparc/init-first.c delete mode 100644 sysdeps/unix/sysv/linux/sparc/libc-vdso.h delete mode 100644 sysdeps/unix/sysv/linux/x86/libc-vdso.h delete mode 100644 sysdeps/unix/sysv/linux/x86_64/init-first.c -- 2.17.1 diff --git a/sysdeps/powerpc/powerpc32/backtrace.c b/sysdeps/powerpc/powerpc32/backtrace.c index 857a8aad7b..2978632017 100644 --- a/sysdeps/powerpc/powerpc32/backtrace.c +++ b/sysdeps/powerpc/powerpc32/backtrace.c @@ -54,7 +54,7 @@ struct signal_frame_32 { static inline int is_sigtramp_address (void *nip) { -#ifdef SHARED +#ifdef HAVE_SIGTRAMP_RT32 if (nip == VDSO_SYMBOL (sigtramp32)) return 1; #endif @@ -71,7 +71,7 @@ struct rt_signal_frame_32 { static inline int is_sigtramp_address_rt (void * nip) { -#ifdef SHARED +#ifdef HAVE_SIGTRAMP_32 if (nip == VDSO_SYMBOL (sigtramp_rt32)) return 1; #endif diff --git a/sysdeps/powerpc/powerpc64/backtrace.c b/sysdeps/powerpc/powerpc64/backtrace.c index 7a167838d9..0fa7e9c403 100644 --- a/sysdeps/powerpc/powerpc64/backtrace.c +++ b/sysdeps/powerpc/powerpc64/backtrace.c @@ -57,7 +57,7 @@ struct signal_frame_64 { static inline int is_sigtramp_address (void *nip) { -#ifdef SHARED +#ifdef HAVE_SIGTRAMP_RT64 if (nip == VDSO_SYMBOL (sigtramp_rt64)) return 1; #endif diff --git a/sysdeps/unix/sysv/linux/aarch64/init-first.c b/sysdeps/unix/sysv/linux/aarch64/init-first.c deleted file mode 100644 index c3c27cfd4b..0000000000 --- a/sysdeps/unix/sysv/linux/aarch64/init-first.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright (C) 2007-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 - . */ - -#include -#include - -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) -{ - void *p = get_vdso_symbol ("__kernel_gettimeofday"); - PTR_MANGLE (p); - VDSO_SYMBOL(gettimeofday) = p; - - p = get_vdso_symbol ("__kernel_clock_gettime"); - PTR_MANGLE (p); - VDSO_SYMBOL(clock_gettime) = p; - - p = get_vdso_symbol ("__kernel_clock_getres"); - PTR_MANGLE (p); - VDSO_SYMBOL(clock_getres) = p; -} - -#define VDSO_SETUP _libc_vdso_platform_setup - -#include diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h index 662d321235..d57f7232e2 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h @@ -160,9 +160,9 @@ # endif /* 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_CLOCK_GETRES_VSYSCALL "__kernel_clock_getres" +# define HAVE_CLOCK_GETTIME_VSYSCALL "__kernel_clock_gettime" +# define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday" /* Previously AArch64 used the generic version without the libc_hidden_def which lead in a non existent __send symbol in libc.so. */ diff --git a/sysdeps/unix/sysv/linux/arm/init-first.c b/sysdeps/unix/sysv/linux/arm/init-first.c deleted file mode 100644 index 2852ab135c..0000000000 --- a/sysdeps/unix/sysv/linux/arm/init-first.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Initialization code run first thing by the ELF startup code. Linux/ARM. - Copyright (C) 2015-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 - . */ - -#include -#include -#include - -int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *) attribute_hidden; -int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *); - -static inline void -_libc_vdso_platform_setup (void) -{ - void *p = get_vdso_symbol ("__vdso_gettimeofday"); - PTR_MANGLE (p); - VDSO_SYMBOL (gettimeofday) = p; - - p = get_vdso_symbol ("__vdso_clock_gettime"); - PTR_MANGLE (p); - VDSO_SYMBOL (clock_gettime) = p; -} - -#define VDSO_SETUP _libc_vdso_platform_setup - -#include diff --git a/sysdeps/unix/sysv/linux/arm/libc-vdso.h b/sysdeps/unix/sysv/linux/arm/libc-vdso.h deleted file mode 100644 index 8702165c6b..0000000000 --- a/sysdeps/unix/sysv/linux/arm/libc-vdso.h +++ /dev/null @@ -1,29 +0,0 @@ -/* VDSO function pointer declarations. Linux/ARM. - Copyright (C) 2015-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 - . */ - -#ifndef _LIBC_VDSO_H -#define _LIBC_VDSO_H - -#include - -extern int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *) - attribute_hidden; -extern int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *); - -#endif /* _LIBC_VDSO_H */ diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.h b/sysdeps/unix/sysv/linux/arm/sysdep.h index 467ccf2631..634aa2bc6b 100644 --- a/sysdeps/unix/sysv/linux/arm/sysdep.h +++ b/sysdeps/unix/sysv/linux/arm/sysdep.h @@ -392,8 +392,8 @@ __local_syscall_error: \ #define VDSO_HASH 61765110 /* List of system calls which are supported as vsyscalls. */ -#define HAVE_CLOCK_GETTIME_VSYSCALL 1 -#define HAVE_GETTIMEOFDAY_VSYSCALL 1 +#define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_gettimeofday" +#define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_clock_gettime" #define LOAD_ARGS_0() #define ASM_ARGS_0 diff --git a/sysdeps/unix/sysv/linux/dl-vdso.h b/sysdeps/unix/sysv/linux/dl-vdso.h index bab3779615..dcf065ef23 100644 --- a/sysdeps/unix/sysv/linux/dl-vdso.h +++ b/sysdeps/unix/sysv/linux/dl-vdso.h @@ -19,16 +19,25 @@ #ifndef _DL_VDSO_H #define _DL_VDSO_H 1 -#include #include #include -#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; +/* If the architecture support vDSO it should define which is the expected + kernel version and hash value through both VDSO_NAME and VDSO_HASH + (usually defined at architecture sysdep.h). */ + +#ifndef VDSO_NAME +# define VDSO_NAME "LINUX_0.0" +#endif +#ifndef VDSO_HASH +# define VDSO_HASH 0 +#endif + static inline void * get_vdso_symbol (const char *symbol) { @@ -36,4 +45,12 @@ get_vdso_symbol (const char *symbol) return _dl_vdso_vsym (symbol, &rfv); } +static inline void * +get_vdso_mangle_symbol (const char *symbol) +{ + void *vdsop = get_vdso_symbol (symbol); + PTR_MANGLE (vdsop); + return vdsop; +} + #endif /* dl-vdso.h */ diff --git a/sysdeps/unix/sysv/linux/i386/init-first.c b/sysdeps/unix/sysv/linux/i386/init-first.c deleted file mode 100644 index 9c03f87b67..0000000000 --- a/sysdeps/unix/sysv/linux/i386/init-first.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Initialization code run first thing by the ELF startup code. Linux/i386. - Copyright (C) 2015-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 - . */ - -#include -#include -#include -#include - -long int (*VDSO_SYMBOL (clock_gettime)) (clockid_t, struct timespec *) - attribute_hidden; - -static long int -clock_gettime_syscall (clockid_t id, struct timespec *tp) -{ - INTERNAL_SYSCALL_DECL (err); - return INTERNAL_SYSCALL (clock_gettime, err, 2, id, tp); -} - -static inline void -__vdso_platform_setup (void) -{ - void *p = get_vdso_symbol ("__vdso_clock_gettime"); - if (p == NULL) - p = clock_gettime_syscall; - PTR_MANGLE (p); - VDSO_SYMBOL (clock_gettime) = p; -} - -#define VDSO_SETUP __vdso_platform_setup - -#include diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index 278028f52e..e793fdc936 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -313,8 +313,8 @@ struct libc_do_syscall_args # define VDSO_HASH 61765110 /* List of system calls which are supported as vsyscalls. */ -# define HAVE_CLOCK_GETTIME_VSYSCALL 1 -# define HAVE_GETTIMEOFDAY_VSYSCALL 1 +# define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime" +# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" /* 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/init-first.c b/sysdeps/unix/sysv/linux/init-first.c new file mode 100644 index 0000000000..194194d319 --- /dev/null +++ b/sysdeps/unix/sysv/linux/init-first.c @@ -0,0 +1,80 @@ +/* vDSO internal symbols. Linux 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 + . */ + +#include +#include + +/* vDSO symbol used on clock_gettime implementation. */ +#ifdef HAVE_CLOCK_GETTIME_VSYSCALL +int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *) + attribute_hidden; +#endif +/* vDSO symbol used on clock_getres implementation. */ +#ifdef HAVE_CLOCK_GETRES_VSYSCALL +int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *) + attribute_hidden; +#endif +/* vDSO symbol used on gettimeofday implementation. */ +#ifdef HAVE_GETTIMEOFDAY_VSYSCALL +int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *) + attribute_hidden; +#endif +/* vDSO symbol used on GNU extension getcpu implementation. */ +#ifdef HAVE_GETCPU_VSYSCALL +long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *) + attribute_hidden; +#endif +/* vDSO symbol used on time implementation. */ +#ifdef HAVE_TIME_VSYSCALL +time_t (*VDSO_SYMBOL(time)) (time_t *) attribute_hidden; +#endif + +static inline void +__libc_vdso_platform_setup (void) +{ +#ifdef HAVE_CLOCK_GETTIME_VSYSCALL + VDSO_SYMBOL(clock_gettime) + = get_vdso_mangle_symbol (HAVE_CLOCK_GETTIME_VSYSCALL); +#endif + +#ifdef HAVE_CLOCK_GETRES_VSYSCALL + VDSO_SYMBOL(clock_getres) + = get_vdso_mangle_symbol (HAVE_CLOCK_GETRES_VSYSCALL); +#endif + +#ifdef HAVE_GETTIMEOFDAY_VSYSCALL + VDSO_SYMBOL(gettimeofday) + = get_vdso_mangle_symbol (HAVE_GETTIMEOFDAY_VSYSCALL); +#endif + +#ifdef HAVE_GETCPU_VSYSCALL + VDSO_SYMBOL(getcpu) = get_vdso_mangle_symbol (HAVE_GETCPU_VSYSCALL); +#endif + +#ifdef HAVE_TIME_VSYSCALL + VDSO_SYMBOL(time) = get_vdso_mangle_symbol (HAVE_TIME_VSYSCALL); +#endif + +#ifdef VDSO_SETUP_ARCH + VDSO_SETUP_ARCH (); +#endif +} + +#define VDSO_SETUP __libc_vdso_platform_setup + +#include diff --git a/sysdeps/unix/sysv/linux/aarch64/libc-vdso.h b/sysdeps/unix/sysv/linux/libc-vdso.h similarity index 70% rename from sysdeps/unix/sysv/linux/aarch64/libc-vdso.h rename to sysdeps/unix/sysv/linux/libc-vdso.h index 3fcbaa9fce..f681868137 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libc-vdso.h +++ b/sysdeps/unix/sysv/linux/libc-vdso.h @@ -19,12 +19,22 @@ #ifndef _LIBC_VDSO_H #define _LIBC_VDSO_H -#include -#include +#define VDSO_SYMBOL(__name) __vdso_##__name -extern int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *) - attribute_hidden; +#ifdef HAVE_CLOCK_GETTIME_VSYSCALL extern int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *); +#endif +#ifdef HAVE_CLOCK_GETRES_VSYSCALL extern int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *); +#endif +#ifdef HAVE_GETTIMEOFDAY_VSYSCALL +extern int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *); +#endif +#ifdef HAVE_GETCPU_VSYSCALL +extern long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *); +#endif +#ifdef HAVE_TIME_VSYSCALL +extern time_t (*VDSO_SYMBOL(time)) (time_t *); +#endif #endif /* _LIBC_VDSO_H */ diff --git a/sysdeps/unix/sysv/linux/mips/init-first.c b/sysdeps/unix/sysv/linux/mips/init-first.c deleted file mode 100644 index 2a43bdc8b0..0000000000 --- a/sysdeps/unix/sysv/linux/mips/init-first.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Initialization code run first thing by the ELF startup code. - Copyright (C) 2016-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 - . */ - -#include -#include - -int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *) attribute_hidden; -int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *); - -static inline void -_libc_vdso_platform_setup (void) -{ - void *p = get_vdso_symbol ("__vdso_gettimeofday"); - PTR_MANGLE (p); - VDSO_SYMBOL (gettimeofday) = p; - - p = get_vdso_symbol ("__vdso_clock_gettime"); - PTR_MANGLE (p); - VDSO_SYMBOL (clock_gettime) = p; -} - -#define VDSO_SETUP _libc_vdso_platform_setup - -#include diff --git a/sysdeps/unix/sysv/linux/mips/libc-vdso.h b/sysdeps/unix/sysv/linux/mips/libc-vdso.h deleted file mode 100644 index 344ea2d750..0000000000 --- a/sysdeps/unix/sysv/linux/mips/libc-vdso.h +++ /dev/null @@ -1,29 +0,0 @@ -/* VDSO function pointer declarations. - Copyright (C) 2016-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 - . */ - -#ifndef _LIBC_VDSO_H -#define _LIBC_VDSO_H - -#include - -extern int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *) - attribute_hidden; -extern int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *); - -#endif /* _LIBC_VDSO_H */ diff --git a/sysdeps/unix/sysv/linux/mips/sysdep.h b/sysdeps/unix/sysv/linux/mips/sysdep.h index cabc590961..58a7244581 100644 --- a/sysdeps/unix/sysv/linux/mips/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/sysdep.h @@ -20,5 +20,5 @@ #define VDSO_HASH 61765110 /* List of system calls which are supported as vsyscalls. */ -#define HAVE_CLOCK_GETTIME_VSYSCALL 1 -#define HAVE_GETTIMEOFDAY_VSYSCALL 1 +#define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_gettimeofday" +#define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_clock_gettime" diff --git a/sysdeps/unix/sysv/linux/powerpc/init-first.c b/sysdeps/unix/sysv/linux/powerpc/init-first.c index 0d46563ce3..6e72d9ca84 100644 --- a/sysdeps/unix/sysv/linux/powerpc/init-first.c +++ b/sysdeps/unix/sysv/linux/powerpc/init-first.c @@ -19,47 +19,18 @@ #include #include -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 *); - +unsigned long long (*VDSO_SYMBOL(get_tbfreq)) (void) attribute_hidden; #if defined(__PPC64__) || defined(__powerpc64__) -void *VDSO_SYMBOL(sigtramp_rt64); +void *VDSO_SYMBOL(sigtramp_rt64) attribute_hidden; #else -void *VDSO_SYMBOL(sigtramp32); -void *VDSO_SYMBOL(sigtramp_rt32); +void *VDSO_SYMBOL(sigtramp32) attribute_hidden; +void *VDSO_SYMBOL(sigtramp_rt32) attribute_hidden; #endif static inline void -_libc_vdso_platform_setup (void) +__libc_vdso_platform_setup_arch (void) { - void *p = get_vdso_symbol ("__kernel_gettimeofday"); - PTR_MANGLE (p); - VDSO_SYMBOL (gettimeofday) = p; - - p = get_vdso_symbol ("__kernel_clock_gettime"); - PTR_MANGLE (p); - VDSO_SYMBOL (clock_gettime) = p; - - p = get_vdso_symbol ("__kernel_clock_getres"); - PTR_MANGLE (p); - VDSO_SYMBOL (clock_getres) = p; - - p = get_vdso_symbol ("__kernel_get_tbfreq"); - PTR_MANGLE (p); - VDSO_SYMBOL (get_tbfreq) = p; - - p = get_vdso_symbol ("__kernel_getcpu"); - PTR_MANGLE (p); - VDSO_SYMBOL (getcpu) = p; - - p = get_vdso_symbol ("__kernel_time"); - PTR_MANGLE (p); - VDSO_SYMBOL (time) = p; + VDSO_SYMBOL (get_tbfreq) = get_vdso_mangle_symbol (HAVE_GET_TBFREQ); /* PPC64 uses only one signal trampoline symbol, while PPC32 will use two depending if SA_SIGINFO is used (__kernel_sigtramp_rt32) or not @@ -67,13 +38,13 @@ _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) = get_vdso_symbol ("__kernel_sigtramp_rt64"); + VDSO_SYMBOL(sigtramp_rt64) = get_vdso_symbol (HAVE_SIGTRAMP_RT64); #else - VDSO_SYMBOL(sigtramp32) = get_vdso_symbol ("__kernel_sigtramp32"); - VDSO_SYMBOL(sigtramp_rt32) = get_vdso_symbol ("__kernel_sigtramp_rt32"); + VDSO_SYMBOL(sigtramp32) = get_vdso_symbol (HAVE_SIGTRAMP_32); + VDSO_SYMBOL(sigtramp_rt32) = get_vdso_symbol (HAVE_SIGTRAMP_RT32); #endif } -#define VDSO_SETUP _libc_vdso_platform_setup +#define VDSO_SETUP_ARCH __libc_vdso_platform_setup_arch -#include +#include diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h b/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h index f8184061c0..47e925493b 100644 --- a/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h +++ b/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h @@ -17,20 +17,14 @@ . */ -#ifndef _LIBC_VDSO_H -#define _LIBC_VDSO_H +#ifndef _LIBC_POWERPC_VDSO_H +#define _LIBC_POWERPC_VDSO_H #include #include +#include_next -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_SYMBOL(sigtramp_rt64); #else diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/sysdep.h index 5b411d0e8e..20167615c8 100644 --- a/sysdeps/unix/sysv/linux/powerpc/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h @@ -20,7 +20,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 +#define HAVE_CLOCK_GETRES_VSYSCALL "__kernel_clock_getres" +#define HAVE_CLOCK_GETTIME_VSYSCALL "__kernel_clock_gettime" +#define HAVE_GETCPU_VSYSCALL "__kernel_getcpu" +#define HAVE_TIME_VSYSCALL "__kernel_time" +#define HAVE_GET_TBFREQ "__kernel_get_tbfreq" +#if defined(__PPC64__) || defined(__powerpc64__) +# define HAVE_SIGTRAMP_RT64 "__kernel_sigtramp_rt64" +#else +# define HAVE_SIGTRAMP_32 "__kernel_sigtramp32" +# define HAVE_SIGTRAMP_RT32 "__kernel_sigtramp_rt32" +#endif diff --git a/sysdeps/unix/sysv/linux/riscv/init-first.c b/sysdeps/unix/sysv/linux/riscv/init-first.c deleted file mode 100644 index f3d243a192..0000000000 --- a/sysdeps/unix/sysv/linux/riscv/init-first.c +++ /dev/null @@ -1,54 +0,0 @@ -/* RISC-V VDSO initialization - Copyright (C) 2017-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 - . */ - -#include -#include - -long int (*VDSO_SYMBOL (getcpu)) (unsigned int *, unsigned int *, void *) - attribute_hidden; -long int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *) - attribute_hidden; -long int (*VDSO_SYMBOL (clock_gettime)) (clockid_t, struct timespec *) - attribute_hidden; -long int (*VDSO_SYMBOL (clock_getres)) (clockid_t, struct timespec *) - attribute_hidden; - -static inline void -_libc_vdso_platform_setup (void) -{ - void *p = get_vdso_symbol ("__vdso_getcpu"); - PTR_MANGLE (p); - VDSO_SYMBOL (getcpu) = p; - - p = get_vdso_symbol ("__vdso_gettimeofday"); - PTR_MANGLE (p); - VDSO_SYMBOL (gettimeofday) = p; - - p = get_vdso_symbol ("__vdso_clock_gettime"); - PTR_MANGLE (p); - VDSO_SYMBOL (clock_gettime) = p; - - p = get_vdso_symbol ("__vdso_clock_getres"); - PTR_MANGLE (p); - VDSO_SYMBOL (clock_getres) = p; -} - -#define VDSO_SETUP _libc_vdso_platform_setup - -#include diff --git a/sysdeps/unix/sysv/linux/riscv/libc-vdso.h b/sysdeps/unix/sysv/linux/riscv/libc-vdso.h deleted file mode 100644 index 2373292ab9..0000000000 --- a/sysdeps/unix/sysv/linux/riscv/libc-vdso.h +++ /dev/null @@ -1,34 +0,0 @@ -/* RISC-V VDSO function declarations - Copyright (C) 2017-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 - . */ - -#ifndef _LIBC_VDSO_H -#define _LIBC_VDSO_H - -#include - -extern long int (*VDSO_SYMBOL (getcpu)) (unsigned int *, unsigned int *, void *) - attribute_hidden; -extern long int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *) - attribute_hidden; -extern long int (*VDSO_SYMBOL (clock_gettime)) (clockid_t, struct timespec *) - attribute_hidden; -extern long int (*VDSO_SYMBOL (clock_getres)) (clockid_t, struct timespec *) - attribute_hidden; - -#endif /* _LIBC_VDSO_H */ diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h index 5de773744c..22835aa12f 100644 --- a/sysdeps/unix/sysv/linux/riscv/sysdep.h +++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h @@ -125,10 +125,10 @@ # 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 -# define HAVE_GETTIMEOFDAY_VSYSCALL 1 -# define HAVE_GETCPU_VSYSCALL 1 +# define HAVE_CLOCK_GETRES_VSYSCALL "__vdso_clock_getres" +# define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime" +# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" +# define HAVE_GETCPU_VSYSCALL "__vdso_getcpu" /* Define a macro which expands into the inline wrapper code for a system call. */ diff --git a/sysdeps/unix/sysv/linux/s390/init-first.c b/sysdeps/unix/sysv/linux/s390/init-first.c deleted file mode 100644 index 63a12d95c8..0000000000 --- a/sysdeps/unix/sysv/linux/s390/init-first.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Initialization code run first thing by the ELF startup code. Linux/s390. - Copyright (C) 2008-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 - . */ - -#include -#include - -long int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *) - attribute_hidden; - -long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *) - __attribute__ ((nocommon)); - -long int (*VDSO_SYMBOL(clock_getres)) (clockid_t, struct timespec *) - __attribute__ ((nocommon)); - -long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *) - attribute_hidden; - -static inline void -_libc_vdso_platform_setup (void) -{ - void *p = get_vdso_symbol ("__kernel_gettimeofday"); - PTR_MANGLE (p); - VDSO_SYMBOL (gettimeofday) = p; - - p = get_vdso_symbol ("__kernel_clock_gettime"); - PTR_MANGLE (p); - VDSO_SYMBOL (clock_gettime) = p; - - p = get_vdso_symbol ("__kernel_clock_getres"); - PTR_MANGLE (p); - VDSO_SYMBOL (clock_getres) = p; - - p = get_vdso_symbol ("__kernel_getcpu"); - PTR_MANGLE (p); - VDSO_SYMBOL (getcpu) = p; -} - -#include diff --git a/sysdeps/unix/sysv/linux/s390/libc-vdso.h b/sysdeps/unix/sysv/linux/s390/libc-vdso.h deleted file mode 100644 index cc97601383..0000000000 --- a/sysdeps/unix/sysv/linux/s390/libc-vdso.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Resolve function pointers to VDSO functions. - Copyright (C) 2008-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 - . */ - - -#ifndef _LIBC_VDSO_H -#define _LIBC_VDSO_H - -#include - -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 *); - -extern long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *) - attribute_hidden; - -#endif /* _LIBC_VDSO_H */ diff --git a/sysdeps/unix/sysv/linux/s390/sysdep.h b/sysdeps/unix/sysv/linux/s390/sysdep.h index eefbd8f007..386efb1896 100644 --- a/sysdeps/unix/sysv/linux/s390/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/sysdep.h @@ -20,8 +20,8 @@ #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 +#define HAVE_CLOCK_GETRES_VSYSCALL "__kernel_clock_getres" +#define HAVE_CLOCK_GETTIME_VSYSCALL "__kernel_clock_gettime" +#define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday" +#define HAVE_GETCPU_VSYSCALL "__kernel_getcpu" diff --git a/sysdeps/unix/sysv/linux/sparc/init-first.c b/sysdeps/unix/sysv/linux/sparc/init-first.c deleted file mode 100644 index bdaa78fd32..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/init-first.c +++ /dev/null @@ -1,42 +0,0 @@ -/* SPARC VDSO initialization - Copyright (C) 2018-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 - . */ - -#include -#include - -long int (*VDSO_SYMBOL (gettimeofday)) (struct timeval *, void *) - attribute_hidden; -long int (*VDSO_SYMBOL (clock_gettime)) (clockid_t, struct timespec *) - attribute_hidden; - -static inline void -_libc_vdso_platform_setup (void) -{ - void *p = get_vdso_symbol ("__vdso_gettimeofday"); - PTR_MANGLE (p); - VDSO_SYMBOL (gettimeofday) = p; - - p = get_vdso_symbol ("__vdso_clock_gettime"); - PTR_MANGLE (p); - VDSO_SYMBOL (clock_gettime) = p; -} - -#define VDSO_SETUP _libc_vdso_platform_setup - -#include diff --git a/sysdeps/unix/sysv/linux/sparc/libc-vdso.h b/sysdeps/unix/sysv/linux/sparc/libc-vdso.h deleted file mode 100644 index d20afcdf04..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/libc-vdso.h +++ /dev/null @@ -1,29 +0,0 @@ -/* VDSO function pointer declarations. - Copyright (C) 2018-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 - . */ - -#ifndef _LIBC_VDSO_H -#define _LIBC_VDSO_H - -#include - -extern long int (*VDSO_SYMBOL(gettimeofday)) (struct timeval *, void *) - attribute_hidden; -extern long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *); - -#endif /* _LIBC_VDSO_H */ diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sysdep.h index 3bfb1fc60e..925b57082d 100644 --- a/sysdeps/unix/sysv/linux/sparc/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sysdep.h @@ -45,8 +45,8 @@ # define VDSO_HASH 61765110 /* List of system calls which are supported as vsyscalls. */ -# define HAVE_CLOCK_GETTIME_VSYSCALL 1 -# define HAVE_GETTIMEOFDAY_VSYSCALL 1 +# define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime" +# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" #undef INLINE_SYSCALL #define INLINE_SYSCALL(name, nr, args...) \ diff --git a/sysdeps/unix/sysv/linux/sysdep-vdso.h b/sysdeps/unix/sysv/linux/sysdep-vdso.h index 5fec208380..3da5417fff 100644 --- a/sysdeps/unix/sysv/linux/sysdep-vdso.h +++ b/sysdeps/unix/sysv/linux/sysdep-vdso.h @@ -19,7 +19,7 @@ #ifndef SYSDEP_VDSO_LINUX_H # define SYSDEP_VDSO_LINUX_H -#define VDSO_SYMBOL(__name) __vdso_##__name +#include #ifndef INTERNAL_VSYSCALL_CALL # define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ diff --git a/sysdeps/unix/sysv/linux/x86/libc-vdso.h b/sysdeps/unix/sysv/linux/x86/libc-vdso.h deleted file mode 100644 index c9aa1c8a72..0000000000 --- a/sysdeps/unix/sysv/linux/x86/libc-vdso.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Resolve function pointers to VDSO functions. - Copyright (C) 2005-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 - . */ - -#ifndef _LIBC_VDSO_H -#define _LIBC_VDSO_H - -#include -#include - -#include - -extern long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *) - attribute_hidden; - -extern long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *) - attribute_hidden; - -#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 deleted file mode 100644 index aede1c858d..0000000000 --- a/sysdeps/unix/sysv/linux/x86_64/init-first.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Initialization code run first thing by the ELF startup code. Linux/x86-64. - Copyright (C) 2007-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 - . */ - -#include -#include -#include -#include - -long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *) - attribute_hidden; -long int (*VDSO_SYMBOL(getcpu)) (unsigned *, unsigned *, void *) - attribute_hidden; - -extern __typeof (clock_gettime) __syscall_clock_gettime attribute_hidden; - - -static inline void -__vdso_platform_setup (void) -{ - void *p = get_vdso_symbol ("__vdso_clock_gettime"); - if (p == NULL) - p = __syscall_clock_gettime; - PTR_MANGLE (p); - VDSO_SYMBOL(clock_gettime) = p; - - p = get_vdso_symbol ("__vdso_getcpu"); - PTR_MANGLE (p); - VDSO_SYMBOL(getcpu) = p; -} - -#define VDSO_SETUP __vdso_platform_setup - -#include diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h index 197329f4dc..4541c0d492 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -374,9 +374,9 @@ # define VDSO_HASH 61765110 /* 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 HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime" +# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" +# define HAVE_GETCPU_VSYSCALL "__vdso_getcpu" # define SINGLE_THREAD_BY_GLOBAL 1 From patchwork Fri Jun 14 15:29:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 166835 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2202305ilk; Fri, 14 Jun 2019 08:30:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwxrQEAcPFjN+fw/BqguQZ16YiEsKirIEtTqOU/aYj1bUU11sqQ5Dq8wVZMakUpm89nXUEs X-Received: by 2002:a62:8c81:: with SMTP id m123mr40929874pfd.240.1560526249495; Fri, 14 Jun 2019 08:30:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560526249; cv=none; d=google.com; s=arc-20160816; b=MSkqExY/YOqLYqTIpG5dqre4XX1PJO0UUUkUQ3tXHa0EzCggdchrQMSngeKjulvcXJ kDqbmvIEnJ/zkLBRkcmUGX9Jh4hkI67sGYSQ4j1rQJtz/hVuI/KF9vNbgg4jupmqP2qF pmSMP1l5ra+Vbe51oK3FavZLJhu+u1UsZUxsglBJT8CK0zdpZaxTRYdQuXIOWiaL6xON Qy1o3MnS/wfwmrU2avmMB2V1XhNrU0Z8mhjzDaVM+PCsk86DkKvaMwrTMSiecoAJb0xT yxkK1Oc6ZnueDfHzK5JyQoUVtV0bdy2Lg1/8gguxd4jY6PeNSljg2AVjEjWtqY59qH5J auVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to: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=Z8zHvf681RtyYmtjdYGZ3mnosDNaCmTFCpW6idSi0zA=; b=eKkZcXM+5Vbgay5sTomEIGNp0GA7YprdOWFi/hbVpqXLX2EXeY9PwF0Vxw9GFY/Tox PwmzOuCuFndlIMyKFdKttVNR+a48Ig+3YZH/6AB5Y/OKkN0Na7i12BR5ZpjSKXPuUOLL m1GPr6y7F8jIacsNh52Zv3z6P4OygtmMjzSh4goJTxRQ+4F3Hw4y9QH0um1jJfKaVct+ 34aHeS2BHiv95B4S8Kx9XfzumyYmsEiLH2NvpIX3NKqz0hvwR5+vgyyVUe5RZ+DgErkH lYrk3NgyZNQuAY5VkViXvhYXPqx0FAGAg268JS6MFm2JLKu83m3t55oQmQaOIAdDAaJK NfsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=KbINcRHB; dkim=pass header.i=@linaro.org header.s=google header.b=NJ7QEFW+; spf=pass (google.com: domain of libc-alpha-return-102742-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102742-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 ay11si2502255plb.263.2019.06.14.08.30.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jun 2019 08:30:49 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-102742-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=KbINcRHB; dkim=pass header.i=@linaro.org header.s=google header.b=NJ7QEFW+; spf=pass (google.com: domain of libc-alpha-return-102742-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102742-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:in-reply-to :references; q=dns; s=default; b=X643KJLHovZcW9PURNVk469Z1WJmbAU YTigsPZP69Zr8DVhQ0keKQLSGliaNlg4zEsAmcgvcZrtMQu7reZlGetfR1oF6aKu /XquE8Wm63PSI067cGMWkaxNJjls12/4/4XGBpiw52Zj9NSg7I7OdQlY8UMIr3IT 0p1jMamtfp+U= 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:in-reply-to :references; s=default; bh=R74HWUCID3hB1+JS4vdyFAe/IZM=; b=KbINc RHB0mU5gDwGGZyWZwtUj6oI4oqHGfMTU/5vgtGmLcI5jDjmc0hjIsUFZvYEs3EDH 0E2yODwjVAk8yj4fX6qJgJCU3ez1+IykgK43VZg9UEEemKBurlGjzcpc58oLTpQ5 yd/0oOcwoMtCTKfHXctpEGl94bS4Ma6o2KfabM= Received: (qmail 118044 invoked by alias); 14 Jun 2019 15:29:28 -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 117953 invoked by uid 89); 14 Jun 2019 15:29:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.0 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= X-HELO: mail-vk1-f195.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=Z8zHvf681RtyYmtjdYGZ3mnosDNaCmTFCpW6idSi0zA=; b=NJ7QEFW+C0+qz5+ZMII42ILtC/tKiwZFkXUWzn0blijw14F36rkjL5tRMAjmbIkNTk 2M2XB5XQjLLMFp2j3BODd7dqW5PT+64dKhbdY5vLkvDcoJKla7lgI7svjlwgqRjCUPRF ll2Z9EUx4/mNu4JFZ4bjtwzqqSoOVflbmQ5rwV3syfdBvSFY3bFZUmtptwNoksSeivmc Rvpup/c3VKrho2qh6zczogz+DYXO64W1UJU9o+oVOvXhEONLm6H1tpOjPPA2BraDkbUx YQVpMnZ/9tDla5X9Yxi0g7r+Z+cjV6CFQffedhcld+yrwa5Yqg57/48ReGfU9xaZ3QoH Pyag== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 08/12] powerpc: Refactor vsyscall internal macros Date: Fri, 14 Jun 2019 12:29:04 -0300 Message-Id: <20190614152908.8101-8-adhemerval.zanella@linaro.org> In-Reply-To: <20190614152908.8101-1-adhemerval.zanella@linaro.org> References: <20190614152908.8101-1-adhemerval.zanella@linaro.org> As described in libc-vdso.h, the powerpc64 vDSO does not provide the function descriptor required by ELFv1 ABI. It requires the architecture to emulate function calls through INTERNAL_VSYSCALL_CALL without odp entries. Another issue is for direct optimized iFUNC calls, where the ifunc goes directly to vDSO instead of a libc wrapper, the libc must create an function table itself (since the program will use the default function call ABI). This patch follows the previous Linux vDSO refactor to make the internal vDSO pointer as the only proxy to access the vDSO. The get_vdso_symbol and get_vdso_mangle_symbol calls are changed for powerpc64 elfv1 to generate the required ODP entries. This allows removes all the internal macros and simplify the code, where compile is free to generate itself a function call when the vDSO is called. Checked on powerpc-linux-gnu, powerpcp64-linux-gnu, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/powerpc/dl-vdso.h: New file. * sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c (get_timebase_freq_fallback): New symbol. (__get_timebase_freq): Call vDSO as a function pointer instead of arch-specific macros. * .../unix/sysv/linux/powerpc/gettimeofday.c (gettimeofday): Use get_vdso_symbol. * sysdeps/unix/sysv/linux/powerpc/time.c (time): Likewise. * sysdeps/unix/sysv/linux/powerpc/libc-vdso.h (VDSO_IFUNC_RET): Move definition to dl-vdso.h. * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h (INTERNAL_VSYSCALL_CALL_TYPE, INTERNAL_VSYSCALL_CALL): Remove. * .../sysv/linux/powerpc/powerpc64/sysdep.h (INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK, INTERNAL_VSYSCALL_CALL_TYPE, INTERNAL_VSYSCALL_CALL): Likewise. * sysdeps/unix/sysv/linux/powerpc/sysdep.h (INTERNAL_VSYSCALL_CALL): Define. --- sysdeps/unix/sysv/linux/powerpc/dl-vdso.h | 69 +++++++++++++++++++ .../sysv/linux/powerpc/get_timebase_freq.c | 22 +++--- .../unix/sysv/linux/powerpc/gettimeofday.c | 4 +- sysdeps/unix/sysv/linux/powerpc/libc-vdso.h | 30 -------- .../sysv/linux/powerpc/powerpc32/sysdep.h | 37 ---------- .../sysv/linux/powerpc/powerpc64/sysdep.h | 52 +------------- sysdeps/unix/sysv/linux/powerpc/sysdep.h | 10 +++ sysdeps/unix/sysv/linux/powerpc/time.c | 4 +- 8 files changed, 97 insertions(+), 131 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/powerpc/dl-vdso.h -- 2.17.1 Reviewed-by: Tulio Magno Quites Machado Filho diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-vdso.h b/sysdeps/unix/sysv/linux/powerpc/dl-vdso.h new file mode 100644 index 0000000000..f6858f02b2 --- /dev/null +++ b/sysdeps/unix/sysv/linux/powerpc/dl-vdso.h @@ -0,0 +1,69 @@ +/* ELF symbol resolve functions for VDSO objects. PowerPC version. + Copyright (C) 2005-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 + . */ + +#ifndef _DL_VDSO_POWERPC_H +#define _DL_VDSO_POWERPC_H 1 + +#if (defined(__PPC64__) || defined(__powerpc64__)) && _CALL_ELF != 2 + +# include +# define get_vdso_symbol __get_vdso_symbol +# define get_vdso_mangle_symbol __get_vdso_mangle_symbol +# include_next +# undef get_vdso_symbol +# undef get_vdso_mangle_symbol + +/* The correct solution is for _dl_vdso_vsym to return the address of the OPD + for the kernel VDSO function. That address would then be stored in the + __vdso_* variables and returned as the result of the IFUNC resolver function. + Yet, the kernel does not contain any OPD entries for the VDSO functions + (incomplete implementation). However, PLT relocations for IFUNCs still expect + the address of an OPD to be returned from the IFUNC resolver function (since + PLT entries on PPC64 are just copies of OPDs). The solution for now is to + create an artificial static OPD for each VDSO function returned by a resolver + function. The TOC value is set to a non-zero value to avoid triggering lazy + symbol resolution via .glink0/.plt0 for a zero TOC (requires thread-safe PLT + sequences) when the dynamic linker isn't prepared for it e.g. RTLD_NOW. None + of the kernel VDSO routines use the TOC or AUX values so any non-zero value + will work. Note that function pointer comparisons will not use this artificial + static OPD since those are resolved via ADDR64 relocations and will point at + the non-IFUNC default OPD for the symbol. Lastly, because the IFUNC relocations + are processed immediately at startup the resolver functions and this code need + not be thread-safe, but if the caller writes to a PLT slot it must do so in a + thread-safe manner with all the required barriers. */ +#define get_vdso_symbol(symbol) \ + ({ \ + static Elf64_FuncDesc vdso_opd_##symbol = { .fd_toc = ~0x0 }; \ + vdso_opd_##symbol.fd_func = (Elf64_Addr) __get_vdso_symbol (symbol); \ + (void*)&vdso_opd_##symbol; \ + }) + +#define get_vdso_mangle_symbol(symbol) \ + ({ \ + static Elf64_FuncDesc vdso_opd_##symbol = { .fd_toc = ~0x0 }; \ + vdso_opd_##symbol.fd_func = (Elf64_Addr) __get_vdso_symbol (symbol); \ + void *vdsop = &vdso_opd_##symbol; \ + PTR_MANGLE (vdsop); \ + vdsop; \ + }) + +#else +# include_next +#endif + +#endif diff --git a/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c b/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c index 23e7694d87..b551412356 100644 --- a/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c +++ b/sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c @@ -23,17 +23,11 @@ #include #include -uint64_t -__get_timebase_freq (void) +static uint64_t +get_timebase_freq_fallback (void) { hp_timing_t result = 0L; -#ifdef SHARED - /* The vDSO does not return an error (it clear cr0.so on returning). */ - INTERNAL_SYSCALL_DECL (err); - result = - INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK (get_tbfreq, err, uint64_t, 0); -#else /* We read the information from the /proc filesystem. /proc/cpuinfo contains at least one line like: timebase : 33333333 @@ -99,8 +93,18 @@ __get_timebase_freq (void) } } } -#endif return result; } + +uint64_t +__get_timebase_freq (void) +{ + /* The vDSO does not have a fallback mechanism (such calling a syscall). */ + __typeof (VDSO_SYMBOL (get_tbfreq)) vdsop = VDSO_SYMBOL (get_tbfreq); + if (vdsop == NULL) + return get_timebase_freq_fallback (); + PTR_DEMANGLE (vdsop); + return vdsop (); +} weak_alias (__get_timebase_freq, __ppc_get_timebase_freq) diff --git a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c index 6b92e2807b..7a4e3cca0c 100644 --- a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c +++ b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c @@ -58,13 +58,13 @@ __gettimeofday_syscall (struct timeval *tv, struct timezone *tz) } # define INIT_ARCH() \ - void *vdso_gettimeofday = get_vdso_symbol ("__kernel_gettimeofday") + void *vdso_gettimeofday = get_vdso_symbol (HAVE_GETTIMEOFDAY_VSYSCALL) /* If the vDSO is not available we fall back syscall. */ libc_ifunc_hidden (__redirect___gettimeofday, __gettimeofday, vdso_gettimeofday - ? VDSO_IFUNC_RET (vdso_gettimeofday) + ? vdso_gettimeofday : (void *) __gettimeofday_syscall); libc_hidden_def (__gettimeofday) diff --git a/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h b/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h index 47e925493b..c2da7bd7f1 100644 --- a/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h +++ b/sysdeps/unix/sysv/linux/powerpc/libc-vdso.h @@ -32,34 +32,4 @@ extern void *VDSO_SYMBOL(sigtramp32); extern void *VDSO_SYMBOL(sigtramp_rt32); #endif -#if (defined(__PPC64__) || defined(__powerpc64__)) && _CALL_ELF != 2 -/* The correct solution is for _dl_vdso_vsym to return the address of the OPD - for the kernel VDSO function. That address would then be stored in the - __vdso_* variables and returned as the result of the IFUNC resolver function. - Yet, the kernel does not contain any OPD entries for the VDSO functions - (incomplete implementation). However, PLT relocations for IFUNCs still expect - the address of an OPD to be returned from the IFUNC resolver function (since - PLT entries on PPC64 are just copies of OPDs). The solution for now is to - create an artificial static OPD for each VDSO function returned by a resolver - function. The TOC value is set to a non-zero value to avoid triggering lazy - symbol resolution via .glink0/.plt0 for a zero TOC (requires thread-safe PLT - sequences) when the dynamic linker isn't prepared for it e.g. RTLD_NOW. None - of the kernel VDSO routines use the TOC or AUX values so any non-zero value - will work. Note that function pointer comparisons will not use this artificial - static OPD since those are resolved via ADDR64 relocations and will point at - the non-IFUNC default OPD for the symbol. Lastly, because the IFUNC relocations - are processed immediately at startup the resolver functions and this code need - not be thread-safe, but if the caller writes to a PLT slot it must do so in a - thread-safe manner with all the required barriers. */ -#define VDSO_IFUNC_RET(value) \ - ({ \ - static Elf64_FuncDesc vdso_opd = { .fd_toc = ~0x0 }; \ - vdso_opd.fd_func = (Elf64_Addr)value; \ - &vdso_opd; \ - }) - -#else -#define VDSO_IFUNC_RET(value) ((void *) (value)) -#endif - #endif /* _LIBC_VDSO_H */ diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h index f459543fcd..889c6ac117 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h @@ -34,43 +34,6 @@ # include -/* 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. - On powerpc a system call basically clobbers the same registers like a - 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_CALL_TYPE(funcptr, err, nr, type, args...) \ - ({ \ - register void *r0 __asm__ ("r0"); \ - register long int r3 __asm__ ("r3"); \ - register long int r4 __asm__ ("r4"); \ - register long int r5 __asm__ ("r5"); \ - register long int r6 __asm__ ("r6"); \ - register long int r7 __asm__ ("r7"); \ - register long int r8 __asm__ ("r8"); \ - register long int r9 __asm__ ("r9"); \ - register long int r10 __asm__ ("r10"); \ - register long int r11 __asm__ ("r11"); \ - register long int r12 __asm__ ("r12"); \ - register type rval __asm__ ("r3"); \ - LOADARGS_##nr (funcptr, args); \ - __asm__ __volatile__ \ - ("mtctr %0\n\t" \ - "bctrl\n\t" \ - "mfcr %0" \ - : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7), \ - "+r" (r8), "+r" (r9), "+r" (r10), "+r" (r11), "+r" (r12) \ - : : "cr0", "ctr", "lr", "memory"); \ - err = (long int) r0; \ - __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3), "r" (r4)); \ - rval; \ - }) - -#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ - INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, nr, long int, args) - # undef INLINE_SYSCALL # define INLINE_SYSCALL(name, nr, args...) \ ({ \ diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h index 06222f52e6..4e507db00d 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h @@ -45,59 +45,9 @@ #endif /* __ASSEMBLER__ */ -/* 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; \ - \ - __typeof (__vdso_##name) vdsop = __vdso_##name; \ - PTR_DEMANGLE (vdsop); \ - if (vdsop != NULL) \ - sc_ret = \ - INTERNAL_VSYSCALL_CALL_TYPE (vdsop, err, type, nr, ##args); \ - else \ - err = 1 << 28; \ - sc_ret; \ - }) - -/* 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 - 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_CALL_TYPE(funcptr, err, type, nr, args...) \ - ({ \ - register void *r0 __asm__ ("r0"); \ - register long int r3 __asm__ ("r3"); \ - register long int r4 __asm__ ("r4"); \ - register long int r5 __asm__ ("r5"); \ - register long int r6 __asm__ ("r6"); \ - register long int r7 __asm__ ("r7"); \ - register long int r8 __asm__ ("r8"); \ - register type rval __asm__ ("r3"); \ - LOADARGS_##nr (funcptr, args); \ - __asm__ __volatile__ \ - ("mtctr %0\n\t" \ - "bctrl\n\t" \ - "mfcr %0\n\t" \ - "0:" \ - : "+r" (r0), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), \ - "+r" (r7), "+r" (r8) \ - : : "r9", "r10", "r11", "r12", "cr0", "ctr", "lr", "memory"); \ - err = (long int) r0; \ - __asm__ __volatile__ ("" : "=r" (rval) : "r" (r3)); \ - rval; \ - }) - -#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ - INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, long int, nr, args) - -#undef INLINE_SYSCALL - /* This version is for kernels that implement system calls that behave like function calls as far as register saving. */ +#undef INLINE_SYSCALL #define INLINE_SYSCALL(name, nr, args...) \ ({ \ INTERNAL_SYSCALL_DECL (sc_err); \ diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/sysdep.h index 20167615c8..cf967a8c33 100644 --- a/sysdeps/unix/sysv/linux/powerpc/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h @@ -24,6 +24,7 @@ #define HAVE_CLOCK_GETTIME_VSYSCALL "__kernel_clock_gettime" #define HAVE_GETCPU_VSYSCALL "__kernel_getcpu" #define HAVE_TIME_VSYSCALL "__kernel_time" +#define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday" #define HAVE_GET_TBFREQ "__kernel_get_tbfreq" #if defined(__PPC64__) || defined(__powerpc64__) @@ -32,3 +33,12 @@ # define HAVE_SIGTRAMP_32 "__kernel_sigtramp32" # define HAVE_SIGTRAMP_RT32 "__kernel_sigtramp_rt32" #endif + +#ifndef __ASSEMBLER__ + +/* PowerPC vDSO symbols always succeed, so there is no need to emulate a + function call and check for CR0.SO value. */ +#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ + ({ err = 0; funcptr (args); }) + +#endif /* __ASSEMBLER__ */ diff --git a/sysdeps/unix/sysv/linux/powerpc/time.c b/sysdeps/unix/sysv/linux/powerpc/time.c index 53fd119b00..ca6721cf95 100644 --- a/sysdeps/unix/sysv/linux/powerpc/time.c +++ b/sysdeps/unix/sysv/linux/powerpc/time.c @@ -67,12 +67,12 @@ time_syscall (time_t *t) } # define INIT_ARCH() \ - void *vdso_time = get_vdso_symbol ("__kernel_time"); + void *vdso_time = get_vdso_symbol (HAVE_TIME_VSYSCALL); /* If the vDSO is not available we fall back to the syscall. */ libc_ifunc_hidden (__redirect_time, time, vdso_time - ? VDSO_IFUNC_RET (vdso_time) + ? vdso_time : (void *) time_syscall); libc_hidden_def (time) From patchwork Fri Jun 14 15:29:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 166834 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2201838ilk; Fri, 14 Jun 2019 08:30:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxSwzVSyU7g+2d9TSOlVGJBgtKwE6nzZMLTM5KM01cV5zvSGwhNXWU4vtMhMbhH75vWrB9q X-Received: by 2002:a62:1990:: with SMTP id 138mr99684587pfz.133.1560526225678; Fri, 14 Jun 2019 08:30:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560526225; cv=none; d=google.com; s=arc-20160816; b=DqffEuEEQJ33CUd18tBcuZW9W/mvVIxXgwaq5FROiB/OCI/sSfaZ5r7Oc305sNMLxP Zkwm08o6pxNdmqZZa5VkM/mZVTuwFUoOrFulOGERNWOoKQgp83tdvzRqDDZygIm2FCXn kNWOwb6Oem3PP4KLjZDOSUPBS4n9VRpKfV7+g8dQ32e1aizRVk6q0GFd1vuTR9yEr1aU WDsB+xRUU8Y1hQfBxl+Zs71YRbdIOME9+yScOpUjCqefTUJD+oB9TieK3HJM9SQZL3+h GDmV9vzm545Sr9dXBUM7BXsAOXCq/DF6jG2Q5zU+sAYdd385IRh+yHm/2riBArfNutH8 IqSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to: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=gwUlLK9DTxZpgKw8a8M/qTuEBhoxxCH3anBUMULq41c=; b=zARGjR4Ew6K8qaqBjHKjIjpOwWnoiiPwWOCx1fLYlhJMo6Psy0nxB5f79Kr5LDhUtR oh6qYPyCZMWTitacYtz44JGotpcxHGXQcdXppzoCNNZm8nKxfs7oVQo3uVJqggMuAnSe A72QVWS0recqnPgWEqRnrTwo82D+w5C7qh6Kd5llMkl+AjR00nFDsrTd7B+rEirmH2ko UwQQmNfgyO0XGj3d2riYNOjT+VzX3bf+a1oRwND29Df2IffBQ0VkldLkAYleyyXUibvx D2ao8TBCGO1KmGJI7sR+RzyIF7PQB52aHTCn3hs7RVBPwAiv7Ib2p3WmoIOLJhAUVFwu dIrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=DoADijhI; dkim=pass header.i=@linaro.org header.s=google header.b=cTIxc5Y7; spf=pass (google.com: domain of libc-alpha-return-102740-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102740-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 a129si2846715pfa.200.2019.06.14.08.30.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jun 2019 08:30:25 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-102740-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=DoADijhI; dkim=pass header.i=@linaro.org header.s=google header.b=cTIxc5Y7; spf=pass (google.com: domain of libc-alpha-return-102740-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102740-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:in-reply-to :references; q=dns; s=default; b=G0/yX96luRoFlDh8daJGJqqvjN9LrvZ UmUsLr0WVks09ZfuwzNZ42OdzE+m/t7mJV8cavl/dBEpAxpE0FfzrWMSmrTwZZ82 NK7tPdCOxHdfdDxaDzvypxdDdzZptQ0fi2ieGhlwozpjsmQXQMI+l+gxvMdpwaxO juq2Dv6plDkI= 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:in-reply-to :references; s=default; bh=pQspx06S0kWLVMl73gnYpOIwKe4=; b=DoADi jhItYj7SCO1cZkP27wNQW+bSM+D0HEPSCigxsvVDb04ESibU846DniGFGBbZ1tqB sNFgAdRjEtzKjxiElrWCjj9rUG29P6xowIJuUDkLnJ6heRKdcpBVnqFbfo71lX1w ALw929LQg03uiG56LEPtZ7UzgULQvjAFPUrtAU= Received: (qmail 117722 invoked by alias); 14 Jun 2019 15:29:26 -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 117666 invoked by uid 89); 14 Jun 2019 15:29:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=Consolidate, emulate, $25, H*RU:209.85.221.195 X-HELO: mail-vk1-f195.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=gwUlLK9DTxZpgKw8a8M/qTuEBhoxxCH3anBUMULq41c=; b=cTIxc5Y7seKEDKWjLwtGzaWAePFHrb5qQG93dcNaK6R9P5r8QFG7cypGRYdUQWYqsV yAd3r0FMNDoh17ckDfZbddmrpn3Z93emcIEstDi+a/y8OOs5tjmCKhyCEuUb7rx/oC4k PACEKUQNLiAuu8gdRehtp5+Ycf2mUsqOO2l1Zu5zT4vOPVV1oWCX7ONR7LO8D9eqWU+1 hC/zrLjaakJYud7zcn1JJ1W7pKPPHsXxruA3tBAqrPFGKDry83Uj1EvhVtbcvqheys9j PaBJd4PU5B5B101Oha3uCq/H6C2HVZPKIAlJnpDPanDQtGQ0I/opQ4+ZfR9A91s3aBfE wDxg== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 09/12] mips: Consolidate INTERNAL_VSYSCALL_CALL Date: Fri, 14 Jun 2019 12:29:05 -0300 Message-Id: <20190614152908.8101-9-adhemerval.zanella@linaro.org> In-Reply-To: <20190614152908.8101-1-adhemerval.zanella@linaro.org> References: <20190614152908.8101-1-adhemerval.zanella@linaro.org> This patch consolidates the mips, mips64, and mips64-n32 INTERNAL_VSYSCALL_CALL on a single implementation. No semantic changes. I checked against a build for mips-linux-gnu, mips64-linux-gnu, and mips64-n32-linux-gnu. * sysdeps/unix/sysv/linux/mips/mips32/sysdep.h (INTERNAL_VSYSCALL_CALL): Remove. * sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h (INTERNAL_VSYSCALL_CALL): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h (INTERNAL_VSYSCALL_CALL): Likewise. * sysdeps/unix/sysv/linux/mips/sysdep.h (INTERNAL_VSYSCALL_CALL): New macro. --- sysdeps/unix/sysv/linux/mips/mips32/sysdep.h | 12 ------------ sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h | 12 ------------ sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h | 12 ------------ sysdeps/unix/sysv/linux/mips/sysdep.h | 16 ++++++++++++++++ 4 files changed, 16 insertions(+), 36 deletions(-) -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h index ebe397b701..bfcb916f15 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h @@ -349,18 +349,6 @@ libc_hidden_proto (__mips_syscall7, nomips16) #define __SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", \ "$14", "$15", "$24", "$25", "hi", "lo", "memory" -/* Standard MIPS syscalls have an error flag, and return a positive errno - when the error flag is set. Emulate this behaviour for vsyscalls so that - the INTERNAL_SYSCALL_{ERROR_P,ERRNO} macros work correctly. */ -#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ - ({ \ - long _ret = funcptr (args); \ - err = ((unsigned long) (_ret) >= (unsigned long) -4095L); \ - if (err) \ - _ret = -_ret; \ - _ret; \ - }) - #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 bb49429c30..49e94a1706 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h @@ -297,18 +297,6 @@ #define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \ "$14", "$15", "$24", "$25", "hi", "lo", "memory" -/* Standard MIPS syscalls have an error flag, and return a positive errno - when the error flag is set. Emulate this behaviour for vsyscalls so that - the INTERNAL_SYSCALL_{ERROR_P,ERRNO} macros work correctly. */ -#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ - ({ \ - long _ret = funcptr (args); \ - err = ((unsigned long) (_ret) >= (unsigned long) -4095L); \ - if (err) \ - _ret = -_ret; \ - _ret; \ - }) - #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 84a1ff186b..5911a62e5b 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h @@ -293,18 +293,6 @@ #define __SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", "$13", \ "$14", "$15", "$24", "$25", "hi", "lo", "memory" -/* Standard MIPS syscalls have an error flag, and return a positive errno - when the error flag is set. Emulate this behaviour for vsyscalls so that - the INTERNAL_SYSCALL_{ERROR_P,ERRNO} macros work correctly. */ -#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ - ({ \ - long _ret = funcptr (args); \ - err = ((unsigned long) (_ret) >= (unsigned long) -4095L); \ - if (err) \ - _ret = -_ret; \ - _ret; \ - }) - #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 index 58a7244581..77b1f9c2fb 100644 --- a/sysdeps/unix/sysv/linux/mips/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/sysdep.h @@ -22,3 +22,19 @@ /* List of system calls which are supported as vsyscalls. */ #define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_gettimeofday" #define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_clock_gettime" + +#ifndef __ASSEMBLER__ + +/* Standard MIPS syscalls have an error flag, and return a positive errno + when the error flag is set. Emulate this behaviour for vsyscalls so that + the INTERNAL_SYSCALL_{ERROR_P,ERRNO} macros work correctly. */ +#define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ + ({ \ + long _ret = funcptr (args); \ + err = ((unsigned long) (_ret) >= (unsigned long) -4095L); \ + if (err) \ + _ret = -_ret; \ + _ret; \ + }) + +#endif /* __ASSEMBLER__ */ From patchwork Fri Jun 14 15:29:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 166836 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2202122ilk; Fri, 14 Jun 2019 08:30:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2KNZa/bxewZ/Rvy6H/7WkjB+V5L9Cug2Axetu9r9wUZzagZR8wMAfN2H0In0SUSY65fLy X-Received: by 2002:a65:508b:: with SMTP id r11mr5757302pgp.387.1560526240160; Fri, 14 Jun 2019 08:30:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560526240; cv=none; d=google.com; s=arc-20160816; b=IgZHlV1Lb47g+IM4DSZb/aAK8Lo32rJOEg6e/QKNECT18HaM+XSK3H4MNiPLWS5cMk vAhiesybMb1NkkHj2j5LwFGT1hCTXJ9CsFoWD2P7jejX27BlzhTFbAuHg5+hE08RMx/D p2dGzXd9sFjCC27lkNlUg1OO+t8vczPcjIjlQx82GmXxlb2d6sFDb/ZhBmTu+HSqn+bm Km3tk1pmK4XrunJP7PXubE9nzvcRxcwFMMZtD0WagcKJvK6t3isawXuD42m2VbQk+ABX Pk4fgcRVCyeFcRWShDTPds+QK3fw5iN4mfJNtO9H0/kFpXf2UW1H3GiA+K5GMVL4TOk/ hvTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to: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=a2hhNon9R39tQEg3zKHZ8tICMNEpxzwjxLO9GgnyuHc=; b=evAmFjaCvo2VjUuY16Anov1NVPZw+yHx0bccV9aN597xlgLXbZt8weWXFWyFftYOpn QvdsX3TmFg0KbBOjGhB9sbS5YLX7ID78bbMimnqkx1FRcXuLdFQvByV50CCKhGbKrGOd cJaHhhfVL7H/++K+AhF5h1FgR30QW6kE6QnDvWyrbXIF6c+rWcBLFwhV779SoqTFRz+3 1XSTaLkRToqzIjl55GaQyuhYXi6Hwbhiojqjta4ENMgPOGfVnZYbg3ZVYmRV288uqw7B tEeXmxnpcZA64Tp4BB53qnOCeefgPtzHsRi17GjWw9bzbeAUBplzlMNb5gIC0Wc20Bat dhwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=GmkSBoIK; dkim=pass header.i=@linaro.org header.s=google header.b="qbnvm/3P"; spf=pass (google.com: domain of libc-alpha-return-102741-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102741-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 204si2839142pgd.520.2019.06.14.08.30.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jun 2019 08:30:40 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-102741-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=GmkSBoIK; dkim=pass header.i=@linaro.org header.s=google header.b="qbnvm/3P"; spf=pass (google.com: domain of libc-alpha-return-102741-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102741-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:in-reply-to :references; q=dns; s=default; b=L2uKNPUqq1kKsPh7VP+TE3ZSvDug5Z2 cI1lspvay2nuVKDFkv0DctvVcnAl0qIG1OeLBJOZ3mjp7e78G+NaYc42h8Tje1TO rDJnQf1f+QP10G90aApKD3Uj4+A32xtHDrCOaBWizgPI1QhPysy+caA58MRbIlix SCMBXdyDOzqM= 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:in-reply-to :references; s=default; bh=sib1OYOaMtWG8J+/DLpEq6OsYLE=; b=GmkSB oIKDNrpIREFFwLwqHUYcJabX0ubuID3lfFCOgQP5FIveBv8uhIT0Vc79WYnvtwvK Q+AymvQtMR5T/kKWYTwzGtj5COGg8x2SLpRcsIrq4/o1fgmR0UgF4rZZDokCtz98 RP2gX9+SSVvqLr1w5mBL4V74dKbYK8hElIT/wc= Received: (qmail 117829 invoked by alias); 14 Jun 2019 15:29:27 -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 117714 invoked by uid 89); 14 Jun 2019 15:29:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=POSIX, route, HX-Received:a854, HX-Spam-Relays-External:209.85.221.195 X-HELO: mail-vk1-f195.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=a2hhNon9R39tQEg3zKHZ8tICMNEpxzwjxLO9GgnyuHc=; b=qbnvm/3PI6HKd4sgUX0XlDNG9R6zUFSnX0AKa16uTV9KXJ4JFdbB5yh1CptSs3b36c yv2t56epvZK2OQ+F4nW61Cn+AvRz+4v8Gleo32d/5zBqmxuPAlGbuXmctYPLXnarg3iR bJE2x/sSfWwHzeyfkQruR6m9/I5kqT/zN9y0R/3PAESiPrnBN4myjwRVWqljvIewVOuP Tbeu3waJV0AziQ8M4CbJ7Q1RdjtqF2cm16inRCVYmBYIiQNeGsALFMmZj4IxvxlZH8tC iAX77D0f+Zq7A8k+8zYSOqnj4bXuR2C1ccAaaQEU2x/GwBzhzrTX+OwH+XVVNCOA8LQO M2OA== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 10/12] sparc64: Use linux generic time implementation Date: Fri, 14 Jun 2019 12:29:06 -0300 Message-Id: <20190614152908.8101-10-adhemerval.zanella@linaro.org> In-Reply-To: <20190614152908.8101-1-adhemerval.zanella@linaro.org> References: <20190614152908.8101-1-adhemerval.zanella@linaro.org> There is no need to sparc64 provide an arch-specific implementation to route to POSIX one (which uses gettimeofday). Linux one already handles the case for architecture that does not have __NR_time. No semantic changes, checked against a build for sparc64-linux-gnu. * sysdeps/unix/sysv/linux/sparc/sparc64/time.c: Remove file. --- sysdeps/unix/sysv/linux/sparc/sparc64/time.c | 1 - 1 file changed, 1 deletion(-) delete mode 100644 sysdeps/unix/sysv/linux/sparc/sparc64/time.c -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/time.c b/sysdeps/unix/sysv/linux/sparc/sparc64/time.c deleted file mode 100644 index 509b580c55..0000000000 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/time.c +++ /dev/null @@ -1 +0,0 @@ -#include From patchwork Fri Jun 14 15:29:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 166838 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2202740ilk; Fri, 14 Jun 2019 08:31:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqw8qtlX7HBeuQNdRZzwOvFqxYfN0pZRUzRxDI5wVraJc407S2xjt1zSTByBxfoxCK49wkGP X-Received: by 2002:a17:90a:aa0a:: with SMTP id k10mr12048012pjq.43.1560526272985; Fri, 14 Jun 2019 08:31:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560526272; cv=none; d=google.com; s=arc-20160816; b=sp5fBBvVxYevURXiw9Q7OyDAq7KLooVAT8ucZsuIHYIxNSZ6rGqJKSKSHQKx84MRZK Y8XoYEmP3vRElosRba8PJ4QdYoS44dM6jSPh4gEBWXd+pEm8jP9RR5vdu9eB+tHK0pm2 soiizdBalnaLo4jzWAQHGoUFE0eTSs7J7LJ7fNSfP4CzULi/OtjN8m9d6oXkbTdR5jRy qitsF+zk0C8jHOruIT9j7UAceTt/9qVXeN8ch4+xpaSAt71QxntIZUuMq5PrUiMZfS3t GqRT1n6QknqO2bkKhJXh1uaiGpY8pdUuxXquaHLTZIM8ShoYBwpNg0nKGBU+XFx82Kar Tp2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to: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=9mx2Zq7+E5rqyKV5yIwk6jVCstmUNz+A750UrBVIDAw=; b=IdH8pox/P+DZ9J/r6bC9UayeD+8f5l+/sDuN63sodRPNiChqtVmQia3FCF3y679euK DrBtyI1eA7YcMFk6nLTVJxmKAHKwH8xF6MlD4VGgI7GJrFCU1RzLDurq4kJJCCFVm2S/ x+pHiui02TOpsyQCwoq+sgh9IARN14ubd7bhk8DF7MEEm/2NVsU7U08fXb6e7OAlaaVx ynxBsiDCrx9md7/rp3i2CRgaKlBJKRVXK0WFvR2Dw62/pxHeFWSo7AwvQGIVxUROKWz/ /cl+aJE2t/FYs/w8mcRSrTxhUHF3o6zFWPAsCWVGDKcxK+wDaup/igkGWHOUFJWOiS8u oUhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=JlfpyqMK; dkim=pass header.i=@linaro.org header.s=google header.b=TDxbgDen; spf=pass (google.com: domain of libc-alpha-return-102744-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102744-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 n34si2113398pld.202.2019.06.14.08.31.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jun 2019 08:31:12 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-102744-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=JlfpyqMK; dkim=pass header.i=@linaro.org header.s=google header.b=TDxbgDen; spf=pass (google.com: domain of libc-alpha-return-102744-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102744-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:in-reply-to :references; q=dns; s=default; b=oOAEbTkKNpoXiVVLL2udhGYRR+dAIHx PGumhRImDpo8/PHJeTIMS8tTl5pJJQRpAupAZQg77NwhzNLebAHmDvhOl+UJ9Ucw WHYIh5FfRlyWULcQYZsEvEjmzovOfdCniiwB92OA4uG0JFhZDD3P9imG7fJ3ib3o YEaAPJbjaFRw= 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:in-reply-to :references; s=default; bh=51zOexYZVnTWD9xvMcC/iG9UeAI=; b=Jlfpy qMKO9rcKmLdrUbmzUmW+EVFQsWJV7Fpe9DGcgqEW+SbvkhfqBNyN/EsVOH2CypcK BZFi1EWIHd7aUoIx3PmOrHwjJy2klEq26pZ4A/Tzn6UMebXlJsZJO2JrFg5Vw6tu UWFmLjJLqioq6VE7GKV9CzvB+ncitrQYrhhip8= Received: (qmail 118531 invoked by alias); 14 Jun 2019 15:29: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 118370 invoked by uid 89); 14 Jun 2019 15:29:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.6 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, RCVD_IN_JMF_BR, SPF_PASS, T_FILL_THIS_FORM_SHORT autolearn=ham version=3.3.1 spammy=HX-Received:ea04, 1527 X-HELO: mail-vs1-f66.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=9mx2Zq7+E5rqyKV5yIwk6jVCstmUNz+A750UrBVIDAw=; b=TDxbgDen3lp8BYQOjEFZySBw0WLdQShjtv2bNgD0rAX314MG1slukZb6/FLN2FU0zF +UtpJWvYZNi7RPWjfljhoOEsikQz4x+8QptucTGqr6j2Ma2hvNgf/QMAH/zvh8i5ELxA ky1lxxjp3vDkaXkv48kLMO1IirXYiT9K1N5t5ImHuE6M69wnjOc+txuPjtzwhwN5bQSO LFh7YMDMiTI9gDSj4+goTzt9yUXUwzYmKews5+U73WH20oM2ZSHFr38ph5jT5fILSxt/ f53ekWOYC/KbBT3Qw9fxcL4vfBBh8vLhOGnnYHicLnJEcGj7e5MGzTHI07km5cLtJWVH 8d7A== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 11/12] linux: Consolidate time implementation Date: Fri, 14 Jun 2019 12:29:07 -0300 Message-Id: <20190614152908.8101-11-adhemerval.zanella@linaro.org> In-Reply-To: <20190614152908.8101-1-adhemerval.zanella@linaro.org> References: <20190614152908.8101-1-adhemerval.zanella@linaro.org> The time syscall has currently 3 possible implementations: 1. Wire-up __NR_time with a vDSO implementation (currently only x86 and powerpc). 2. Wire-up __NR_time (hppa, i686, m68k, microblaze, mips, powerpc, powerpc64, s390, sh4, sparcv9, x86_64). 3. Using internal gettimeofday (aarch64, alpha, arm, mips64, mips64-n32, nios2, s390x, sparc64). This patch consolidates all implementation on Linux generic sysdeps/unix/sysv/linux/time.c. To simplify the code, some changes are made: * The wire-up with vDSO implementation route external calls directly to vDSO through IFUNC. To enable it the architecture need to explicit define USE_TIME_VSYSCALL_IFUNC. * Also, powerpc and x86 tries to route internal time usages to IFUNC mechanism, which is problematic since powerpc32 and i686 does not really support it. Instead, all internal calls are routed to a default internal symbol which in turn calls INTERNAL_VSYSCALL. * Static linking also uses the fallback mechanism which calls INTERNAL_VSYSCALL, so vDSO is used for this case as well. The generic implementation issues a syscall as default, calls the vDSO if the architecture defines HAVE_TIME_VSYSCALL, and route the external calls to iFUNC if the architecture also defines USE_TIME_VSYSCALL_IFUNC. Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc-linux-gnu, powerpc64-linux-gnu, powerpc64le-linux-gnu, and aarch64-linux-gnu. * include/libc-symbols.h (hidden_def_redir): New macro. * sysdeps/unix/sysv/linux/i386/sysdep.h (HAVE_TIME_VSYSCALL, USE_TIME_VSYSCALL_IFUNC): Define. * sysdeps/unix/sysv/linux/x86_64/sysdep.h (HAVE_TIME_VSYSCALL, USE_TIME_VSYSCALL_IFUNC): Likewise. * sysdeps/unix/sysv/linux/powerpc/sysdep.h (USE_TIME_VSYSCALL_IFUNC): Likewise. * sysdeps/unix/sysv/linux/i386/time.c: Remove file. * sysdeps/unix/sysv/linux/x86/time.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/time.c: Likewise. * sysdeps/unix/sysv/linux/time.c (time): Handle all possible Linux implementations (wire-up syscall, vDSO implementation, iFUNC). (time_syscall): New function. --- include/libc-symbols.h | 5 ++ sysdeps/unix/sysv/linux/i386/sysdep.h | 2 + sysdeps/unix/sysv/linux/i386/time.c | 34 ---------- sysdeps/unix/sysv/linux/powerpc/sysdep.h | 1 + sysdeps/unix/sysv/linux/powerpc/time.c | 83 ------------------------ sysdeps/unix/sysv/linux/time.c | 53 ++++++++++++--- sysdeps/unix/sysv/linux/x86/time.c | 60 ----------------- sysdeps/unix/sysv/linux/x86_64/sysdep.h | 2 + 8 files changed, 55 insertions(+), 185 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/i386/time.c delete mode 100644 sysdeps/unix/sysv/linux/powerpc/time.c delete mode 100644 sysdeps/unix/sysv/linux/x86/time.c -- 2.17.1 diff --git a/include/libc-symbols.h b/include/libc-symbols.h index b68ec4b7f5..dc6f2e31e2 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -548,6 +548,7 @@ for linking") # define hidden_ver(local, name) __hidden_ver1(local, __GI_##name, name); # define hidden_data_ver(local, name) hidden_ver(local, name) # define hidden_def(name) __hidden_ver1(__GI_##name, name, name); +# define hidden_def_redir(redir, name) __hidden_ver1(redir, __GI_##name, redir); # define hidden_data_def(name) hidden_def(name) # define hidden_tls_def(name) \ __hidden_ver2 (__thread, __GI_##name, name, name); @@ -575,6 +576,7 @@ for linking") hidden_proto doesn't make sense for assembly but the equivalent is to call via the HIDDEN_JUMPTARGET macro instead of JUMPTARGET. */ # define hidden_def(name) strong_alias (name, __GI_##name) +# define hidden_def_redir(redir, name) strong_alias(redir, __GI_##name); # define hidden_weak(name) hidden_def (name) # define hidden_ver(local, name) strong_alias (local, __GI_##name) # define hidden_data_def(name) strong_data_alias (name, __GI_##name) @@ -605,6 +607,7 @@ for linking") # endif /* Not __ASSEMBLER__ */ # define hidden_weak(name) # define hidden_def(name) +# define hidden_def_redir(redir, name) # define hidden_ver(local, name) # define hidden_data_weak(name) # define hidden_data_def(name) @@ -617,6 +620,7 @@ for linking") # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs) # define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs) # define libc_hidden_def(name) hidden_def (name) +# define libc_hidden_def_redir(redir, name) hidden_def_redir (redir, name) # define libc_hidden_weak(name) hidden_weak (name) # ifdef LINK_OBSOLETE_RPC /* libc_hidden_nolink_sunrpc should only get used in sunrpc code. */ @@ -633,6 +637,7 @@ for linking") # define libc_hidden_proto(name, attrs...) # define libc_hidden_tls_proto(name, attrs...) # define libc_hidden_def(name) +# define libc_hidden_def_redir(redir, name) # define libc_hidden_weak(name) # define libc_hidden_ver(local, name) # define libc_hidden_data_def(name) diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index e793fdc936..4f79f25989 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -315,6 +315,8 @@ struct libc_do_syscall_args /* List of system calls which are supported as vsyscalls. */ # define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime" # define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" +# define HAVE_TIME_VSYSCALL "__vdso_time" +# define USE_TIME_VSYSCALL_IFUNC 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/i386/time.c b/sysdeps/unix/sysv/linux/i386/time.c deleted file mode 100644 index 440e3e6ab4..0000000000 --- a/sysdeps/unix/sysv/linux/i386/time.c +++ /dev/null @@ -1,34 +0,0 @@ -/* time -- Get number of seconds since Epoch. Linux/i386 version. - Copyright (C) 2015-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 - . */ - -#ifdef SHARED -# define time __redirect_time -#endif - -#include - -#ifdef SHARED -# undef time -# define time_type __redirect_time - -# undef libc_hidden_def -# define libc_hidden_def(name) \ - __hidden_ver1 (__time_syscall, __GI_time, __time_syscall); -#endif - -#include diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/sysdep.h index cf967a8c33..44bfa3f1b6 100644 --- a/sysdeps/unix/sysv/linux/powerpc/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h @@ -24,6 +24,7 @@ #define HAVE_CLOCK_GETTIME_VSYSCALL "__kernel_clock_gettime" #define HAVE_GETCPU_VSYSCALL "__kernel_getcpu" #define HAVE_TIME_VSYSCALL "__kernel_time" +#define USE_TIME_VSYSCALL_IFUNC 1 #define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday" #define HAVE_GET_TBFREQ "__kernel_get_tbfreq" diff --git a/sysdeps/unix/sysv/linux/powerpc/time.c b/sysdeps/unix/sysv/linux/powerpc/time.c deleted file mode 100644 index ca6721cf95..0000000000 --- a/sysdeps/unix/sysv/linux/powerpc/time.c +++ /dev/null @@ -1,83 +0,0 @@ -/* time system call for Linux/PowerPC. - Copyright (C) 2013-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 - . */ - -#ifdef SHARED -# ifndef __powerpc64__ -# define time __redirect_time -# else -# define __redirect_time time -# endif - -# include -# include -# include -# include -# include - -# ifndef __powerpc64__ -# undef time - -time_t -__time_vsyscall (time_t *t) -{ - return INLINE_VSYSCALL (time, 1, t); -} - -/* __GI_time is defined as hidden and for ppc32 it enables the - compiler make a local call (symbol@local) for internal GLIBC usage. It - means the PLT won't be used and the ifunc resolver will be called directly. - For ppc64 a call to a function in another translation unit might use a - different toc pointer thus disallowing direct branchess and making internal - ifuncs calls safe. */ -# undef libc_hidden_def -# define libc_hidden_def(name) \ - __hidden_ver1 (__time_vsyscall, __GI_time, __time_vsyscall); - -# endif /* !__powerpc64__ */ - -static time_t -time_syscall (time_t *t) -{ - struct timeval tv; - time_t result; - - if (INLINE_VSYSCALL (gettimeofday, 2, &tv, NULL) < 0) - result = (time_t) -1; - else - result = (time_t) tv.tv_sec; - - if (t != NULL) - *t = result; - return result; -} - -# define INIT_ARCH() \ - void *vdso_time = get_vdso_symbol (HAVE_TIME_VSYSCALL); - -/* If the vDSO is not available we fall back to the syscall. */ -libc_ifunc_hidden (__redirect_time, time, - vdso_time - ? vdso_time - : (void *) time_syscall); -libc_hidden_def (time) - -#else - -#include - -#endif /* !SHARED */ diff --git a/sysdeps/unix/sysv/linux/time.c b/sysdeps/unix/sysv/linux/time.c index 1978f6d817..93e036fe16 100644 --- a/sysdeps/unix/sysv/linux/time.c +++ b/sysdeps/unix/sysv/linux/time.c @@ -15,27 +15,64 @@ License along with the GNU C Library; if not, see . */ -#include +/* Currently we have 3 possible time implementations, which is also selected + in the order: + + 1. Wire-up __NR_time with a vDSO implementation (currently only x86 and + powerpc). + 2. Only wire-up __NR_time (usually old kABIs). + 3. Using internal gettimeofday (which may call a vDSO as well). */ + +#define time __redirect_time #include +#undef time +#include #include +#ifdef HAVE_TIME_VSYSCALL +# define HAVE_VSYSCALL +#endif +#include +#include -#ifdef __NR_time - -time_t -time (time_t *t) +static time_t +time_syscall (time_t *t) { + time_t res; +#ifdef __NR_time INTERNAL_SYSCALL_DECL (err); - time_t res = INTERNAL_SYSCALL (time, err, 1, NULL); + res = INTERNAL_VSYSCALL (time, err, 1, NULL); /* There cannot be any error. */ +#else + struct timeval tv; + /* gettimeofday does not fail with valid 'tv' and null timezone. */ + __gettimeofday (&tv, NULL); + res = tv.tv_sec; +#endif if (t != NULL) *t = res; return res; } -libc_hidden_def (time) +#if HAVE_IFUNC && defined USE_TIME_VSYSCALL_IFUNC +/* Route externals calls direct to vDSO and static and internal calls to + fallback implementation (which also might call the vDSO). */ +# ifdef SHARED +# define INIT_ARCH() +libc_ifunc_redirected (__redirect_time, time, + get_vdso_symbol (HAVE_TIME_VSYSCALL) + ?: time_syscall); +libc_hidden_def_redir (time_syscall, time) +# else +strong_alias (time_syscall, time) +# endif /* SHARED */ #else -# include +time_t +time (time_t *t) +{ + return time_syscall (t); +} +libc_hidden_def_redir (time, time) #endif diff --git a/sysdeps/unix/sysv/linux/x86/time.c b/sysdeps/unix/sysv/linux/x86/time.c deleted file mode 100644 index 60e6d1b7c0..0000000000 --- a/sysdeps/unix/sysv/linux/x86/time.c +++ /dev/null @@ -1,60 +0,0 @@ -/* time -- Get number of seconds since Epoch. Linux/x86 version. - Copyright (C) 2015-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 - . */ - -#include - -#ifdef SHARED - -#include -#include -#include - -static time_t -__time_syscall (time_t *t) -{ - INTERNAL_SYSCALL_DECL (err); - return INTERNAL_SYSCALL (time, err, 1, t); -} - -# ifndef time_type -/* The i386 time.c includes this file with a defined time_type macro. - For x86_64 we have to define it to time as the internal symbol is the - ifunc'ed one. */ -# define time_type time -# endif - -#undef INIT_ARCH -#define INIT_ARCH() - -/* If the vDSO is not available we fall back on the syscall. */ -libc_ifunc_hidden (time_type, time, - (get_vdso_symbol ("__vdso_time") ?: __time_syscall)) -libc_hidden_def (time) - -#else - -# include - -time_t -time (time_t *t) -{ - INTERNAL_SYSCALL_DECL (err); - return INTERNAL_SYSCALL (time, err, 1, t); -} - -#endif diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h index 4541c0d492..c64fbd1e26 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -376,6 +376,8 @@ /* List of system calls which are supported as vsyscalls. */ # define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime" # define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" +# define HAVE_TIME_VSYSCALL "__vdso_time" +# define USE_TIME_VSYSCALL_IFUNC 1 # define HAVE_GETCPU_VSYSCALL "__vdso_getcpu" # define SINGLE_THREAD_BY_GLOBAL 1 From patchwork Fri Jun 14 15:29:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 166839 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2202928ilk; Fri, 14 Jun 2019 08:31:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7dFCOX8PS1LD3reNw7gB6wMMSk9bqASYj93G+ml9v8Uaij5EAJ9vfEoKm8woEHbLctotr X-Received: by 2002:a62:fccd:: with SMTP id e196mr27002834pfh.53.1560526284663; Fri, 14 Jun 2019 08:31:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560526284; cv=none; d=google.com; s=arc-20160816; b=hXGprD/WS00BEo/eSL1hMBt7lMm7YK7AE76iVjP1S978laOX4PEX/PykSEE2im1l1/ OOErhdGIELSpq+slwvEdaRpz3FlKZEf2RMeVQ3RKCAmz4ElfuUw53mbslx6qF952fkQf O7f8SVPHtHffvQqURJxofMvviI7NYdJi+IBTz5FLoehFiWhlARTkynFO8ZYTByeTS6SZ S28qwxB5qpLJHUEb7V4wkPM7mifInkSkyUGPPjVmpGqeSB6Qv+QU9Uw7Qgnw50KMEIYe bJIL9kVEjDSSA3AsGLyzMadypZ9EK8sqv1sKGVze9JXAiAeJqbmMDDv7cyYnKbelYJ3N EQ7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to: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=V8L5eKvYtMEJWUg+mj01H9rLBXOON/MM/T14+E1vSo4=; b=khLCtHpPqXBnNF+1k3zxSXch4UZO/hiTxLXKRmIwYevTUh1hiNneog0DCM9VXVuxui qrHsxsw9XV+jYOpjCczY9bovU/eSp0LT/IPcQsLGPLwF6wgTdCNnAqKI+mQOs3RzRG7C ANIlozNlckyGGqq4ZHO154IwOxTC/RrZa60VU+0GBIlySk4ZBHXfyQNsjB0QDB8O4peT YTtiWM1Q313MCabm6d2KaJA0S2RU/1NSJGYIfVH1hXHEUHH+cz0USHY3WEQIY7WCFt17 V0ckfqHuLONszTjmZqjekub2Ww4UWbuY+a99rmLB9FiHQLPrKaezlBuZsXn9go+l+jeU suCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=AzBxCdBm; dkim=pass header.i=@linaro.org header.s=google header.b=RWmMSzw1; spf=pass (google.com: domain of libc-alpha-return-102745-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102745-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 g129si2702311pfb.181.2019.06.14.08.31.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jun 2019 08:31:24 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-102745-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=AzBxCdBm; dkim=pass header.i=@linaro.org header.s=google header.b=RWmMSzw1; spf=pass (google.com: domain of libc-alpha-return-102745-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-102745-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:in-reply-to :references; q=dns; s=default; b=N+ndxlL8O3LrZlE/MVmGIVB9UbSFYHy Brjns0vIc84nucBNRx8tI/vUXpce6ji7pwk8tHsZsohDJFFYdnDsNskbHAA1uBTp KiOPpsCTy1WA4yBTYNVwZxtIzUhm0+ltTSAnCeCNVkmPqNEMCMIF6NI16MWLn7N8 hM8RAeX+ZXLs= 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:in-reply-to :references; s=default; bh=d2MAcsIS/A116oSj2WNLqA3tQSc=; b=AzBxC dBm00zGSrx3ppO3vSER5+i/YgF+h+ZzT5Cl3RGbfTAWYekog2ww2z9YYuMHMCToG P08GTu1gHBdO/TNctGu+ytVY7x/T3/7AA2f67z8EBmyS/LHAFpksYvbNvUo4xl2Q f+yEHEsDcwuuCIFuLaPhDsYtLwhXfGxRZXR7vk= Received: (qmail 118604 invoked by alias); 14 Jun 2019 15:29:33 -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 118479 invoked by uid 89); 14 Jun 2019 15:29:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.6 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, RCVD_IN_JMF_BR, SPF_PASS autolearn=ham version=3.3.1 spammy=2018-2019, 20182019, 1624 X-HELO: mail-vs1-f66.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=V8L5eKvYtMEJWUg+mj01H9rLBXOON/MM/T14+E1vSo4=; b=RWmMSzw1FpXklYaVnnU6Lq/diLe5LDH7yCa9iWZRQXezaUDxmoaOK1jv8CGSZqASIp EnhTsD8e1I4XLlXz7BKL/vzorTizgANn6rbTp7BbYQMs8ajm/gn4HWtOELZP6yf4Aw+D j+EKSsCXZ/YZe72YwfFdJQ8OphUfsJpUK9Nz2FEI+dLpM1CUIdZtYKZnoAymIOUuHQR1 9Wj0Mixn14lPRQNzAFqchtfTx8161KcMIpLqvAPWjPc1ob//9p9kBwjqO2BLPxjBkqtz UqKCvr3dn+rJ8/E+YYcDk3rRdTuHHl9SxvzM+Fan1jcgnOeUStFbFY3/ebj4iiGcbPfX +Upw== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 12/12] linux: Consolidate gettimeofday implementation Date: Fri, 14 Jun 2019 12:29:08 -0300 Message-Id: <20190614152908.8101-12-adhemerval.zanella@linaro.org> In-Reply-To: <20190614152908.8101-1-adhemerval.zanella@linaro.org> References: <20190614152908.8101-1-adhemerval.zanella@linaro.org> The gettimeofday syscall has currently 3 possible implementations: 1. Wire-up __NR_gettimeofday with a VDSO implementation accessed directly through IFUNC (aarch64, x86, and powerpc*). 2. vDSO gettimeofday (arm, mips*, riscv*, s390, and sparc). 3. Wire-up __NR_gettimeofday (alpha, hppa, ia64, m68k, microblaze, nios, sh4). This patch consolidates all implementation on Linux generic sysdeps/unix/sysv/linux/gettimeofday.c. To simplify the code, some changes are made: * The wire-up with vDSO implementation may route external calls directly to vDSO through IFUNC. To enable it the architecture need to explicit define USE_GETTIMEOFDAY_VSYSCALL_IFUNC. * Also, powerpc and x86 tries to route internal time usages to IFUNC mechanism, which is problematic since powerpc32 and i686 does not really support it. Instead, all internal calls are routed to a default internal symbol which in turn calls INTERNAL_VSYSCALL. * Static linking also uses the fallback mechanism which calls INTERNAL_VSYSCALL, so vDSO is used for this case as well. The generic implementation issues a syscall as default, calls the vDSO if the architecture defines HAVE_GETTIMEOFDAY_VSYSCALL, and route the external calls to iFUNC if the architecture also defines USE_GETTIMEOFDAY_VSYSCALL_IFUNC. Checked on x86_64-linux-gnu, i686-linux-gnu, powerpc-linux-gnu, powerpc64-linux-gnu, powerpc64le-linux-gnu, and aarch64-linux-gnu. * sysdeps/unix/sysv/linux/aarch64/gettimeofday.c: Remove file. * sysdeps/unix/sysv/linux/i386/gettimeofday.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/gettimeofday.c: Likewise. * sysdeps/unix/sysv/linux/x86/gettimeofday.c: Likewise. * sysdeps/unix/sysv/linux/aarch64/sysdep.h (USE_GETTIMEOFDAY_VSYSCALL_IFUNC): Define. * sysdeps/unix/sysv/linux/i386/sysdep.h (USE_GETTIMEOFDAY_VSYSCALL_IFUNC): Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h (USE_GETTIMEOFDAY_VSYSCALL_IFUNC): Likewise. * sysdeps/unix/sysv/linux/powerpc/sysdep.h (USE_GETTIMEOFDAY_VSYSCALL_IFUNC): Likewise. * sysdeps/unix/sysv/linux/gettimeofday.c (gettimeofday): Handle all possible Linux implementations (wire-up syscall, vDSO implementation, and iFUNC). (gettimeofday_syscall): New function. --- .../unix/sysv/linux/aarch64/gettimeofday.c | 59 ------------- sysdeps/unix/sysv/linux/aarch64/sysdep.h | 1 + sysdeps/unix/sysv/linux/gettimeofday.c | 47 ++++++++-- sysdeps/unix/sysv/linux/i386/gettimeofday.c | 35 -------- sysdeps/unix/sysv/linux/i386/sysdep.h | 1 + .../unix/sysv/linux/powerpc/gettimeofday.c | 85 ------------------- sysdeps/unix/sysv/linux/powerpc/sysdep.h | 1 + sysdeps/unix/sysv/linux/x86/gettimeofday.c | 63 -------------- sysdeps/unix/sysv/linux/x86_64/sysdep.h | 1 + 9 files changed, 44 insertions(+), 249 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/aarch64/gettimeofday.c delete mode 100644 sysdeps/unix/sysv/linux/i386/gettimeofday.c delete mode 100644 sysdeps/unix/sysv/linux/powerpc/gettimeofday.c delete mode 100644 sysdeps/unix/sysv/linux/x86/gettimeofday.c -- 2.17.1 diff --git a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c b/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c deleted file mode 100644 index 2474a2c575..0000000000 --- a/sysdeps/unix/sysv/linux/aarch64/gettimeofday.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright (C) 2018-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 - . */ - -/* 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. */ - -#include - -#ifdef SHARED - -# include -# include - -/* Used as a fallback in the ifunc resolver if VDSO is not available - and for libc.so internal __gettimeofday calls. */ - -static int -__gettimeofday_vsyscall (struct timeval *tv, struct timezone *tz) -{ - return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); -} - -# define INIT_ARCH() - -libc_ifunc_hidden (__gettimeofday, __gettimeofday, - (get_vdso_symbol ("__vdso_gettimeofday") - ?: __gettimeofday_vsyscall)) -libc_hidden_def (__gettimeofday) - -#else - -# include -int -__gettimeofday (struct timeval *tv, struct timezone *tz) -{ - return INLINE_SYSCALL (gettimeofday, 2, tv, tz); -} -libc_hidden_def (__gettimeofday) - -#endif - -weak_alias (__gettimeofday, gettimeofday) -libc_hidden_weak (gettimeofday) diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h index d57f7232e2..526741ed82 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h @@ -163,6 +163,7 @@ # define HAVE_CLOCK_GETRES_VSYSCALL "__kernel_clock_getres" # define HAVE_CLOCK_GETTIME_VSYSCALL "__kernel_clock_gettime" # define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday" +# define USE_GETTIMEOFDAY_VSYSCALL_IFUNC 1 /* Previously AArch64 used the generic version without the libc_hidden_def which lead in a non existent __send symbol in libc.so. */ diff --git a/sysdeps/unix/sysv/linux/gettimeofday.c b/sysdeps/unix/sysv/linux/gettimeofday.c index a74f03825a..ed46723803 100644 --- a/sysdeps/unix/sysv/linux/gettimeofday.c +++ b/sysdeps/unix/sysv/linux/gettimeofday.c @@ -16,24 +16,57 @@ License along with the GNU C Library; if not, see . */ -#include -#include +/* Currently we have 3 possible gettimeofday implementations, which is also + selected in the order: + + 1. Wire-up __NR_gettimeofday with a vDSO implementation (currently aarch64, + x86, and powerpc). + + 2. vDSO gettimeofday (arm, mips*, riscv*, s390, and sparc). + 3. Wire-up __NR_gettimeofday (alpha, hppa, ia64, m68k, microblaze, + nios, sh4). */ + +#define __gettimeofday __redirect___gettimeofday +#include #undef __gettimeofday +#include #ifdef HAVE_GETTIMEOFDAY_VSYSCALL # define HAVE_VSYSCALL #endif #include +#include + +/* 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. */ +static int +gettimeofday_syscall (struct timeval *tv, struct timezone *tz) +{ + return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); +} + +#if HAVE_IFUNC && defined USE_GETTIMEOFDAY_VSYSCALL_IFUNC +/* Route externals calls direct to vDSO and static and internal calls to + fallback implementation (which also might call the vDSO). */ +# ifdef SHARED +# define INIT_ARCH() +libc_ifunc_redirected (__redirect___gettimeofday, __gettimeofday, + get_vdso_symbol (HAVE_GETTIMEOFDAY_VSYSCALL) + ?: gettimeofday_syscall); +libc_hidden_def_redir (gettimeofday_syscall, __gettimeofday) +# else +strong_alias (gettimeofday_syscall, __gettimeofday) +# endif /* SHARED */ +#else -/* 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 (struct timeval *tv, struct timezone *tz) { - return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); + return gettimeofday_syscall (tv, tz); } -libc_hidden_def (__gettimeofday) +libc_hidden_def_redir (__gettimeofday, __gettimeofday) +#endif weak_alias (__gettimeofday, gettimeofday) libc_hidden_weak (gettimeofday) diff --git a/sysdeps/unix/sysv/linux/i386/gettimeofday.c b/sysdeps/unix/sysv/linux/i386/gettimeofday.c deleted file mode 100644 index 185450ece6..0000000000 --- a/sysdeps/unix/sysv/linux/i386/gettimeofday.c +++ /dev/null @@ -1,35 +0,0 @@ -/* gettimeofday - get the time. Linux/i386 version. - Copyright (C) 2015-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 - . */ - -#ifdef SHARED -# define __gettimeofday __redirect___gettimeofday -#endif - -#include - -#ifdef SHARED -# undef __gettimeofday -# define __gettimeofday_type __redirect___gettimeofday - -# undef libc_hidden_def -# define libc_hidden_def(name) \ - __hidden_ver1 (__gettimeofday_syscall, __GI___gettimeofday, \ - __gettimeofday_syscall); -#endif - -#include diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index 4f79f25989..076e4393d3 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -315,6 +315,7 @@ struct libc_do_syscall_args /* List of system calls which are supported as vsyscalls. */ # define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime" # define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" +# define USE_GETTIMEOFDAY_VSYSCALL_IFUNC 1 # define HAVE_TIME_VSYSCALL "__vdso_time" # define USE_TIME_VSYSCALL_IFUNC 1 diff --git a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c b/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c deleted file mode 100644 index 7a4e3cca0c..0000000000 --- a/sysdeps/unix/sysv/linux/powerpc/gettimeofday.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright (C) 2005-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 - . */ - -#if defined SHARED && !defined __powerpc64__ -# define __gettimeofday __redirect___gettimeofday -#else -# define __redirect___gettimeofday __gettimeofday -#endif - -#include - -#ifdef SHARED - -# include -# include -# include - -# ifndef __powerpc64__ -# undef __gettimeofday - -int -__gettimeofday_vsyscall (struct timeval *tv, struct timezone *tz) -{ - return INLINE_VSYSCALL (gettimeofday, 2, tv, tz); -} - -/* __GI___gettimeofday is defined as hidden and for ppc32 it enables the - compiler make a local call (symbol@local) for internal GLIBC usage. It - means the PLT won't be used and the ifunc resolver will be called directly. - For ppc64 a call to a function in another translation unit might use a - different toc pointer thus disallowing direct branchess and making internal - ifuncs calls safe. */ -# undef libc_hidden_def -# define libc_hidden_def(name) \ - __hidden_ver1 (__gettimeofday_vsyscall, __GI___gettimeofday, \ - __gettimeofday_vsyscall); - -# endif /* !__powerpc64__ */ - -static int -__gettimeofday_syscall (struct timeval *tv, struct timezone *tz) -{ - return INLINE_SYSCALL (gettimeofday, 2, tv, tz); -} - -# define INIT_ARCH() \ - void *vdso_gettimeofday = get_vdso_symbol (HAVE_GETTIMEOFDAY_VSYSCALL) - - -/* If the vDSO is not available we fall back syscall. */ -libc_ifunc_hidden (__redirect___gettimeofday, __gettimeofday, - vdso_gettimeofday - ? vdso_gettimeofday - : (void *) __gettimeofday_syscall); -libc_hidden_def (__gettimeofday) - -#else - -# include -# include - -int -__gettimeofday (struct timeval *tv, struct timezone *tz) -{ - return INLINE_SYSCALL (gettimeofday, 2, tv, tz); -} -libc_hidden_def (__gettimeofday) - -#endif -weak_alias (__gettimeofday, gettimeofday) -libc_hidden_weak (gettimeofday) diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/sysdep.h index 44bfa3f1b6..754832d580 100644 --- a/sysdeps/unix/sysv/linux/powerpc/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h @@ -26,6 +26,7 @@ #define HAVE_TIME_VSYSCALL "__kernel_time" #define USE_TIME_VSYSCALL_IFUNC 1 #define HAVE_GETTIMEOFDAY_VSYSCALL "__kernel_gettimeofday" +#define USE_GETTIMEOFDAY_VSYSCALL_IFUNC 1 #define HAVE_GET_TBFREQ "__kernel_get_tbfreq" #if defined(__PPC64__) || defined(__powerpc64__) diff --git a/sysdeps/unix/sysv/linux/x86/gettimeofday.c b/sysdeps/unix/sysv/linux/x86/gettimeofday.c deleted file mode 100644 index 3ceab633e5..0000000000 --- a/sysdeps/unix/sysv/linux/x86/gettimeofday.c +++ /dev/null @@ -1,63 +0,0 @@ -/* gettimeofday - get the time. Linux/x86 version. - Copyright (C) 2015-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 - . */ - -#include - -#ifdef SHARED - -# include -# include -# include -# include - -static int -__gettimeofday_syscall (struct timeval *tv, struct timezone *tz) -{ - return INLINE_SYSCALL (gettimeofday, 2, tv, tz); -} - -# ifndef __gettimeofday_type -/* The i386 gettimeofday.c includes this file with a defined - __gettimeofday_type macro. For x86_64 we have to define it to __gettimeofday - as the internal symbol is the ifunc'ed one. */ -# define __gettimeofday_type __gettimeofday -# endif - -# define INIT_ARCH() - -/* If the vDSO is not available we fall back to syscall. */ -libc_ifunc_hidden (__gettimeofday_type, __gettimeofday, - (get_vdso_symbol ("__vdso_gettimeofday") - ?: __gettimeofday_syscall)); -libc_hidden_def (__gettimeofday) - -#else - -# include -# include - -int -__gettimeofday (struct timeval *tv, struct timezone *tz) -{ - return INLINE_SYSCALL (gettimeofday, 2, tv, tz); -} -libc_hidden_def (__gettimeofday) - -#endif -weak_alias (__gettimeofday, gettimeofday) -libc_hidden_weak (gettimeofday) diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h index c64fbd1e26..4ea9c4fa31 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -376,6 +376,7 @@ /* List of system calls which are supported as vsyscalls. */ # define HAVE_CLOCK_GETTIME_VSYSCALL "__vdso_clock_gettime" # define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" +# define USE_GETTIMEOFDAY_VSYSCALL_IFUNC 1 # define HAVE_TIME_VSYSCALL "__vdso_time" # define USE_TIME_VSYSCALL_IFUNC 1 # define HAVE_GETCPU_VSYSCALL "__vdso_getcpu"