From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25853 invoked by alias); 14 Apr 2010 06:50:20 -0000 Received: (qmail 25845 invoked by uid 22791); 14 Apr 2010 06:50:19 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00 X-Spam-Check-By: sourceware.org Received: from ms9.webland.ch (HELO ms9smtp.webland.ch) (92.43.217.109) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 14 Apr 2010 06:50:11 +0000 Received: from macserver.private ([84.74.43.109]) by ms9smtp.webland.ch (Webland Mail Server v10.0) with ASMTP id WKM14840 for ; Wed, 14 Apr 2010 08:50:40 +0200 Received: from localhost (localhost [127.0.0.1]) by macserver.private (Postfix) with ESMTP id 927706BC060; Wed, 14 Apr 2010 08:50:08 +0200 (CEST) Received: from macserver.private ([127.0.0.1]) by localhost (macserver.private [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 15fP3An-mxIu; Wed, 14 Apr 2010 08:50:08 +0200 (CEST) Received: from fabi-PC.indel.ch (unknown [192.168.1.53]) by macserver.private (Postfix) with ESMTP id 47EA56BC055 for ; Wed, 14 Apr 2010 08:50:08 +0200 (CEST) Message-Id: <5.2.0.9.1.20100414084548.03dc6ab0@localhost> X-Sender: cenedese@localhost Date: Wed, 14 Apr 2010 06:50:00 -0000 To: gcc-help@gcc.gnu.org From: Fabian Cenedese Subject: Re: Figuring out start and end of sections In-Reply-To: <20100414063043.GC4285@gandalf> References: <20100414062234.GB4285@gandalf> <20100414062234.GB4285@gandalf> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-IsSubscribed: yes 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: 2010-04/txt/msg00123.txt.bz2 >I commented the for loop just to get the thing compiling and nm doesn't >show any __start_ symbols: > >$ nm tst | grep init >080494cc d __init_array_end >080494cc d __init_array_start >08048400 T __libc_csu_init >080495d4 d __my_initcall_my_init >08048298 T _init >080483c4 t my_init Here's what we do for structures: In the linker script: PROVIDE (__HWDEVICE_DESC_BEGIN = .); .struct_hw_dev_desc : {*(.struct_hw_dev_desc)} > ram PROVIDE (__HWDEVICE_DESC_END = .); In the code: #define STRUCT_HW_DEV_DESC __attribute__ ((section (".struct_hw_dev_desc"))) STRUCT_HW_DEV_DESC SINOSHwDeviceDesc { definition } extern char* __HWDEVICE_DESC_BEGIN[]; extern char* __HWDEVICE_DESC_END[]; SINOSHwDeviceDesc* desc = (SINOSHwDeviceDesc*) __HWDEVICE_DESC_BEGIN; desc++; And then you can use these values for whatever you want until you reach __HWDEVICE_DESC_END. bye Fabi