Everything
A.1.1.1 GP relative access

This generates code to access variables using one instruction by placing variables in sections that can be accessed via the global pointer (GP) and an ld/st instruction.

Use a #pragma section directive when defining or accessing variables, and specify either gp_disp16 or gp_disp23 as the attribute strings.

Note

gp_disp32 does not have an effect to reduce the code size.

 

#pragma section attribute-strings
variable-declaration/definition
#pragma section default

 

Example 1.

Accessing via a GP-relative 4-byte load/store instruction

#pragma section gp_disp16
int a = 1;              /*allocated to .sdata section*/
int b;                  /*allocated to .sbss section*/
#pragma section default

 

Example 2.

Accessing via a GP-relative 6-byte load/store instruction

#pragma section gp_disp23
int a = 1;             /*allocated to .sdata23 section*/
int b;                 /*allocated to .sbss23 section*/
#pragma section default