Hi,
Just an addition to the above. I'm working with CW 6.4 and it ignores the LCF *(COMMON) output section and sticks all uninitialised global data in the .bss section. !!??!!
I have the following:
1. static int x; > .bss
2. static int y = 1; > .data
3. static int y = 0; > .bss Couldn't this be quite dangerous as it relies on the start-up code zeroing the .bss. Uninitialised data should always be initialised before use.
4. int a > .bss This should be emitted to .common or in this case *(COMMON) if provide the LCF however if I look at a disassembled c module the compiler does provide the required named section. This can be seen by looking at the section index field (Shndx) in the symbol table.
5. int a =1; > .data
Also the linker documentation is very poor. Try searching the help file for COMMON, SCOMMON or .common ;0)
Snippet from my LCF
.uninitialized_data :
{
__START_BSS = .;
*(.bss)
. = ALIGN(0x8);
# This should be for common GLOBAL variables declared in compiled code outside of any function
# without the extern or static qualifier and which are not initialized. line has no effect!
# All global uininitialised data declared as static,extern or with no type class specifier
# are emmited to .bss TOGETHER WITH DATA INITIALISED TO 0
*(COMMON)
__END_BSS = .;
. = ALIGN(0x8);
} >> DATA
Any comments?
DaveCook