Mail Archives: cygwin/2002/07/12/09:40:39
Hi!
Friday, 12 July, 2002 Wolfgang Hesseler qv AT multimediaware DOT com wrote:
>> >> If you run gcc with '--save-temps' flag, and then look into
>> >> 'yourfile.s' file, you'll see that uninitialized data is tagged as
>> >> "common" (using '.comm' directive) and is put to bss only by linker
>> >> when final executable is created. To turn this feature off, use
>> >> '-fno-common' flag when compiling your object file.
>>
>> WH> This works, however only if the variables are non-static. If a
>> WH> variable is static the .comm directive is still used.
>>
>> .lcomm, to be precise.
>>
>> That's easy to work around. Just add 'int dummy;' to your source
>> file compiled with gcc, and you have 4 bytes in bss section.
WH> But how does this help? The other static variables still use
WH> the .lcomm directive.
Ah, i was thinking the problem is that wlink refuses to link in
modules with empty .bss section.
The problem seems to be that you can't reference to static variable
from within the module.
You can add
#ifdef GCC
#define STATIC static __attribute__ ((section(".bss")))
#else
#define STATIC static
#endif
and then replace all 'static some_type some_var;' with
'STATIC some_type some_var;', although i don't know if such tricks are
guaranteed to work with all current and future versions of gcc.
Egor. mailto:deo AT logos-m DOT ru ICQ 5165414 FidoNet 2:5020/496.19
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -