From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21236 invoked by alias); 31 Mar 2005 12:00:26 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 21069 invoked from network); 31 Mar 2005 12:00:17 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 31 Mar 2005 12:00:17 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j2VC0HBf030257 for ; Thu, 31 Mar 2005 07:00:17 -0500 Received: from pobox.surrey.redhat.com (pobox.surrey.redhat.com [172.16.10.17]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j2VC0FO04053; Thu, 31 Mar 2005 07:00:16 -0500 Received: from [172.31.0.98] (vpnuser2.surrey.redhat.com [172.16.9.2]) by pobox.surrey.redhat.com (8.12.8/8.12.8) with ESMTP id j2VC0EpS028162; Thu, 31 Mar 2005 13:00:15 +0100 Message-ID: <424BE5A7.5060902@redhat.com> Date: Thu, 31 Mar 2005 15:50:00 -0000 From: Nick Clifton User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) MIME-Version: 1.0 To: Pieter Arnout CC: binutils@sources.redhat.com Subject: Re: HELP with linker script!!! References: <13ab0c503312082c7af572c83f523f4f@powerescape.com> In-Reply-To: <13ab0c503312082c7af572c83f523f4f@powerescape.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2005-03/txt/msg00922.txt.bz2 Hi Pieter, > I read the the Red Hat manual "Using ld, the GNU Linker", First of all it is not a Red Hat manual. It is the binutils project's linker manual. You might have been confused by the fact that the binutils project is hosted at the sources.redhat.com domain, but this is a resource provided by Red Hat to the Free Software community and it does not make the linker or its manual Red Hat property in any way. > but I'm having > trouble. Essentially, I'd like to take specific symbols and assign them > to a memory region, rather than just take a section and assign it to a > memory region. A practical example of the problem that you are trying to solve would help. The linker does not have the facility to assign individual symbols to a memory region. Instead, as Grigory has already mentioned, the way to achieve what you want is to use a custom section to contain the symbols that you are interested in, and then have the linker script assign this custom section to a specific memory region. His email shows you how to do this. > Additionally, where do I define the start and end regions of my stack > and heap? I use .bss for uninitialized variables, .data for initialized > variables, but how do I reference the beginning and end of stack and the > beginning and end of heap? That is up to you and will probably be dictated by the hardware you are using and the amount of available memory. One common design is to have the heap start at the end of the allocated sections, usually after the .bss section, and grow upwards through memory. Meanwhile the stack is placed to start at the end of the available memory and grow downwards. (This does assume that the ABI for the processor you are using has a downwards growing stack). The location for the start of the heap and the start of the stack will normally be set up by your linker script and so you can associate symbols with these locations. Finding the current end-of-heap and end-of-stack however is hardware specific. Usually a hardware register will be used as a stack pointer and so contain the end-of-stack address. The end of heap however is usually held in a private variable somewhere inside the operating system's memory allocation code and may not be accessible to application programs. Cheers Nick