From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8361 invoked by alias); 14 Apr 2010 08:49:59 -0000 Received: (qmail 8336 invoked by uid 22791); 14 Apr 2010 08:49:58 -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; Wed, 14 Apr 2010 08:49:54 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o3E8nmBB029123 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 14 Apr 2010 04:49:48 -0400 Received: from zebedee.pink (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o3E8nl0q003449; Wed, 14 Apr 2010 04:49:48 -0400 Message-ID: <4BC581AB.705@redhat.com> Date: Wed, 14 Apr 2010 08:49: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 CC: me@felipebalbi.com Subject: Re: Figuring out start and end of sections References: <20100413174042.GB3531@gandalf> In-Reply-To: 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/msg00125.txt.bz2 On 04/14/2010 01:24 AM, Ian Lance Taylor wrote: > Felipe Balbi writes: > >> 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. >> >> Do I need a specific linker script to achieve that or does the default >> scripts give me possibility to find that out ? > > If you are using the GNU linker, or gold, and you make the section > name a valid C identifier, then the linker will automatically define > symbols __start_SECNAME and __stop_SECNAME which you can use. Ah, that's a much better idea. Forget my suggestion. Andrew.