From patchwork Wed Nov 13 16:09:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Ye X-Patchwork-Id: 290977 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id EC0FD2C0082 for ; Thu, 14 Nov 2013 03:09:55 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-type; q=dns; s=default; b=Qa/MfP93JI7Ksf8w bzAfvFlIYczL+E1AM/C8yLSHuNPadNigz67czsjyLT8Kuwc+No6CzcRGwQtJlA+M rgqYgnow7dD+tq8yskx760oVCqzD9UrIGlPNDxTCQ3bmmxT9zn176EDNGh1icThh VBoTsN4elldYZvO4aKeJENzmNvw= 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:from :to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-type; s=default; bh=1PO+EF0YfESCyE8YIUKdKx jeG7M=; b=umUnrgO/saYyguK18iXCj7Jfm2fAZwT8JLxX2nCOeENA6aX86kCJtZ /m7RewkLuCt6OqiZwRf6LOYaRYC1C1iIbTmRv5NWvYvV3S0/bIbjtd1QjQhcAS6L rhDLO7EsQe2of+Dn6u2bgIQ/IHUGFbfvztnafXzSwp+UA4c8oCDQM= Received: (qmail 30483 invoked by alias); 13 Nov 2013 16:09: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 30474 invoked by uid 89); 13 Nov 2013 16:09:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.8 required=5.0 tests=AWL, BAYES_95, KAM_STOCKGEN, RDNS_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: service87.mimecast.com Received: from Unknown (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Nov 2013 16:09:43 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 13 Nov 2013 16:09:34 +0000 Received: from E103005 ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 13 Nov 2013 16:09:32 +0000 From: "Joey Ye" To: "Richard Earnshaw" Cc: References: <000001cedf74$bd1bf710$3753e530$@arm.com> <528207A5.9070702@arm.com> <000001cee038$2a027e80$7e077b80$@arm.com> <52834B21.5080305@arm.com> <000001cee05a$0b8dbd80$22a93880$@arm.com> <52835D38.4020309@arm.com> In-Reply-To: <52835D38.4020309@arm.com> Subject: RE: [patch] [arm] New option for PIC offset unfixed Date: Thu, 14 Nov 2013 00:09:20 +0800 Message-ID: <000101cee08a$ba5b5720$2f120560$@arm.com> MIME-Version: 1.0 X-MC-Unique: 113111316093404001 This patch address all comments. Thanks, Joey > -----Original Message----- > From: Richard Earnshaw > Sent: Wednesday, November 13, 2013 19:07 > To: Joey Ye > Cc: gcc-patches@gcc.gnu.org > Subject: Re: [patch] [arm] New option for PIC offset unfixed > > On 13/11/13 10:20, Joey Ye wrote: > >>> +@item -mpic-data-is-text-relative > >>> > > +@opindex mpic-data-is-text-relative Assume that each data > >>> > > +segments are relative to text segment at load > > time. > >> > > >>> > > +Therefore, prevent PC relative and GOTOFF style relocations to > >>> > > +reference data. > >> > > >> > I think the sense of this sentence is now backwards. I'd also try > >> > to > > avoid > >> > GOTOFF in the user part of the manual. > > How about > > "Therefore, prevent addressing data with relocation types that doesn't > > apply in such circumstance." > > > >> > > > No, that's still backwards. Remember, the option is now pic-data-is-text- > relative, so the option /permits/ addressing data using PC-relative operations. > > R. diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 7757e86..5a95399 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -2504,6 +2504,11 @@ arm_option_override (void) arm_pic_register = pic_register; } + if (arm_pic_data_is_text_relative < 0 && TARGET_VXWORKS_RTP) + arm_pic_data_is_text_relative = 0; + else + arm_pic_data_is_text_relative = 1; + /* Enable -mfix-cortex-m3-ldrd by default for Cortex-M3 cores. */ if (fix_cm3_ldrd == 2) { @@ -6020,7 +6025,7 @@ legitimize_pic_address (rtx orig, enum machine_mode mode, rtx reg) || (GET_CODE (orig) == SYMBOL_REF && SYMBOL_REF_LOCAL_P (orig))) && NEED_GOT_RELOC - && !TARGET_VXWORKS_RTP) + && arm_pic_data_is_text_relative) insn = arm_pic_static_addr (orig, reg); else { @@ -21498,7 +21503,7 @@ arm_assemble_integer (rtx x, unsigned int size, int aligned_p) { /* See legitimize_pic_address for an explanation of the TARGET_VXWORKS_RTP check. */ - if (TARGET_VXWORKS_RTP + if (!arm_pic_data_is_text_relative || (GET_CODE (x) == SYMBOL_REF && !SYMBOL_REF_LOCAL_P (x))) fputs ("(GOT)", asm_out_file); else diff --git a/gcc/config/arm/arm.opt b/gcc/config/arm/arm.opt index 9b74038..adac749 100644 --- a/gcc/config/arm/arm.opt +++ b/gcc/config/arm/arm.opt @@ -158,6 +158,10 @@ mlong-calls Target Report Mask(LONG_CALLS) Generate call insns as indirect calls, if necessary +mpic-data-is-text-relative +Target Report Var(arm_pic_data_is_text_relative) Init(-1) +Assume data segments are relative to text segment. + mpic-register= Target RejectNegative Joined Var(arm_pic_register_string) Specify the register to be used for PIC addressing diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 863e518..fbe77e6 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -12120,6 +12120,12 @@ before execution begins. Specify the register to be used for PIC addressing. The default is R10 unless stack-checking is enabled, when R9 is used. +@item -mpic-data-is-text-relative +@opindex mpic-data-is-text-relative +Assume that each data segments are relative to text segment at load time. +Therefore, it permits addressing data using PC-relative operations. +This option is on by default for targets other than VxWorks RTP. + @item -mpoke-function-name @opindex mpoke-function-name Write the name of each function into the text section, directly