-
Bug
-
Resolution: Fixed
-
Medium
-
Code Generation Tools
-
CODEGEN-11328
-
-
-
default
The ELF symbol table entry for an uninitialized static variable incorrectly shows size of 0.
The TI assembler was not correctly setting size for variables allocated using the .bss directive.
.bss ||svar_bss||,1,1,0
More details:
----------------
The attached C file has these lines ...
int global_variable; static int static_variable; void init(int *); int use_static() { init(&static_variable); return static_variable; }
Build it with the proprietary TI Arm compiler, and the clang based TI Arm compiler.
$ armcl file.c $ tiarmclang -c file.c
Note armcl produces file.obj, and tiarmclang produces file.o . Compare the output of the names utility in long format.
$ armnm -l file.obj | findstr variable [29] |0x00000004|4|GLOB |COMN |HIDN |COMN |global_variable [2] |0x00000000|0|LOCL |OBJT |HIDN |3 |static_variable $ armnm -l file.o | findstr variable [7] |0x00000004|4|GLOB |OBJT |HIDN |COMN |global_variable [4] |0x00000000|4|LOCL |OBJT |DFLT |7 |static_variable
The third number is the size field of the symbol table entry. Compare the size field for static_variable. armcl shows 0, while tiarmclang shows 4.