local symbols problem for RTL

Chris Johns chrisj at rtems.org
Thu May 30 19:28:41 UTC 2013

Peng Fan wrote:
> hi,
> Now I have a idea about how to include local symbols in the RAP file,
> and try to not increase the size of the RAP file.
> 1. About the relocations.
> The current layout for the relocations  is:
> | header | reloc entries|
> the first bit of header indicates whether it is rela or not. the
> remaining 30 bits indicates the number of reloc entries.
> But now I want to include elf object index for reloc entries and symbols
> to resolve conflicting local symbols. For example two objects both
> contains the ".LC0" symbols, how to figure out which ".LC0" symbol is
> needed for the reloc entry.
> I want to use the following layout for reloc part of RAP file .
> | header | counts(object 1) | reloc entries | counts(object 2) | reloc
> entries .....

It looks fine if we finally decide we need locals in a RAP file.

Please note if the RAP format changes we need to change the RAP version 
number. The RAP header has a version number and currently it is hard 
coded in rtems-ld. I think this should be added as a const to the 'rap' 
namespace and formatted into the header. The target side needs to check 
which version it can support, ie up to a specific version and not 
higher. The version is an incrementing number. I will look at adding 
this soon.

> The header still contains the total number of reloc entries just like
> the current implementation.
> 2. About the local symbols.
> Now there is a 'symtab_size' variable to indicates how many global
> symbols are in the rap file.
> Because I want to include local symbols, I want to add a local symbol
> table after the global symbol table.
> | global_symtab_size | local_symtab_size | .......
> | global symbol table
> | object1 local_symtab_size | object1 local symbol table
> | object2 local_symtab_size| object2 local symbol table | ....
> My current implementation is each reloc entry contains an object index
> and each symbol contains an object index. But this may consume more
> space, I prepare to rewrite this using 1 and 2.
> However I am not sure whether this is ok.

I am still wondering if we need locals in the RAP file. Could some form 
of incremental linking pass in rtems-ld remove them ?

Do you have a simple C piece of code with a compile command line that 
results in an ELF file with these local symbols ? I would like to 
understand why they are present.


More information about the devel mailing list