From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31977 invoked by alias); 2 May 2006 10:44:12 -0000 Received: (qmail 31965 invoked by uid 22791); 2 May 2006 10:44:11 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 02 May 2006 10:44:09 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k42Ai403014774; Tue, 2 May 2006 06:44:04 -0400 Received: from pobox.surrey.redhat.com (pobox.surrey.redhat.com [172.16.10.17]) by int-mx1.corp.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k42AhtSg031518; Tue, 2 May 2006 06:43:56 -0400 Received: from [10.32.68.10] (vpn-68-10.surrey.redhat.com [10.32.68.10]) by pobox.surrey.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k42Ahs6A026729; Tue, 2 May 2006 11:43:55 +0100 Message-ID: <445737D6.8000505@redhat.com> Date: Tue, 02 May 2006 10:44:00 -0000 From: Nick Clifton User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: Torsten Mohr CC: binutils@sourceware.org Subject: Re: V850, linker problem References: <200604300855.32560.tmohr@s.netic.de> <200605012054.04934.tmohr@s.netic.de> In-Reply-To: <200605012054.04934.tmohr@s.netic.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00033.txt.bz2 Hi Torsten, > .tdata ALIGN (4) : > { > PROVIDE (__ep = .); > *(.tbyte) > *(.tcommon_byte) > *(.tdata) > *(.tbss) > *(.tcommon) > } >RAM AT>rom > > __ep should be in RAM, but as "." is in ROM at the moment > the error message is: > address 0x75ec of hw2.elf section .tdata is not within region RAM > > Is this assumption correct? No. The error message is not related to the use of ".". Note, that the use of linker script variables can be quite unintuitive. For example, in the above script fragment, the *value* of the __ep variable (if it is generated by the linker script and not provided by an object file or on the linker command line) will always be 0. This is because the *value* of "." inside a section is always the offset of the current location from the start of the section. Since the definition occurs at the start of the .tdata section's description the offset will be 0. But... the *address* of the __ep symbol will be the address of the start of the .tdata section, in the "ram" memory region. That is the address of the symbol is it's address at run-time not load-time. (In linker script terminology it is its VMA address not its LMA address). Thus the *address* of __ep will be in RAM not ROM. > I define some memory regions in the beginning of the linker > script, shouldn't "ld" have one "." per memory region defined? Yes and no. The linker maintains a location counter for each memory region defined. (Plus an extra one for sections which are not assigned to any particular memory region). When an output section is assigned to a memory region it is inserted into the region at the location counter for that region, and the counter is increased. But, when the special symbol "." is referenced inside a linker script it always has a well defined value. If it is referenced inside a description of a particular section then its value is the offset from the start of that section. If it is referenced outside of a particular section description (but still inside the SECTIONS construct in the linker script) then its value is the absolute, run-time address that has been reached by the linker as it follows the script and lays out the sections in memory. Cheers Nick