From patchwork Wed Oct 10 04:49:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Rafael_=C3=81vila_de_Esp=C3=ADndola?= X-Patchwork-Id: 981680 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-96331-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="KFXCKHfi"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=espindo.la header.i=@espindo.la header.b="OKuDoZUo"; 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 42VM8S2V93z9sB7 for ; Wed, 10 Oct 2018 15:49:44 +1100 (AEDT) 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:content-transfer-encoding; q=dns; s= default; b=cL0N39ieYT4DUNy1hOU5QyrHFhGxAUSzkbJDGIdib4owQRDgiRMbs eO3dcULjbYx2r0hvt4Pb2CUJ2d7b4NeOfx8dxwmXLg4OgT2800zewqLo/4IXK6Jk C2avI+kSajzt3svk2i5FNEsBKDrWJaDfXOb4ljoHrX1WOLaiSX62bQ= 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:content-transfer-encoding; s=default; bh=u7qCe9eZYnvycMXzCrRdu10q0js=; b=KFXCKHfiCVwYc52rKBRnX9IazKKI szw0r0WNLTsBASt33EL2RhFkfFt3ZkVcN1Dd2CviUPJpEQffiHKDMW0TC0PFSiPY lC2N49TZKQAtzNqufAiFgQmPHh6ICugACD2R8vagJ/8yiSUwq969jQpZwluZQKFF gfqZ0uqyF3Snp6k= Received: (qmail 107940 invoked by alias); 10 Oct 2018 04:49:37 -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 107929 invoked by uid 89); 10 Oct 2018 04:49:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.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_LOW, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=emailed, Under, deletes X-HELO: mail4.protonmail.ch Date: Wed, 10 Oct 2018 04:49:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=espindo.la; s=protonmail; t=1539146966; bh=7vMWrrrvg33VDYthCwmdSHapGx82YtcsINNU60Khx/4=; h=Date:To:From:Reply-To:Subject:Feedback-ID:From; b=OKuDoZUo5QQvCcjIy8TQJZ5cg+PnAK3SfZz0h5B1ux5Uj64FWa4HxxMxHCJ4bs/Uo F+f/wIddRwbURxDD+rE58JZh4O3NHI2/2eixpzgF4h0gfEbqP137UAQ3i7GcTJPkGB PHzMnUtTLSS3iQaVuaSXX1QlH/ppaz5arNwcOJT4= To: libc-alpha@sourceware.org, "H.J. Lu" , Florian Weimer , Szabolcs Nagy From: Rafael Avila de Espindola Reply-To: Rafael Avila de Espindola Subject: [PATCH v4] Enable VDSO on x86_64 statically linked programs. Message-ID: MIME-Version: 1.0 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. --- The only difference from the previous patch is rebasing on top of the refactoring patch I just emailed. 2018-10-09 Rafael Ávila de Espíndola [BZ #19767] * Makeconfig: Add -DUSE_VSYSCALL to CPPFLAGS-.os. * nptl/Makefile: Add tst-cond11-static to tests-static and tests. * nptl/tst-cond11-static.c: New File. * sysdeps/unix/sysv/linux/Makefile: Add tst-affinity-static to tests-static and tests * sysdeps/unix/sysv/linux/sysdep-vdso.h: Use USE_VSYSCALL instead of SHARED. * sysdeps/unix/sysv/linux/tst-affinity-static.c: New file. * sysdeps/unix/sysv/linux/x86/libc-vdso.h: Use USE_VSYSCALL instead of SHARED. * sysdeps/unix/sysv/linux/x86_64/init-first.c: remove #ifdef SHARED. * sysdeps/unix/sysv/linux/x86_64/sysdep.h: define USE_VSYSCALL. diff --git a/Makeconfig b/Makeconfig index fbcf69e7c2..61712dc35e 100644 --- a/Makeconfig +++ b/Makeconfig @@ -999,7 +999,7 @@ ifeq (yes,$(build-shared)) # Under --enable-shared, we will build a shared library of PIC objects. # The PIC object files are named foo.os. object-suffixes += .os -CPPFLAGS-.os = -DPIC -DSHARED +CPPFLAGS-.os = -DPIC -DSHARED -DUSE_VSYSCALL CFLAGS-.os = $(filter %frame-pointer,$(+cflags)) $(pic-ccflag) libtype.os := lib%_pic.a # This can be changed by a sysdep makefile 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 d047b61af7..9a006d9917 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -145,6 +145,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 7f894c5e02..a50844a710 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 defined SHARED && defined HAVE_VSYSCALL +#if defined HAVE_VSYSCALL && defined USE_VSYSCALL # include @@ -84,6 +84,6 @@ # define INTERNAL_VSYSCALL(name, err, nr, args...) \ INTERNAL_SYSCALL (name, err, nr, ##args) -#endif /* defined SHARED && defined HAVE_VSYSCALL */ +#endif /* defined HAVE_VSYSCALL && defined USE_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..3ea43263fd 100644 --- a/sysdeps/unix/sysv/linux/x86/libc-vdso.h +++ b/sysdeps/unix/sysv/linux/x86/libc-vdso.h @@ -22,7 +22,7 @@ #include #include -#ifdef SHARED +#ifdef USE_VSYSCALL # include 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 diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h index f07eb04962..7b98ed5686 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -18,6 +18,11 @@ #ifndef _LINUX_X86_64_SYSDEP_H #define _LINUX_X86_64_SYSDEP_H 1 +/* Always enable vsyscalls on x86_64 */ +#ifndef USE_VSYSCALL +#define USE_VSYSCALL +#endif + /* There is some commonality. */ #include #include