Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-pair-Authenticated: 217.86.221.242 Message-ID: <3D2F0198.6DCB@multimediaware.com> Date: Fri, 12 Jul 2002 18:19:37 +0200 From: Wolfgang Hesseler MIME-Version: 1.0 To: egor duda Subject: Re: Bug: BSS segment in COFF files References: <3D2EA2E2 DOT 2881 AT multimediaware DOT com> <8772121004 DOT 20020712145134 AT logos-m DOT ru> <3D2EBFC2 DOT 6973 AT multimediaware DOT com> <9975891676 DOT 20020712155424 AT logos-m DOT ru> <3D2EC616 DOT 19DA AT multimediaware DOT com> <9382195250 DOT 20020712173928 AT logos-m DOT ru> <3D2EE0C2 DOT 78D6 AT multimediaware DOT com> <17484095953 DOT 20020712181108 AT logos-m DOT ru> <3D2EE7DB DOT 471B AT multimediaware DOT com> <18286446082 DOT 20020712185019 AT logos-m DOT ru> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit > I suppose it's too early to call it non-standard without strong > evidence. For now, you have found that it's somehow incompatible with > ida and/or watcom linker, though i did test linking x.o with > watcom-compiled test.obj using wlink and everything worked fine. The solution is to use non-static variables only. The Watcom linker will then link properly. I still think the file is non standard though. Here is an example that shows the problem: file a.c: (compile with gcc) static int a; void function1_(void) { a=123; } file b.c: (compile with gcc) static int b; int function2_(void) { return b;} file test.c: (compile with Watcom) #include extern void _function1(void); extern int _function2(void); void main(void) { _function1(); printf("%d\n",_function2()); } It will print 123 even if b was never given a value. This is because a and b are linked to the same memory position. If the variables a and b are public you will get the expected 0. BTW, don't use -fno-common. If you do it, even non-static variables are linked at the same memory position. -- 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/