From patchwork Fri Sep 21 23:40:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Rafael_=C3=81vila_de_Esp=C3=ADndola?= X-Patchwork-Id: 973501 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-96044-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=espindo.la Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="hzTnlVXF"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=espindo.la header.i=@espindo.la header.b="V291dWqr"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42H98C1Q5Yz9sCP for ; Sat, 22 Sep 2018 09:40:42 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:to:from:reply-to:subject:message-id :mime-version:content-type; q=dns; s=default; b=TyQ1XM5qUmCMED7E b1MOqEexzyeqkouS7jEOdWS38MJuAasxYhAqIrBUqUrd6+FDBMB6gVPKEh8/7MoK ptgxdQuOlomFRNIbWvqZtAFa4qTzlrH/LMU53/EvRPx1eiwMtdl5i51tnbWezzGq 9jlxQ8WqEhYhgYHB+IdyNH2rqnA= 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:date:to:from:reply-to:subject:message-id :mime-version:content-type; s=default; bh=Mpz3WOe/9BJlPNuaGVKlb7 KNxAQ=; b=hzTnlVXFJ7LPcLnE17/v+9RhF+qnMl+2WU5YfKI211tt/YAHrm/hO8 fmgdBY1ePhcVjlF0W+G0b63+lvlfj2f8PntPHa9Q7rbo5X8p/3zu7I83wg3UsfNE 08j9hlEhUbrcRpAS61VWoKDN7BJT7w4Sv+gyPnERzZhQbAj03k/mc= Received: (qmail 127034 invoked by alias); 21 Sep 2018 23:40:36 -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 126642 invoked by uid 89); 21 Sep 2018 23:40:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-27.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_LOW, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=1439, deletes, 4499 X-HELO: mail4.protonmail.ch Date: Fri, 21 Sep 2018 23:40:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=espindo.la; s=protonmail; t=1537573225; bh=g4N5FPnJKxfka2v+ZVaPB2AKMOc0aCZaXOqxWk2iIVg=; h=Date:To:From:Reply-To:Subject:Feedback-ID:From; b=V291dWqrmHg1L9XRQRGOVLU6of81ZK9geMD2PQzALGi0GNQw8GXNDy8ssVv0wJN/Y kYUWsdCtC7QmdnnBsXTV2AdEFnSBhyWjH2Zt4Rep3pNu9Fj9pj9q7301QWC0EFB2E2 11TlaKggOqLSUhL81mQQopRRw9cVk6bhX3OPuAkE= To: "libc-alpha@sourceware.org" , "H.J. Lu" From: Rafael Avila de Espindola Reply-To: Rafael Avila de Espindola Subject: [PATCH v2] Enable VDSO on statically linked programs. Message-ID: MIME-Version: 1.0 The new version has fixed the indentation of preprocessor directives and changed a few tests to also be linked statically. The tests don't show that the VDSO is being used, but show that the functions now using the VDSO still work. Cheers, Rafael From a4563236a090f7e02c82b720ca449f5ef7772771 Mon Sep 17 00:00:00 2001 From: Rafael Avila de Espindola Date: Thu, 20 Sep 2018 08:23:30 -0700 Subject: [PATCH] Enable VDSO on statically linked programs. All the required code already existed, and some of it was already running. AT_SYSINFO_EHDR is processed if NEED_DL_SYSINFO_DSO is defined, but it looks like it always is. The call to setup_vdso is also unconditional, so all that was left to do was setup the function pointers and use them. This patch just deletes some #ifdef to enable that. --- nptl/Makefile | 5 ++-- nptl/tst-cond11-static.c | 1 + sysdeps/unix/sysv/linux/Makefile | 3 +++ sysdeps/unix/sysv/linux/sysdep-vdso.h | 27 ++++++------------- sysdeps/unix/sysv/linux/tst-affinity-static.c | 1 + sysdeps/unix/sysv/linux/x86/libc-vdso.h | 6 +---- sysdeps/unix/sysv/linux/x86_64/init-first.c | 12 ++++----- 7 files changed, 22 insertions(+), 33 deletions(-) create mode 100644 nptl/tst-cond11-static.c create mode 100644 sysdeps/unix/sysv/linux/tst-affinity-static.c diff --git a/nptl/Makefile b/nptl/Makefile index be8066524c..1b384548a1 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -449,9 +449,10 @@ link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \ tests-static += tst-locale1 tst-locale2 tst-stackguard1-static \ tst-cancel21-static tst-cancel24-static tst-cond8-static \ tst-mutex8-static tst-mutexpi8-static tst-sem11-static \ - tst-sem12-static + tst-sem12-static tst-cond11-static + tests += tst-cancel21-static tst-cancel24-static \ - tst-cond8-static + tst-cond8-static tst-cond11-static tests-internal += tst-sem11-static tst-sem12-static tst-stackguard1-static xtests-static += tst-setuid1-static diff --git a/nptl/tst-cond11-static.c b/nptl/tst-cond11-static.c new file mode 100644 index 0000000000..9bccb8ec8b --- /dev/null +++ b/nptl/tst-cond11-static.c @@ -0,0 +1 @@ +#include "tst-cond11.c" diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 773aaea0e9..05a4ab1e55 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -143,6 +143,9 @@ sysdep_routines += sched_getcpu oldglob tests += tst-affinity tst-affinity-pid +tests-static := tst-affinity-static +tests += $(tests-static) + CFLAGS-fork.c = $(libio-mtsafe) CFLAGS-getpid.o = -fomit-frame-pointer CFLAGS-getpid.os = -fomit-frame-pointer diff --git a/sysdeps/unix/sysv/linux/sysdep-vdso.h b/sysdeps/unix/sysv/linux/sysdep-vdso.h index 1912c1c156..9e8b1ce2e4 100644 --- a/sysdeps/unix/sysv/linux/sysdep-vdso.h +++ b/sysdeps/unix/sysv/linux/sysdep-vdso.h @@ -26,13 +26,11 @@ funcptr (args) #endif -#ifdef SHARED +#ifdef HAVE_VSYSCALL -# ifdef HAVE_VSYSCALL +# include -# include - -# define INLINE_VSYSCALL(name, nr, args...) \ +# define INLINE_VSYSCALL(name, nr, args...) \ ({ \ __label__ out; \ __label__ iserr; \ @@ -61,7 +59,7 @@ sc_ret; \ }) -# define INTERNAL_VSYSCALL(name, err, nr, args...) \ +# define INTERNAL_VSYSCALL(name, err, nr, args...) \ ({ \ __label__ out; \ long v_ret; \ @@ -79,20 +77,11 @@ out: \ v_ret; \ }) -# else -# define INLINE_VSYSCALL(name, nr, args...) \ - INLINE_SYSCALL (name, nr, ##args) -# define INTERNAL_VSYSCALL(name, err, nr, args...) \ - INTERNAL_SYSCALL (name, err, nr, ##args) -# endif /* HAVE_VSYSCALL */ - -# else /* SHARED */ - -# define INLINE_VSYSCALL(name, nr, args...) \ +#else +# define INLINE_VSYSCALL(name, nr, args...) \ INLINE_SYSCALL (name, nr, ##args) -# define INTERNAL_VSYSCALL(name, err, nr, args...) \ +# define INTERNAL_VSYSCALL(name, err, nr, args...) \ INTERNAL_SYSCALL (name, err, nr, ##args) - -#endif /* SHARED */ +#endif /* HAVE_VSYSCALL */ #endif /* SYSDEP_VDSO_LINUX_H */ diff --git a/sysdeps/unix/sysv/linux/tst-affinity-static.c b/sysdeps/unix/sysv/linux/tst-affinity-static.c new file mode 100644 index 0000000000..4022ea317a --- /dev/null +++ b/sysdeps/unix/sysv/linux/tst-affinity-static.c @@ -0,0 +1 @@ +#include "tst-affinity.c" diff --git a/sysdeps/unix/sysv/linux/x86/libc-vdso.h b/sysdeps/unix/sysv/linux/x86/libc-vdso.h index 6f86073dae..7f4e730a32 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 -#ifdef SHARED - -# 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/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c index 2320505804..ad19f4b055 100644 --- a/sysdeps/unix/sysv/linux/x86_64/init-first.c +++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c @@ -16,11 +16,10 @@ License along with the GNU C Library; if not, see . */ -#ifdef SHARED -# include -# include -# include -# include +#include +#include +#include +#include long int (*VDSO_SYMBOL(clock_gettime)) (clockid_t, struct timespec *) attribute_hidden; @@ -46,7 +45,6 @@ __vdso_platform_setup (void) VDSO_SYMBOL(getcpu) = p; } -# define VDSO_SETUP __vdso_platform_setup -#endif +#define VDSO_SETUP __vdso_platform_setup #include -- 2.18.0