|ARM Technical Support Knowledge Articles|
Applies to: GNU C Compiler for ARM
Information in this article applies to:
I have declared just a few variables in my application, but the data space seems to be quickly used up. When I define the following variables, it appears that there are big gaps in the memory layout:
int ival; short sval; long lval;
What is the reason for that?
The GNU compiler has an alignment problem with uninitialized data. There are two possible work-arounds:
int ival = 0; short sval = 0; long lval = 0;
An alternative is the GNU compiler directive -fno-common (enter under Options - CC - Misc Contorls: -fno-common). Using -fno-common, variables are placed into the .bbs section where alignment problems do not exist. However you may get side effects with libraries, since the library files must be translated consistently.
To prevent the linker error Not enough room for program headers, try linking with -N, you need to add under Options - Linker - Misc Controls: -N.
Article last edited on: 2006-07-10 12:21:11
Did you find this article helpful? Yes No
How can we improve this article?