From patchwork Tue Apr 26 12:07:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Liebler X-Patchwork-Id: 614940 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 3qvMLv0xCgz9t50 for ; Tue, 26 Apr 2016 22:08:38 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=UwqoBpff; dkim-atps=neutral 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=vRnhclHwBtH98wkKkL4YDK0rOS96doC fwankaX/Wf492Vt5VSXecSBhMp9SAudtDlRHy1khf8uOVD1spbB7knyEl1MuJrFY vb3x7WRL40geTFT5dkaDYzY0hvNNNLwwtYvT5Dr4LG+pSCLhr2o9d8c+/B2zqDn1 xt/NH6wsM8rk= 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=Hm2T1M9/q8zXqzVBHZJby66XVDw=; b=UwqoB pffdt2eiWdz21IbHPsplwuNicdPO63BMtK0yyomPA7Srmu3BUWTxwz+g1CExC1Kz hMyQKDdNr5q/PAKAVHgbgi+rzibELqysKliLEXIvmVZJKZ08wxQi7yFOWvsj0XJ4 tzZaoRl4ctsvWir3pjSiYfaTArSgFcsGj4pKxc= Received: (qmail 101517 invoked by alias); 26 Apr 2016 12:08:31 -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 101498 invoked by uid 89); 26 Apr 2016 12:08:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=is_in, IS_IN, sk:gnu_in, memcpy.s X-HELO: e06smtp06.uk.ibm.com X-IBM-Helo: d06dlp03.portsmouth.uk.ibm.com X-IBM-MailFrom: stli@linux.vnet.ibm.com X-IBM-RcptTo: libc-alpha@sourceware.org From: Stefan Liebler To: libc-alpha@sourceware.org Cc: carlos@redhat.com, Wilco.Dijkstra@arm.com, neleai@seznam.cz, Stefan Liebler Subject: [PATCH 3/4] S390: Do not call memcpy, memcmp, memset within libc.so via ifunc-plt. Date: Tue, 26 Apr 2016 14:07:48 +0200 Message-Id: <1461672469-2107-3-git-send-email-stli@linux.vnet.ibm.com> In-Reply-To: <1461672469-2107-1-git-send-email-stli@linux.vnet.ibm.com> References: <1461672469-2107-1-git-send-email-stli@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16042612-0025-0000-0000-0000172A0B07 On s390, the memcpy, memcmp, memset functions are IFUNC symbols, which are created with s390_libc_ifunc-macro. This macro creates a __GI_ symbol which is set to the ifunced symbol. Thus calls within libc.so to e.g. memcpy result in a call to *ABS*+0x954c0@plt stub and afterwards to the resolved memcpy-ifunc-variant. This patch sets the __GI_ symbol to the default-ifunc-variant to avoid the plt call. The __GI_ symbols are now created at the default variant of ifunced function. ChangeLog: * sysdeps/s390/multiarch/ifunc-resolve.h (s390_libc_ifunc): Remove __GI_ symbol. * sysdeps/s390/s390-32/multiarch/memcmp-s390.S: Add __GI_memcmp symbol. * sysdeps/s390/s390-64/multiarch/memcmp-s390x.S: Likewise. * sysdeps/s390/s390-32/multiarch/memcpy-s390.S: Add __GI_memcpy symbol. * sysdeps/s390/s390-64/multiarch/memcpy-s390x.S: Likewise. * sysdeps/s390/s390-32/multiarch/memset-s390.S: Add __GI_memset symbol. * sysdeps/s390/s390-64/multiarch/memset-s390x.S: Likewise. --- sysdeps/s390/multiarch/ifunc-resolve.h | 4 +--- sysdeps/s390/s390-32/multiarch/memcmp-s390.S | 3 +++ sysdeps/s390/s390-32/multiarch/memcpy-s390.S | 5 ++++- sysdeps/s390/s390-32/multiarch/memset-s390.S | 3 +++ sysdeps/s390/s390-64/multiarch/memcmp-s390x.S | 3 +++ sysdeps/s390/s390-64/multiarch/memcpy-s390x.S | 5 ++++- sysdeps/s390/s390-64/multiarch/memset-s390x.S | 3 +++ 7 files changed, 21 insertions(+), 5 deletions(-) diff --git a/sysdeps/s390/multiarch/ifunc-resolve.h b/sysdeps/s390/multiarch/ifunc-resolve.h index 744a0d8..26e097a 100644 --- a/sysdeps/s390/multiarch/ifunc-resolve.h +++ b/sysdeps/s390/multiarch/ifunc-resolve.h @@ -44,9 +44,7 @@ #define s390_libc_ifunc(FUNC) \ __asm__ (".globl " #FUNC "\n\t" \ ".type " #FUNC ",@gnu_indirect_function\n\t" \ - ".set " #FUNC ",__resolve_" #FUNC "\n\t" \ - ".globl __GI_" #FUNC "\n\t" \ - ".set __GI_" #FUNC "," #FUNC "\n"); \ + ".set " #FUNC ",__resolve_" #FUNC "\n\t"); \ \ /* Make the declarations of the optimized functions hidden in order to prevent GOT slots being generated for them. */ \ diff --git a/sysdeps/s390/s390-32/multiarch/memcmp-s390.S b/sysdeps/s390/s390-32/multiarch/memcmp-s390.S index e9ee6d2..a01f3b7 100644 --- a/sysdeps/s390/s390-32/multiarch/memcmp-s390.S +++ b/sysdeps/s390/s390-32/multiarch/memcmp-s390.S @@ -101,4 +101,7 @@ END(__memcmp_z10) .set memcmp,__memcmp_default .weak bcmp .set bcmp,__memcmp_default +#elif defined SHARED && IS_IN (libc) +.globl __GI_memcmp +.set __GI_memcmp,__memcmp_default #endif diff --git a/sysdeps/s390/s390-32/multiarch/memcpy-s390.S b/sysdeps/s390/s390-32/multiarch/memcpy-s390.S index 4e30cdf..92ffaea 100644 --- a/sysdeps/s390/s390-32/multiarch/memcpy-s390.S +++ b/sysdeps/s390/s390-32/multiarch/memcpy-s390.S @@ -92,7 +92,10 @@ END(__memcpy_z10) #include "../memcpy.S" -#if !defined SHARED || !IS_IN (libc) +#if defined SHARED && IS_IN (libc) +.globl __GI_memcpy +.set __GI_memcpy,__memcpy_default +#else .globl memcpy .set memcpy,__memcpy_default #endif diff --git a/sysdeps/s390/s390-32/multiarch/memset-s390.S b/sysdeps/s390/s390-32/multiarch/memset-s390.S index 47277c1..a2ddd98 100644 --- a/sysdeps/s390/s390-32/multiarch/memset-s390.S +++ b/sysdeps/s390/s390-32/multiarch/memset-s390.S @@ -110,4 +110,7 @@ END(__memset_mvcle) #if !IS_IN (libc) .globl memset .set memset,__memset_default +#elif defined SHARED && IS_IN (libc) +.globl __GI_memset +.set __GI_memset,__memset_default #endif diff --git a/sysdeps/s390/s390-64/multiarch/memcmp-s390x.S b/sysdeps/s390/s390-64/multiarch/memcmp-s390x.S index 2a4c0ae..b28ccaf 100644 --- a/sysdeps/s390/s390-64/multiarch/memcmp-s390x.S +++ b/sysdeps/s390/s390-64/multiarch/memcmp-s390x.S @@ -98,4 +98,7 @@ END(__memcmp_z10) .set memcmp,__memcmp_default .weak bcmp .set bcmp,__memcmp_default +#elif defined SHARED && IS_IN (libc) +.globl __GI_memcmp +.set __GI_memcmp,__memcmp_default #endif diff --git a/sysdeps/s390/s390-64/multiarch/memcpy-s390x.S b/sysdeps/s390/s390-64/multiarch/memcpy-s390x.S index 69fa562..8f54526 100644 --- a/sysdeps/s390/s390-64/multiarch/memcpy-s390x.S +++ b/sysdeps/s390/s390-64/multiarch/memcpy-s390x.S @@ -88,7 +88,10 @@ END(__memcpy_z10) #include "../memcpy.S" -#if !defined SHARED || !IS_IN (libc) +#if defined SHARED && IS_IN (libc) +.globl __GI_memcpy +.set __GI_memcpy,__memcpy_default +#else .globl memcpy .set memcpy,__memcpy_default #endif diff --git a/sysdeps/s390/s390-64/multiarch/memset-s390x.S b/sysdeps/s390/s390-64/multiarch/memset-s390x.S index 05e0682..a77e798 100644 --- a/sysdeps/s390/s390-64/multiarch/memset-s390x.S +++ b/sysdeps/s390/s390-64/multiarch/memset-s390x.S @@ -106,4 +106,7 @@ END(__memset_mvcle) #if !IS_IN (libc) .globl memset .set memset,__memset_default +#elif defined SHARED && IS_IN (libc) +.globl __GI_memset +.set __GI_memset,__memset_default #endif