From patchwork Thu Mar 21 12:24:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 1060077 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-100781-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="F00r4YuY"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="OCcbYAWH"; 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 44Q5qy5qhPz9s7h for ; Thu, 21 Mar 2019 23:36:14 +1100 (AEDT) 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:subject:date:message-id:mime-version :content-transfer-encoding; q=dns; s=default; b=lkWkpgl1XLndxF24 eGuNRfrapGAj8XmQ3ei0vqjqNpWOkQ55zwYTFmj7e5URgzwzb4GyBxhAHW3TS1Ad weZ4sYTRxDEDFFrJXAVmQHRwp++s8wV3bB34SdnKz3m4krZi6SVQEHm1o/W/maEf DxKGrOvp0lVw2V6L+Wdykbfg06o= 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:subject:date:message-id:mime-version :content-transfer-encoding; s=default; bh=tHVsSxdorWvpLtBWxNOElb ju8Ng=; b=F00r4YuYZcLmUPITc2Zwsdfw3xBoVkmfXi3Aou+aKPx5L5pYd9joPP ZiZ+lIjUjn2egAa/yO1xl4gmKMCf8S9wiAr9lGSSbwypbwZOHa9M7D2XWU4izgKh BX5sNTNGF9my9/wTpOYukpQSZYqDOvn4mWofwl7qZw0MZmwqIjTtc= Received: (qmail 22272 invoked by alias); 21 Mar 2019 12:36:08 -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 22260 invoked by uid 89); 21 Mar 2019 12:36:07 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=H*r:207, HContent-Transfer-Encoding:8bit X-HELO: mail-io1-f45.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=8f01fABimEpaJl/WxKW7dG/hoblERUeoRiG4pLIMXlk=; b=OCcbYAWHGDP/PFqq2/DXEkXdjFl1d/SRwRu+w7TN7opRJfP1qawRDLbHGNwCAsXYi5 MPl/spi2A0jDuFHiM7YyjV8eZI+mjaOjkNupPAm0LbaMkZRQTTNaP7VMoJzFvPmfg1xE RweF2U65i1LzuOfv3BnApy68oC20QgC4OGHVmQP59JUSzWGI0u7OsC1jv+GRlAd+I21t /AsI5071A9pGTc+LNqYUXEv2T5XKdig057mLLqVFyX4X3RoekNyweSyU4ebo7U4Uq1sT tmhQIcY5ZDA1WrwnaheqDc/TFcfy32Oh//DJscSsUtVVt6Ds47VtMb2j0MVootoUA+V/ J/mg== From: "H.J. Lu" To: libc-alpha@sourceware.org Subject: [PATCH] x86: Don't use apply_irel in static PIE Date: Thu, 21 Mar 2019 20:24:45 +0800 Message-Id: <20190321122445.28990-1-hjl.tools@gmail.com> MIME-Version: 1.0 On x86, since _dl_relocate_static_pie also processes IFUNC relocations, there is no need to call apply_irel. Tested on i686 and x86-64. * csu/libc-start.c (apply_irel): Add unused attribute. * sysdeps/x86/libc-start.h (ARCH_SETUP_IREL): Defined as empty for static PIE. --- csu/libc-start.c | 1 + sysdeps/x86/libc-start.h | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/csu/libc-start.c b/csu/libc-start.c index 5d9c3675fa..07be05f1e9 100644 --- a/csu/libc-start.c +++ b/csu/libc-start.c @@ -66,6 +66,7 @@ uintptr_t __pointer_chk_guard_local # endif static void +__attribute__ ((unused)) apply_irel (void) { # ifdef IREL diff --git a/sysdeps/x86/libc-start.h b/sysdeps/x86/libc-start.h index c76b1d917f..e544867c1d 100644 --- a/sysdeps/x86/libc-start.h +++ b/sysdeps/x86/libc-start.h @@ -17,7 +17,12 @@ . */ #ifndef SHARED -# define ARCH_SETUP_IREL() apply_irel () +# if ENABLE_STATIC_PIE +/* NB: x86 doesn't use apply_irel in static PIE. */ +# define ARCH_SETUP_IREL() +# else +# define ARCH_SETUP_IREL() apply_irel () +# endif # define ARCH_APPLY_IREL() # ifndef ARCH_SETUP_TLS # define ARCH_SETUP_TLS() __libc_setup_tls ()