From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2447 invoked by alias); 17 Feb 2009 14:56:13 -0000 Received: (qmail 2438 invoked by uid 22791); 17 Feb 2009 14:56:12 -0000 X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from nf-out-0910.google.com (HELO nf-out-0910.google.com) (64.233.182.185) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 Feb 2009 14:56:05 +0000 Received: by nf-out-0910.google.com with SMTP id h3so399854nfh.6 for ; Tue, 17 Feb 2009 06:56:02 -0800 (PST) MIME-Version: 1.0 Received: by 10.210.120.7 with SMTP id s7mr4347930ebc.78.1234882562643; Tue, 17 Feb 2009 06:56:02 -0800 (PST) In-Reply-To: References: Date: Tue, 17 Feb 2009 14:56:00 -0000 Message-ID: Subject: Re: Sparc RELA incorrect addend From: Neil Mayes To: gcc-help@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 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-02/txt/msg00117.txt.bz2 Hi, On closer inspection it's a little worse. I have a local global variable which is located in .data @ 0x020005AC whereas the rela tells me its within the .text section. Symbol value == 0x02000000 (.text vitual address) with an addend == 0x020005AC, which is actually the absolute address. Looking through binutils I can see for a global symbol there is the following comment: /* To avoid generating warning messages about truncated relocations, set the relocation's address to be the same as the start of this section. */ It's strange that it's not got the correct section ID as well as an incorrect addend. If I turn it into a global global everything is OK with addend set to zero. This is using GNU ld (GNU Binutils) 2.18 Supported emulations: elf32_sparc Thanks, Neil 2009/2/17 Neil Mayes : > Hi, > > I am implementing a dynamic task loader for RTEMS using a Sparc ERC32. > I have been looking in what is invloved and what I need to do in order > to relocate the code however I have seen the relocations which use an > addend are incorrect, the addend is the absolute value not the offset > from the symbol value. I have had a look at the bugs but can't find > this one. > > Has anyone any knowledge of this issue? > > I am using GCC version 4.2.2 > > Thanks, > Neil >