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: 31934 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== Return-Path: 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 ()