Forum Discussion
Altera_Forum
Honored Contributor
20 years agoThe compiler assumes that all data in the sdata and sbss sections can be reached using the GP register. The compiler otherwise treats these sections the same as the data and bss sections.
So if you declare global variables as being in a different section (different memory) the compiler won't use GP relative addressing which will be safe but potentially slower. Are you using your own linker script? If so then you need to ensure that the _gp linker variable (which sets up the value of gp) is within range of the .sbss and .sdata sections. ps. It would be possible to perform the gprel optimisations at link time but this would be a lot more work so isn't near the top of the list yet.