This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

exporting linker script symbols in statically linked binaries


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 <symbol name, address of required data> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]