From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24201 invoked by alias); 10 Apr 2007 21:22:25 -0000 Received: (qmail 24190 invoked by uid 22791); 10 Apr 2007 21:22:25 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 10 Apr 2007 22:22:22 +0100 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.1/8.13.1) with ESMTP id l3ALMJkK032171; Tue, 10 Apr 2007 17:22:19 -0400 Received: from pobox.surrey.redhat.com (pobox.fab.redhat.com [10.33.63.12]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l3ALMJWr004444; Tue, 10 Apr 2007 17:22:19 -0400 Received: from [10.13.248.41] (vpn-248-41.boston.redhat.com [10.13.248.41]) by pobox.surrey.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id l3ALME7w019091; Tue, 10 Apr 2007 22:22:18 +0100 Message-ID: <461C00F5.9060906@redhat.com> Date: Tue, 10 Apr 2007 21:22:00 -0000 From: Nick Clifton User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) MIME-Version: 1.0 To: Prasad Boddupalli CC: binutils Subject: Re: exporting linker script symbols in statically linked binaries References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2007-04/txt/msg00096.txt.bz2 Hi Prasad, > Is there any way of exporting linker script symbols such that they can > be accessed without knowing them apriori ? I am not really clear as to why your code cannot know the names of symbols at compile time, but the short answer to your question is "no". There are tricks that you can try. You could put a magic number into the data section (eg 0x12345678) followed by linker directives to store the names of the symbols, and then have your code scan through the data section looking for this magic number and the names that follow it. You could get the name of the executable via the argv[0] element and scan the file system for the corresponding file and then parse that. You could do what David has suggested and write a script to parse the output of the linker's -Map option and dump the symbol names/addresses into a file which is then read by your program. Cheers Nick