Uninitialized variables is getting assigned to DATA section instead of BSS section in ARM Compiler 6.6.How to resolve this other than placing the variable in .bss.<section_name>?
Is there any other linker/Compiler options available for this?
I assume that you mean uninitialized global variables here. Such a variable is placed in .bss by the compiler in the object file. The linker is very flexible, so maybe you have inadvertently asked it to place bss data from object files into general data sections in the executable image? With fromelf -s you should be able to see where it goes wrong (object or image) and which symbol is placed in which section, and check the section type/flags to see if this is a .bss (SHT_NOBITS is set) or a .data (SHT_PROGBITS and SHF_WRITE are set). Hope this helps.
Thank you for the info.
Please find the detailed info about my query.
unsigned char __attribute__((section(".myregion"))) myData[0x2000];
Base Addr Size Type Attr Idx E Section Name Object
0x20000000 0x00002000 Data RW 6699 .myregion myFile.a(myFile1.obj)
unsigned char __attribute__((section(".bss.myregion"))) myData[0x2000];
0x20000000 0x00002000 Zero RW 6699 .myregion myFile.a(myFile1.obj)
In Case 1, why is the section Type set to "Data"?
Can I have any other way of setting a particular section Type to "Zero" other than using .bss.<section_name>
The compiler by default puts every variable in its own section (-fdata-sections), but if you need a special named section you have the following options that I'm aware of:
The latter seems to be what you want:
// set bss section to .myRegion#pragma clang section bss=".myRegion"unsigned char myData[0x2000];// reset bss section to original#pragma clang section bss=""
View all questions in Arm Compilers forum