A.1.2.2 Changing the area to be allocated using the -Xsection option
The -Xsection option can be used to change the default allocation section. The code size can be reduced by performing allocation to a section with high access efficiency.
(1) | Specify the default section type using the -Xsection option. |
Example | Allocating to .sdata/.sbss section |
>ccrh main.c -Xsection=data=gp_disp16
|
However, an error will be output at linkage if the variables do not fit in the section specified in (1). In this case, change the section of the variables in the C source file.
E0562330 : Relocation size overflow : "file"-"section"-"offset"
|
Example | Changing variables to .sdata23/.sbss23 section |
int a = 1; /* Allocated to the section specified in (1) */
int b; /* Allocated to the section specified in (1) */
#pragma section gp_disp23
int c = 1; /* Allocated to the .sdata23 section */
int d; /* Allocated to the .sbss23 section */
#pragma section default
int e = 1; /* Allocated to the section specified in (1) */
int f; /* Allocated to the section specified in (1) */
|