Data that is globally declared in an application is allocated to memory. When referencing (loading or storing) this data that has been allocated to memory, the global pointer (gp) is provided to enable access independent of the allocation position (PID: Position Independent Data).
Set the value of the global pointer symbol (gp symbol) as the address set in the global pointer (gp).
rlink creates the definition information and sets the address automatically.
The following error message is output for code that makes references relative to the gp.
The value of the gp symbol is determined from sections with relocation attributes of sdata, sbss, sdata23, and sbss23, in the following order of precedence.
Below is an example of how the value of the gp symbol is determined.
Sets the halfway point between the start address of the sdata or sbss section with the smallest address, and the end address of the sdata or sbss section with the greatest address (multiple of 2; if the midway point is an odd number, takes the first multiple of two) as the address value of the gp symbol.
If sdata and sbss sections are placed in this order, from lowest to highest address, and there is a non-eligible section in between the sdata and sbss sections |
Sets the halfway point between the start address of the sdata23 or sbss23 section with the smallest address, and the end address of the sdata or sbss section with the greatest address (multiple of 2; if the midway point is an odd number, takes the first multiple of two) as the address value of the gp symbol.
If sdata23 and sbss23 sections are placed in this order, from lowest to highest address, and there is a non-eligible section in between the sdata23 and sbss23 sections |
If there are no sdata, sbss, sdata23, or sbss23 sections, then the address value of the gp symbol is set to zero (0).