Forum Discussion
Altera_Forum
Honored Contributor
14 years agoYou might be just falling foul of a change Altera made between the gcc3 and gcc4 versions of the compiler.
The gcc4 version doesn't put items with external linkage into the 'small data segment' (gcc3 did). So code compiled with gcc3 might be trying to use gp-relative addressing for items gcc4 has placed in a normal data area. Another possibility is that the linker isn't correctly mapping all the 'small data' sections together - maybe it gets bss ones wrong?? Having looked at the generated code, using gp relative addressing is a big win on code size and speed - mostly by reducing register pressure (no regsiters kept with the addresses of global data in them). You can do better though, putting all the static data into a single structure and using a global register variable to point to it generates better code! In you case I'd look at the linker map file to find out why a symbol is so far from the global pointer - I can't believe you have that much data that would be put into the 'small data' segment.