From patchwork Wed Sep 30 06:11:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 524154 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 4DEDF140D19 for ; Wed, 30 Sep 2015 16:11:52 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=i8wbHe6E; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=ohaKbgXfYr1eR7fycqhdm+wnrUxX2oaXVghI7GP87C3EMNsEZC UCZQKeCmgpF31FNckbNFGbBDii9Sef5T9+vZirZPpY1IC2ILFzPuXjZh0+S4OjM5 r14ybZmh1XPKS86UkmCpE8wRyI2H1Gf3MjQp+8gZlxbLcw9hDtYNpAG/s= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=H8p8PiL/gClMfyjGWlGyrCzajAQ=; b=i8wbHe6Et9JDKRnAsY13 uKkboICD8QXe9WY8U6BKppvv7EtDR2WHSP7iWwZsmxV4V71jqUDnlsl3cUBWB/GJ IS05ylkgqC9nVbYRLLmntsMkav8w1B3Iy6gskf3TQYWDgdK2yS09ZVAbf3OZN0Mv ognCX5cY5GyC40UkxJF7iJ4= Received: (qmail 76552 invoked by alias); 30 Sep 2015 06:11:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 76539 invoked by uid 89); 30 Sep 2015 06:11:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f42.google.com Received: from mail-pa0-f42.google.com (HELO mail-pa0-f42.google.com) (209.85.220.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 30 Sep 2015 06:11:42 +0000 Received: by pacex6 with SMTP id ex6so30062415pac.0 for ; Tue, 29 Sep 2015 23:11:41 -0700 (PDT) X-Received: by 10.66.190.41 with SMTP id gn9mr2755219pac.0.1443593501054; Tue, 29 Sep 2015 23:11:41 -0700 (PDT) Received: from bubble.grove.modra.org (CPE-58-160-163-67.gqzg1.fli.bigpond.net.au. [58.160.163.67]) by smtp.gmail.com with ESMTPSA id rz10sm29361405pab.42.2015.09.29.23.11.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Sep 2015 23:11:40 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 59E37EA0136; Wed, 30 Sep 2015 15:41:35 +0930 (ACST) Date: Wed, 30 Sep 2015 15:41:35 +0930 From: Alan Modra To: gcc-patches@gcc.gnu.org Cc: David Edelsohn Subject: [RS6000] Make -msingle-pic-base remove the ELFv2 global entry code Message-ID: <20150930061135.GB32709@bubble.grove.modra.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes For other ABIs, -msingle-pic-base makes gcc omit loading of the PIC register in function prologues. This patch makes the option affect ELFv2 too. I wrote a patch like this during the initial ELFv2 effort, but there were many more important patches to push and this one somehow got dropped. Dusted off and retested at the request of powerpc64 kernel people who'd like an option to disable ELFv2 global entry code for the kernel. OK mainline? * config/rs6000/rs6000.c (rs6000_emit_prologue): Don't set r2_setup_needed when TARGET_SINGLE_PIC_BASE. (rs6000_output_mi_thunk): Likewise. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index ae456ff..023f622 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -24118,13 +24118,13 @@ rs6000_emit_prologue (void) #define NOT_INUSE(R) do {} while (0) #endif - if (DEFAULT_ABI == ABI_ELFv2) + if (DEFAULT_ABI == ABI_ELFv2 + && !TARGET_SINGLE_PIC_BASE) { cfun->machine->r2_setup_needed = df_regs_ever_live_p (TOC_REGNUM); /* With -mminimal-toc we may generate an extra use of r2 below. */ - if (!TARGET_SINGLE_PIC_BASE - && TARGET_TOC && TARGET_MINIMAL_TOC && get_pool_size () != 0) + if (TARGET_TOC && TARGET_MINIMAL_TOC && get_pool_size () != 0) cfun->machine->r2_setup_needed = true; } @@ -26800,7 +26800,8 @@ rs6000_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED, /* Ensure we have a global entry point for the thunk. ??? We could avoid that if the target routine doesn't need a global entry point, but we do not know whether this is the case at this point. */ - if (DEFAULT_ABI == ABI_ELFv2) + if (DEFAULT_ABI == ABI_ELFv2 + && !TARGET_SINGLE_PIC_BASE) cfun->machine->r2_setup_needed = true; /* Run just enough of rest_of_compilation to get the insns emitted.