From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24983 invoked by alias); 3 Apr 2007 23:11:45 -0000 Received: (qmail 24974 invoked by uid 22791); 3 Apr 2007 23:11:44 -0000 X-Spam-Check-By: sourceware.org Received: from ug-out-1314.google.com (HELO ug-out-1314.google.com) (66.249.92.171) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 04 Apr 2007 00:11:42 +0100 Received: by ug-out-1314.google.com with SMTP id m3so1484906uge for ; Tue, 03 Apr 2007 16:11:36 -0700 (PDT) Received: by 10.78.181.13 with SMTP id d13mr2243huf.1175641895665; Tue, 03 Apr 2007 16:11:35 -0700 (PDT) Received: by 10.78.164.7 with HTTP; Tue, 3 Apr 2007 16:11:35 -0700 (PDT) Message-ID: Date: Tue, 03 Apr 2007 23:11:00 -0000 From: "Prasad Boddupalli" To: binutils Subject: exporting linker script symbols in statically linked binaries MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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/msg00036.txt.bz2 Hello, In statically linked binaries, certain parts of the data segment are identified through symbolic names. For example, if the user requires data pertaining to FAT file system, the linker script looks as follows: .rodata : { ... . = ALIGN(8); __start_fatfs = ABSOLUTE(.); *(.fatfs.data); __end_fatfs = ABSOLUTE(.); ... } The program accesses the start of fatfs data by referring to the address of the symbol '_start_fatfs'. I cannot just declare 'extern char __start_fatfs[]' in the executable as there could be different data, marked by different symbols, all of which are not known to the program. I could not create another section (starting at an agreed-upon name) that contains pairs as the data to be packed (in the above read only section) exits as sections in different files. For example, there exists one file 'fatfs.dat' that contains just the above section '.fatfs.data'. To date, the binaries were dynamically linked and the program could access the values of linker script symbols by reading the dynamic symbol table (that starts at _DYNAMIC symbol). However, the binaries are now statically linked and .dynsym is not generated. The binaries are not loaded by another program and hence the alternative of reading the symbol table from the binary file and exporting those linker script symbol values is ruled out. Is there any way of exporting linker script symbols such that they can be accessed without knowing them apriori ? regards, Prasad.