From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21954 invoked by alias); 31 Mar 2005 05:15:43 -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 21391 invoked from network); 31 Mar 2005 05:14:53 -0000 Received: from unknown (HELO petasus.ims.intel.com) (62.118.80.130) by sourceware.org with SMTP; 31 Mar 2005 05:14:53 -0000 Received: from mssmsxvs01.ims.intel.com (mssmsxvs01.ims.intel.com [10.125.2.23]) by petasus.ims.intel.com (8.12.9-20030918-01/8.12.10/d: small-solo.mc,v 1.2 2004/09/17 18:05:04 root Exp $) with SMTP id j2V5LR0M031075; Thu, 31 Mar 2005 05:21:28 GMT Received: from mssmsx331.ccr.corp.intel.com ([10.125.2.16]) by mssmsxvs01.ims.intel.com (SAVSMTP 3.1.7.47) with SMTP id M2005033109144011925 ; Thu, 31 Mar 2005 09:14:40 +0400 Received: from mssmsx403.ccr.corp.intel.com ([10.125.2.52]) by mssmsx331.ccr.corp.intel.com with Microsoft SMTPSVC(6.0.3790.211); Thu, 31 Mar 2005 09:14:40 +0400 Received: from nnsmsx401.ccr.corp.intel.com ([10.125.16.24]) by mssmsx403.ccr.corp.intel.com with Microsoft SMTPSVC(6.0.3790.211); Thu, 31 Mar 2005 09:14:40 +0400 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: HELP with linker script!!! Date: Thu, 31 Mar 2005 15:08:00 -0000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: From: "Zagorodnev, Grigory" To: "Pieter Arnout" , X-OriginalArrivalTime: 31 Mar 2005 05:14:40.0670 (UTC) FILETIME=[8AA7DBE0:01C535B0] X-SW-Source: 2005-03/txt/msg00918.txt.bz2 Hi, Pieter! You may consider this example: "implicit" linker script contains extra information to combine user-defined section with default ".data" one, providing the beginning mark. C program accesses this mark as data object.=20 $ cat main.c #include int my_val __attribute__((section("my_section"))) =3D 123; =20 extern int my_section_start; =20 int main(){ printf("%d - %d\n", my_val, my_section_start); } $ cat main.script=20 SECTIONS { .data : {=20 my_section_start =3D .; *(my_section)=20 } } $ gcc main.c main.script=20 $ ./a.out 123 - 123 Best regards! --- Grigory Zagorodnev Intel Corporation >-----Original Message----- >From: binutils-owner@sources.redhat.com [mailto:binutils- >owner@sources.redhat.com] On Behalf Of Pieter Arnout >Sent: Thursday, March 31, 2005 4:27 AM >To: binutils@sources.redhat.com >Subject: HELP with linker script!!! > >I read the the Red Hat manual "Using ld, the GNU Linker", 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. I can obtain the symbol values and symbol >type from the objdump or nm output. The only examples offered in the >manual, however, only define the output sections .bss and .data by just >assigning everything from the .bss and .data input sections to it: > >SECTIONS >{ > . =3D 0x10000; > .text : { *(.text) } > . =3D 0x8000000; > .data : { *(.data) } > .bss : { *(.bss) } >} > >I want some finer control. Does anyone know how I can go about >ultimately assigning specific symbols (or data structures if you will) >to a memory region? Should / can I create a section (much like .text, >.data or .bss above) in the linker script and call it "my_section" and >assign a list of symbols to "my_section"? Is this how I would go about >accomplishing what I want? If so do I reference the symbols by name or >by value when I call them out in the SECTIONS command? How does that >look like? > >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? > >I need answers urgently. > >Thanks so much for your help! > >Pieter