[EXT_EP-11390] ELF symbol table entry for uninitialized static variable incorrectly shows size of 0 Created: 27/Jul/23 Updated: 02/Apr/24 Resolved: 28/Aug/23 |
|
Status: | Fixed |
Project: | Embedded Software & Tools |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Medium |
Reporter: | TI User | Assignee: | TI User |
Resolution: | Fixed | Votes: | 0 |
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Product: | Code Generation Tools |
Internal ID: | CODEGEN-11328 |
Forum URL: | https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/171/t/1252803 |
Found In Release: | ARM_20.2.7.LTS C2000_22.6.0.LTS C6000_8.3.0 MSP430_20.2.0.LTS C7000_2.1.0.LTS MSP430_21.6.0.LTS C2000_21.6.0.LTS PRU_2.3.0 C7000_3.1.0.LTS ARM_20.2.0.LTS |
Fix In Release: | MSP430_20.2.8.LTS* C7000_2.1.3.LTS* MSP430_21.6.2.LTS* C7000_3.1.1.LTS C2000_22.6.1.LTS C6000_8.3.13 ARM_20.2.8.LTS* PRU_2.3.4* C2000_21.6.2.LTS* |
Affected Platform/Device: | default |
Description |
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. More details: 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. |