From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25789 invoked by alias); 13 Apr 2010 17:44:33 -0000 Received: (qmail 25780 invoked by uid 22791); 13 Apr 2010 17:44:33 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Apr 2010 17:44:28 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o3DHiReQ031550 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 13 Apr 2010 13:44:27 -0400 Received: from zebedee.pink (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o3DHiPTc013267; Tue, 13 Apr 2010 13:44:26 -0400 Message-ID: <4BC4AD79.90502@redhat.com> Date: Tue, 13 Apr 2010 17:44:00 -0000 From: Andrew Haley User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091209 Fedora/3.0-4.fc12 Thunderbird/3.0 MIME-Version: 1.0 To: gcc-help@gcc.gnu.org Subject: Re: Figuring out start and end of sections References: <20100413174042.GB3531@gandalf> In-Reply-To: <20100413174042.GB3531@gandalf> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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/msg00104.txt.bz2 On 04/13/2010 06:40 PM, Felipe Balbi wrote: > is there any way to figure out where a section starts and ends ? > > I added a specific section to my program using > __attribute__((section "
")) and now I want to figure out > where that section starts so I can iterate over it and call the function > pointers I'm adding to it. Terminate the list with a null pointer; AFAIK that's what everyone else does. To get the start address, you just need to define a global variable in that section. Of course this means you have to link everything in the correct order. Andrew.