From patchwork Mon Jul 4 13:45:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 13617 Received: (qmail 46330 invoked by alias); 4 Jul 2016 14:05:09 -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 46320 invoked by uid 89); 4 Jul 2016 14:05:09 -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=2.20, 3212 X-HELO: plane.gmane.org To: libc-alpha@sourceware.org From: Stefan Liebler Subject: Re: [PATCH 8/8] Use libc_ifunc macro for siglongjmp, longjmp in libpthread. Date: Mon, 4 Jul 2016 15:45:23 +0200 Lines: 174 Message-ID: References: <1466682952-6301-1-git-send-email-stli@linux.vnet.ibm.com> <1466682952-6301-8-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-8-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 > longjmp_ifunc, siglongjmp_ifunc if HAVE_IFUNC is defined. > The s390 pt-longjmp.c includes the common pt-longjmp.c and uses strong_alias > to create the longjmp, siglongjmp symbols for glibc version 2.19. > > ChangeLog: > > * nptl/pt-longjmp.c (DEFINE_LONGJMP): Use libc_ifunc macro. > * sysdeps/unix/sysv/linux/s390/pt-longjmp.c (longjmp, siglongjmp): > Use strong_alias to create symbols for glibc verison 2.19. > --- > nptl/pt-longjmp.c | 23 +++++------------------ > sysdeps/unix/sysv/linux/s390/pt-longjmp.c | 4 ++-- > 2 files changed, 7 insertions(+), 20 deletions(-) > > diff --git a/nptl/pt-longjmp.c b/nptl/pt-longjmp.c > index a1cc286..7c452cb 100644 > --- a/nptl/pt-longjmp.c > +++ b/nptl/pt-longjmp.c > @@ -32,24 +32,11 @@ > > # if HAVE_IFUNC > > -static __typeof (longjmp) * > -__attribute__ ((used)) > -longjmp_resolve (void) > -{ > - return &__libc_longjmp; > -} > +# define INIT_ARCH() > +# define DEFINE_LONGJMP(name) libc_ifunc (name, &__libc_longjmp) > > -# ifdef HAVE_ASM_SET_DIRECTIVE > -# define DEFINE_LONGJMP(name) \ > - asm (".set " #name ", longjmp_resolve\n" \ > - ".globl " #name "\n" \ > - ".type " #name ", %gnu_indirect_function"); > -# else > -# define DEFINE_LONGJMP(name) \ > - asm (#name " = longjmp_resolve\n" \ > - ".globl " #name "\n" \ > - ".type " #name ", %gnu_indirect_function"); > -# endif > +extern __typeof(longjmp) longjmp_ifunc; > +extern __typeof(siglongjmp) siglongjmp_ifunc; > > # else /* !HAVE_IFUNC */ > > @@ -66,7 +53,7 @@ longjmp_compat (jmp_buf env, int val) > DEFINE_LONGJMP (longjmp_ifunc) > compat_symbol (libpthread, longjmp_ifunc, longjmp, GLIBC_2_0); > > -DEFINE_LONGJMP (siglongjmp_ifunc) > +strong_alias (longjmp_ifunc, siglongjmp_ifunc) > compat_symbol (libpthread, siglongjmp_ifunc, siglongjmp, GLIBC_2_0); > > #endif > diff --git a/sysdeps/unix/sysv/linux/s390/pt-longjmp.c b/sysdeps/unix/sysv/linux/s390/pt-longjmp.c > index 10e825c..2abf112 100644 > --- a/sysdeps/unix/sysv/linux/s390/pt-longjmp.c > +++ b/sysdeps/unix/sysv/linux/s390/pt-longjmp.c > @@ -26,8 +26,8 @@ > /* In glibc release 2.19 new versions of longjmp-functions were introduced, > but were reverted before 2.20. Thus both versions are the same function. */ > > -DEFINE_LONGJMP (__v2longjmp) > +strong_alias (longjmp_ifunc, __v2longjmp) > compat_symbol (libpthread, __v2longjmp, longjmp, GLIBC_2_19); > -DEFINE_LONGJMP (__v2siglongjmp) > +strong_alias (siglongjmp_ifunc, __v2siglongjmp) > compat_symbol (libpthread, __v2siglongjmp, siglongjmp, GLIBC_2_19); > #endif /* SHLIB_COMPAT (libpthread, GLIBC_2_19, GLIBC_2_20)) */ > From 7f756e0e39a90324d84dd7eba0e0ba5c2c90ee2a Mon Sep 17 00:00:00 2001 From: Stefan Liebler Date: Mon, 4 Jul 2016 15:33:57 +0200 Subject: [PATCH 8/8] Use libc_ifunc macro for siglongjmp, longjmp in libpthread. This patch uses the libc_ifunc macro to create already existing ifunc functions longjmp_ifunc, siglongjmp_ifunc if HAVE_IFUNC is defined. The s390 pt-longjmp.c includes the common pt-longjmp.c and uses strong_alias to create the longjmp, siglongjmp symbols for glibc version 2.19. ChangeLog: * nptl/pt-longjmp.c (DEFINE_LONGJMP): Use libc_ifunc macro. * sysdeps/unix/sysv/linux/s390/pt-longjmp.c (longjmp, siglongjmp): Use strong_alias to create symbols for glibc verison 2.19. --- nptl/pt-longjmp.c | 24 ++++++------------------ sysdeps/unix/sysv/linux/s390/pt-longjmp.c | 4 ++-- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/nptl/pt-longjmp.c b/nptl/pt-longjmp.c index a1cc286..a19cd59 100644 --- a/nptl/pt-longjmp.c +++ b/nptl/pt-longjmp.c @@ -32,24 +32,12 @@ # if HAVE_IFUNC -static __typeof (longjmp) * -__attribute__ ((used)) -longjmp_resolve (void) -{ - return &__libc_longjmp; -} +# undef INIT_ARCH +# define INIT_ARCH() +# define DEFINE_LONGJMP(name) libc_ifunc (name, &__libc_longjmp) -# ifdef HAVE_ASM_SET_DIRECTIVE -# define DEFINE_LONGJMP(name) \ - asm (".set " #name ", longjmp_resolve\n" \ - ".globl " #name "\n" \ - ".type " #name ", %gnu_indirect_function"); -# else -# define DEFINE_LONGJMP(name) \ - asm (#name " = longjmp_resolve\n" \ - ".globl " #name "\n" \ - ".type " #name ", %gnu_indirect_function"); -# endif +extern __typeof(longjmp) longjmp_ifunc; +extern __typeof(siglongjmp) siglongjmp_ifunc; # else /* !HAVE_IFUNC */ @@ -66,7 +54,7 @@ longjmp_compat (jmp_buf env, int val) DEFINE_LONGJMP (longjmp_ifunc) compat_symbol (libpthread, longjmp_ifunc, longjmp, GLIBC_2_0); -DEFINE_LONGJMP (siglongjmp_ifunc) +strong_alias (longjmp_ifunc, siglongjmp_ifunc) compat_symbol (libpthread, siglongjmp_ifunc, siglongjmp, GLIBC_2_0); #endif diff --git a/sysdeps/unix/sysv/linux/s390/pt-longjmp.c b/sysdeps/unix/sysv/linux/s390/pt-longjmp.c index 10e825c..2abf112 100644 --- a/sysdeps/unix/sysv/linux/s390/pt-longjmp.c +++ b/sysdeps/unix/sysv/linux/s390/pt-longjmp.c @@ -26,8 +26,8 @@ /* In glibc release 2.19 new versions of longjmp-functions were introduced, but were reverted before 2.20. Thus both versions are the same function. */ -DEFINE_LONGJMP (__v2longjmp) +strong_alias (longjmp_ifunc, __v2longjmp) compat_symbol (libpthread, __v2longjmp, longjmp, GLIBC_2_19); -DEFINE_LONGJMP (__v2siglongjmp) +strong_alias (siglongjmp_ifunc, __v2siglongjmp) compat_symbol (libpthread, __v2siglongjmp, siglongjmp, GLIBC_2_19); #endif /* SHLIB_COMPAT (libpthread, GLIBC_2_19, GLIBC_2_20)) */ -- 2.3.0