From patchwork Fri Nov 4 17:47:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 691370 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 3t9Tnf1mSMz9vG0 for ; Sat, 5 Nov 2016 04:47:50 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="trJmjMwp"; 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:date:from:to:subject:message-id:reply-to :mime-version:content-type; q=dns; s=default; b=LOCAg+vHmDkyGoGT mD4Ya594zotFO518nqixz40KZkQl3IA8lpXq5X+7OxiRqyEmu3duWHvStO5d9JfF aKwnr/vO0apk/1LW+d9SaFDXYePDB75E4DBIAsuz8404eoIwTZv0VixeN48oVke1 Kfqb+Q0VOkYr29mDhstT6Zmp0Rs= 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=9QWv7ckF+4bgyJBTin4n5W 9DtLY=; b=trJmjMwpC/qQ2hz+dqgOidoV6Jscp74pFM+lYNbG2P37Az1CgZzE+3 GK/1FJcqNg2OSvhVqghzyCHW2ENcJOe1FJUfwtnKIWAugtMEFHdmgvdNO6FVw2ck 25iHcMKoGJl6se6b6xEljwTNwAOoeY3AaBXroK5IXm8w4B22qmZE4= Received: (qmail 8648 invoked by alias); 4 Nov 2016 17:47:42 -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 8623 invoked by uid 89); 4 Nov 2016 17:47:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, NO_DNS_FOR_FROM, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mga11.intel.com X-ExtLoop1: 1 Date: Fri, 4 Nov 2016 10:47:39 -0700 From: "H.J. Lu" To: GNU C Library Subject: [PATCH] Don't use PLT nor GOT in libc.a [BZ #20750] Message-ID: <20161104174739.GA5880@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.7.1 (2016-10-04) There is no need to use PLT nor GOT in libc.a to branch to a function, regardless whether libc.a is compiled with PIC or not. Tested on x86-64. OK for master? H.J. --- [BZ #20750] * sysdeps/x86_64/sysdep.h (JUMPTARGET): Check SHARED instead of PIC. --- sysdeps/x86_64/sysdep.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sysdeps/x86_64/sysdep.h b/sysdeps/x86_64/sysdep.h index 75ac747..fd25c90 100644 --- a/sysdeps/x86_64/sysdep.h +++ b/sysdeps/x86_64/sysdep.h @@ -89,13 +89,14 @@ lose: \ END (name) #undef JUMPTARGET -#ifdef PIC +#ifdef SHARED # ifdef BIND_NOW # define JUMPTARGET(name) *name##@GOTPCREL(%rip) # else # define JUMPTARGET(name) name##@PLT # endif #else +/* For libc.a, we want to branch to target directly. */ # define JUMPTARGET(name) name #endif