From patchwork Mon Jul 4 13:45:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 13619 Received: (qmail 66585 invoked by alias); 4 Jul 2016 14:15: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 66547 invoked by uid 89); 4 Jul 2016 14:15:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: plane.gmane.org To: libc-alpha@sourceware.org From: Stefan Liebler Subject: Re: [PATCH 7/8] Use libc_ifunc macro for vfork in libpthread. Date: Mon, 4 Jul 2016 15:45:21 +0200 Lines: 130 Message-ID: References: <1466682952-6301-1-git-send-email-stli@linux.vnet.ibm.com> <1466682952-6301-7-git-send-email-stli@linux.vnet.ibm.com> Mime-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 In-Reply-To: <1466682952-6301-7-git-send-email-stli@linux.vnet.ibm.com> This updated patch first undefines INIT_ARCH before it is defined. On 06/23/2016 01:55 PM, Stefan Liebler wrote: > This patch uses the libc_ifunc macro to create already existing ifunc functions > vfork_ifunc and __vfork_ifunc if HAVE_IFUNC is defined. > > ChangeLog: > > * nptl/pt-vfork.c (DEFINE_VFORK): Use libc_ifunc macro. > --- > nptl/pt-vfork.c | 21 ++++----------------- > 1 file changed, 4 insertions(+), 17 deletions(-) > > diff --git a/nptl/pt-vfork.c b/nptl/pt-vfork.c > index 8f4be0c..6258835 100644 > --- a/nptl/pt-vfork.c > +++ b/nptl/pt-vfork.c > @@ -46,32 +46,19 @@ > > extern __typeof (vfork) __libc_vfork; /* Defined in libc. */ > > -static __typeof (vfork) * > -__attribute__ ((used)) > -vfork_resolve (void) > -{ > - return &__libc_vfork; > -} > +# define INIT_ARCH() > +# define DEFINE_VFORK(name) libc_ifunc (name, &__libc_vfork) > > -# ifdef HAVE_ASM_SET_DIRECTIVE > -# define DEFINE_VFORK(name) \ > - asm (".set " #name ", vfork_resolve\n" \ > - ".globl " #name "\n" \ > - ".type " #name ", %gnu_indirect_function"); > -# else > -# define DEFINE_VFORK(name) \ > - asm (#name " = vfork_resolve\n" \ > - ".globl " #name "\n" \ > - ".type " #name ", %gnu_indirect_function"); > -# endif > #endif > > #if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_20) > +extern __typeof(vfork) vfork_ifunc; > DEFINE_VFORK (vfork_ifunc) > compat_symbol (libpthread, vfork_ifunc, vfork, GLIBC_2_0); > #endif > > #if SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_20) > +extern __typeof(vfork) __vfork_ifunc; > DEFINE_VFORK (__vfork_ifunc) > compat_symbol (libpthread, __vfork_ifunc, __vfork, GLIBC_2_1_2); > #endif > From 899785dab6aae3ba488382b38a8f67916e39cf2b Mon Sep 17 00:00:00 2001 From: Stefan Liebler Date: Mon, 4 Jul 2016 15:33:57 +0200 Subject: [PATCH 7/8] Use libc_ifunc macro for vfork in libpthread. This patch uses the libc_ifunc macro to create already existing ifunc functions vfork_ifunc and __vfork_ifunc if HAVE_IFUNC is defined. ChangeLog: * nptl/pt-vfork.c (DEFINE_VFORK): Use libc_ifunc macro. --- nptl/pt-vfork.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/nptl/pt-vfork.c b/nptl/pt-vfork.c index 8f4be0c..563e3ec 100644 --- a/nptl/pt-vfork.c +++ b/nptl/pt-vfork.c @@ -46,32 +46,20 @@ extern __typeof (vfork) __libc_vfork; /* Defined in libc. */ -static __typeof (vfork) * -__attribute__ ((used)) -vfork_resolve (void) -{ - return &__libc_vfork; -} +# undef INIT_ARCH +# define INIT_ARCH() +# define DEFINE_VFORK(name) libc_ifunc (name, &__libc_vfork) -# ifdef HAVE_ASM_SET_DIRECTIVE -# define DEFINE_VFORK(name) \ - asm (".set " #name ", vfork_resolve\n" \ - ".globl " #name "\n" \ - ".type " #name ", %gnu_indirect_function"); -# else -# define DEFINE_VFORK(name) \ - asm (#name " = vfork_resolve\n" \ - ".globl " #name "\n" \ - ".type " #name ", %gnu_indirect_function"); -# endif #endif #if SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_20) +extern __typeof(vfork) vfork_ifunc; DEFINE_VFORK (vfork_ifunc) compat_symbol (libpthread, vfork_ifunc, vfork, GLIBC_2_0); #endif #if SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_20) +extern __typeof(vfork) __vfork_ifunc; DEFINE_VFORK (__vfork_ifunc) compat_symbol (libpthread, __vfork_ifunc, __vfork, GLIBC_2_1_2); #endif -- 2.3.0