From patchwork Sat May 24 03:02:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 352067 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 8BE911400C6 for ; Sat, 24 May 2014 13:03:07 +1000 (EST) 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:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=OS+HB6pdT/Z9wvOT0VF9i3uApJysCLJ 2pr3msCd+y+UEFblwAwgagjEDvMFLXXLm96+oOxO8sH4saz1WIMeFS7KM902XIyA 83eZV4VrPH2xntlyRHajdmCED1kVG4w5Ts4wjxSPqtIFC8uqGR+VqnR3toGhyHLU mEX+NTxCpNDc= 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:cc:subject:date:message-id:in-reply-to :references; s=default; bh=5/CEkOQjUjjMaOrlTpVyV8ze8jE=; b=M1fGO 9C5l6SfSmcDCIYUcfX4Ao2d6rFzwurNjIMFIuW/OJeiLr8kNpJyZ9CvloQdJTvyl TzuZN5LD8ukB4B8l9ooiOnk4CSSRlFtyVsZNyX/WaoKAOZ2U3BtuU+42fD0gd9k+ OLqwLKu7rkBCsrv8WrZ578CkLYi2ACr5u8l1ko= Received: (qmail 26021 invoked by alias); 24 May 2014 03:02:49 -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 25991 invoked by uid 89); 24 May 2014 03:02:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-qg0-f42.google.com X-Received: by 10.224.129.66 with SMTP id n2mr12733706qas.55.1400900563628; Fri, 23 May 2014 20:02:43 -0700 (PDT) From: Richard Henderson To: libc-alpha@sourceware.org Cc: roland@hack.frob.com Subject: [PATCH v2 1/2] Only support ifunc in nptl/pt-vfork.c Date: Fri, 23 May 2014 20:02:33 -0700 Message-Id: <1400900554-5347-2-git-send-email-rth@twiddle.net> In-Reply-To: <1400900554-5347-1-git-send-email-rth@twiddle.net> References: <1400900554-5347-1-git-send-email-rth@twiddle.net> * nptl/pt-vfork.c: Error if !HAVE_IFUNC. [!HAVE_IFUNC] (vfork_compat): Remove. [!HAVE_IFUNC] (DEFINE_VFORK): Remove. --- nptl/pt-vfork.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/nptl/pt-vfork.c b/nptl/pt-vfork.c index 81d1b71..eaffe48 100644 --- a/nptl/pt-vfork.c +++ b/nptl/pt-vfork.c @@ -28,13 +28,24 @@ vfork symbols in libpthread.so; so we define them using IFUNC to redirect to the libc function. */ +/* Note! If the architecture doesn't support IFUNC, then we need an + alternate target-specific mechanism to implement this. So we just + assume IFUNC here and require that the target override this file + if necessary. + + If the architecture can assume all supported versions of gcc will + produce a tail-call to __libc_vfork, consider including the version + in sysdeps/unix/sysv/linux/aarch64/pt-vfork.c. */ + +#if !HAVE_IFUNC +# error "must write pt-vfork for this machine or get IFUNC support" +#endif + #if (SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_20) \ || SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_20)) extern __typeof (vfork) __libc_vfork; /* Defined in libc. */ -# ifdef HAVE_IFUNC - attribute_hidden __attribute__ ((used)) __typeof (vfork) * vfork_ifunc (void) @@ -42,29 +53,16 @@ vfork_ifunc (void) return &__libc_vfork; } -# ifdef HAVE_ASM_SET_DIRECTIVE -# define DEFINE_VFORK(name) \ +# ifdef HAVE_ASM_SET_DIRECTIVE +# define DEFINE_VFORK(name) \ asm (".set " #name ", vfork_ifunc\n" \ ".globl " #name "\n" \ ".type " #name ", %gnu_indirect_function"); -# else -# define DEFINE_VFORK(name) \ +# else +# define DEFINE_VFORK(name) \ asm (#name " = vfork_ifunc\n" \ ".globl " #name "\n" \ ".type " #name ", %gnu_indirect_function"); -# endif - -# else - -attribute_hidden -pid_t -vfork_compat (void) -{ - return __libc_vfork (); -} - -# define DEFINE_VFORK(name) weak_alias (vfork_compat, name) - # endif #endif