From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18691 invoked by alias); 9 Apr 2009 11:25:24 -0000 Received: (qmail 18675 invoked by uid 22791); 9 Apr 2009 11:25:22 -0000 X-SWARE-Spam-Status: No, hits=-0.2 required=5.0 tests=AWL,BAYES_20 X-Spam-Check-By: sourceware.org Received: from mail.redpinesignals.com (HELO mail.redpinesignals.com) (203.196.161.92) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 09 Apr 2009 11:25:17 +0000 Received: from [192.168.40.84] ([192.168.40.84]) (authenticated user sumanth.gundapneni@redpinesignals.com) by mail.redpinesignals.com for gcc-help@gcc.gnu.org; Thu, 9 Apr 2009 16:55:25 +0530 Message-ID: <49DDD96A.4090407@redpinesignals.com> Date: Thu, 09 Apr 2009 11:25:00 -0000 From: sumanth User-Agent: Thunderbird 2.0.0.16 (X11/20080707) MIME-Version: 1.0 To: gcc-help@gcc.gnu.org Subject: How to generate a PC- relative load instruction. Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2009-04/txt/msg00107.txt.bz2 Hi, How can I generate a load instruction with pc-relative accessing of "global" variables. As far as I know I need to modify GO_IF_LEGITIMATE_ADDRESS X is an RTX ; 1. GET_CODE (X) == PC + offset 2. GET_CODE (X) == LABEL_REF or GET_CODE (X) == SYMBOL_REF and split the label to PC + offset (if possible) . The problem here is how can I keep data in PC + offset and tell my compiler. The only reference is in arm as far as I know. Its some thing like "a = 10 " is a global variable and i need to load its address it in to register r0. 120 ld r0(destination), pc ,#4 124 0x2345678e value 10 is in 0x2345678e Can any one help me in this regard . Thanks in advance. Thanks, Sumanth