Everything
6.2 Special Symbol

The optimizing linker generates reserved symbols set to the values of the start addresses of each output section, and the first address beyond the end of each output section. If the user defines a symbol with the same name as one of these reserved symbols, then the optimizing linker will use the defined symbol, and will not generate its own.

 

The following two types of symbols are used as the name of the reserved symbol with the value of the start address of a section.

-

Symbol with the string "__s" preceding the name of the output section

-

Symbol with characters "@" and "." in the name of the output section replaced with "_" and the string "__S" added to the beginning [V1.06.00 or later]

 

The following two types of symbols are used as the name of the reserved symbol with the value of the first address after the end of a section.

-

Symbol with the string "__e" preceding the name of the output section

-

Symbol with characters "@" and "." in the name of the output section replaced with "_" and the string "__E" added to the beginning [V1.06.00 or later]

 

For example, when there are two sections, the .text section and FOO.const section, in an executable file, the eight special symbols shown below are generated.

__s.text

__S_text

__e.text

__E_text

__sFOO.const

__SFOO_const

__eFOO.const

__EFOO_const

 

Four of these special symbols (__S_text, __E_text, __SFOO_const, and __EFOO_const) can be referenced from the C source. To do this, specify as follows:

-

Remove one underscore (_) from the beginning of the symbol name, and then declare the symbol as a char-type variable or char array-type variable with the extern specifier.

 

Example

extern char _S_text;
char* get_S_text(void) {
  return &_S_text;
}
 
extern char _E_text[];
char* get_E_text(void) {
  return _E_text;
}