From patchwork Wed May 16 12:18:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 914578 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-92558-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="BsNaykU+"; 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 40mD4r0Bnxz9s33 for ; Wed, 16 May 2018 22:19:07 +1000 (AEST) 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:from:to:subject:message-id:reply-to :mime-version:content-type; q=dns; s=default; b=fMMa30PLWV9iOBOJ 8i9ECZ4DiogyTT6uykCg2W4ebCBmqyr6TXGJzF5D0EDlLqGviPFffHrZua2FbJFf jTFDA881kPW2qg51fleNC27rbizQYcWlE0M5irAn6uEmt+wsRwIZSgyZG3URU9hj D6u17LuZh+PCBy3hLtto75gzkzc= 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:from:to:subject:message-id:reply-to :mime-version:content-type; s=default; bh=oXwMgRGbP3lbWiC/a66apH eD13s=; b=BsNaykU+Z3ehIPM6lwL6TNFIM/Smcq14xSMmVxEI+bngZJrpCK2iR2 47rbaQGJp5eRnL3DgnByjWmSjx8V1pIc4dvr9nhAMTApIiG07YBQhKhGJGRBvJtD 7eLRIFiyvqWIR35+AVXQZpYGgh/4f2FumOD6/eQjikVMZ1IaXNNos= Received: (qmail 69830 invoked by alias); 16 May 2018 12:19:01 -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 69814 invoked by uid 89); 16 May 2018 12:19:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, NO_DNS_FOR_FROM autolearn=ham version=3.3.2 spammy=strncat, Hx-languages-length:1385 X-HELO: mga07.intel.com X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False X-ExtLoop1: 1 Date: Wed, 16 May 2018 05:18:56 -0700 From: "H.J. Lu" To: GNU C Library Subject: [PATCH] x86-64: Use IFUNC strncat inside libc.so Message-ID: <20180516121856.GA12678@gmail.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.5 (2018-04-13) Unlike i386, we can call hidden IFUNC functions inside libc.so since x86-64 PLT is always PIC. Tested on x86-64. Any comments? H.J. --- * sysdeps/x86_64/multiarch/strncat-c.c (STRNCAT_PRIMARY): Removed. Include . * sysdeps/x86_64/multiarch/strncat.c (__strncat): New strong alias. (__GI___strncat): New hidden alias. --- sysdeps/x86_64/multiarch/strncat-c.c | 3 +-- sysdeps/x86_64/multiarch/strncat.c | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sysdeps/x86_64/multiarch/strncat-c.c b/sysdeps/x86_64/multiarch/strncat-c.c index db8ad9917c..93a7fab7ea 100644 --- a/sysdeps/x86_64/multiarch/strncat-c.c +++ b/sysdeps/x86_64/multiarch/strncat-c.c @@ -1,3 +1,2 @@ #define STRNCAT __strncat_sse2 -#define STRNCAT_PRIMARY -#include "string/strncat.c" +#include diff --git a/sysdeps/x86_64/multiarch/strncat.c b/sysdeps/x86_64/multiarch/strncat.c index 1267eb4972..841c165565 100644 --- a/sysdeps/x86_64/multiarch/strncat.c +++ b/sysdeps/x86_64/multiarch/strncat.c @@ -27,4 +27,9 @@ # include "ifunc-unaligned-ssse3.h" libc_ifunc_redirected (__redirect_strncat, strncat, IFUNC_SELECTOR ()); +strong_alias (strncat, __strncat); +# ifdef SHARED +__hidden_ver1 (strncat, __GI___strncat, __redirect_strncat) + __attribute__((visibility ("hidden"))); +# endif #endif