From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17965 invoked by alias); 4 Apr 2005 09:39:58 -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 17872 invoked from network); 4 Apr 2005 09:39:46 -0000 Received: from unknown (HELO mail.wrs.com) (147.11.1.11) by sourceware.org with SMTP; 4 Apr 2005 09:39:46 -0000 Received: from ala-mail04.corp.ad.wrs.com (ala-mail04 [147.11.57.145]) by mail.wrs.com (8.9.3/8.9.1) with ESMTP id CAA26534; Mon, 4 Apr 2005 02:39:32 -0700 (PDT) Received: from lul-mail03.corp.ad.wrs.com ([147.11.74.23]) by ala-mail04.corp.ad.wrs.com with Microsoft SMTPSVC(6.0.3790.211); Mon, 4 Apr 2005 02:39:33 -0700 Received: from [147.11.80.21] ([147.11.80.21]) by lul-mail03.corp.ad.wrs.com with Microsoft SMTPSVC(6.0.3790.0); Mon, 4 Apr 2005 11:39:30 +0200 Message-ID: <42510B52.2090002@windriver.com> Date: Mon, 04 Apr 2005 09:39:00 -0000 From: Vincent Rubiolo User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) MIME-Version: 1.0 To: Pieter Arnout CC: binutils@sources.redhat.com Subject: Re: HELP with linker script!!! References: <13ab0c503312082c7af572c83f523f4f@powerescape.com> <424BE5A7.5060902@redhat.com> <29c1ff0410ff9cc2b88a3ad82d1938aa@powerescape.com> <424D2F42.5070508@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 04 Apr 2005 09:39:30.0729 (UTC) FILETIME=[33857190:01C538FA] X-SW-Source: 2005-04/txt/msg00059.txt.bz2 Hello Pieter, Pieter Arnout wrote: [...] > (1) How do I indicate the start and end of the cacheable .bss or > uncacheable .bss in your example? Don't they usually have symbol names > that you can use to refer to them by? I mentioned possible symbol names for the start of these sections. However, these usually do not have any end that is predefined. The linker script defines the start symbols of these sections for the initialization code to position to corresponding pointers. > In Grigory's example he writes in C code "extern int my_section_start". > Is this the way to define such a thing? Seems to me that the linker > script couldn't possibly know that the intention of this value is to > serve as a boundary for the section my_section ... No, Grigory's code is a way to reference it. You generally would only define the symbol yourself in the linker script. Here is what you can toss out : __bss_end = . ; This would define the __bss_end symbol and assign the location counter value to it. By referencing it as 'extern' in your C code, you can use it in your program/libraries. You can have more information about linker scripts by passing the --verbose flag to your ld. It will display the default linker script it uses. > (2) You say: > >> Normally the stack and heap do not have a size. Instead they occupy >> all of the memory available to the application which has not already >> been allocated to the loaded code and its data. > > This makes no sense to me. Frequently the stack and heap grow towards > each other, so isn't it important to define a boundary which they cannot > cross? How can they not have a size then? Do they just grow towards each > other until one collides with the other? Indeed. The 'boundary check', would you want to have one, should be done by your memory/program routines. This is not something that the linker is meant to do (the linker only deals with symbols and program sections/segments placement, not with program dynamic execution). > > (3) Finally I would love to find a book that was as helpful in > explaining this as your email, so I don't have to keep asking these > questions. Do you know of a good book that covers these issues? The binutils manual (http://sources.redhat.com/binutils/docs-2.15/) is of course the reference for the tools. However, it is a bit scarce on theory. You can consult John R. Levine's book which is, to my knowledge, the only book to deal with the subject (could be twice as thick however). You can find its only version here (http://www.iecc.com/linker/) or but it through your favorite book retail (I got mine via Amazon). A very good buy IMHO. HTH, Vincent [...] -- Reclaim Your Inbox! http://internal.vannes.wrsec.fr/twiki/bin/view/Utilities/MailThunderbird