Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Date: Fri, 12 Jul 2002 18:11:08 +0400
From: egor duda <deo@logos-m.ru>
Reply-To: egor duda <cygwin@cygwin.com>
Organization: deo
X-Priority: 3 (Normal)
Message-ID: <17484095953.20020712181108@logos-m.ru>
To: Wolfgang Hesseler <qv@multimediaware.com>
CC: cygwin@cygwin.com
Subject: Re: Bug: BSS segment in COFF files
In-Reply-To: <3D2EE0C2.78D6@multimediaware.com>
References: <3D2EA2E2.2881@multimediaware.com>
 <8772121004.20020712145134@logos-m.ru> <3D2EBFC2.6973@multimediaware.com>
 <9975891676.20020712155424@logos-m.ru> <3D2EC616.19DA@multimediaware.com>
 <9382195250.20020712173928@logos-m.ru> <3D2EE0C2.78D6@multimediaware.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi!

Friday, 12 July, 2002 Wolfgang Hesseler qv@multimediaware.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> I just noticed that this doesn't help at all. When analyzing the 
WH> object file with IDA you'll see that the BSS section has length 0.
WH> Thus, when you link several object files together, all variables
WH> are at the same memory position. I think it's a problem with the
WH> Assembler that doesn't generate valid COFF files. BTW, when 
WH> compiling the same program under Linux the BSS section is not 0. So,
WH> it seems that the problem is Cygwin (COFF) specific.

WH> So far, the only way to reserve memory for a variable is to make
WH> it 0-initialized.

Huh?

$ cat x.c
int a;
static int b[10000];
$ gcc -fno-common -save-temps -c x.c
$ cat x.s
        .file   "x.i"
.globl _a
        .bss
        .align 4
_a:
        .space 4
.lcomm _b,40000
$ objdump --section-headers x.o
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000000  00000000  00000000  00000000  2**2
                  ALLOC, LOAD, CODE
  1 .data         00000000  00000000  00000000  00000000  2**2
                  ALLOC, LOAD, DATA
  2 .bss          00009c48  00000000  00000000  00000000  2**2
                  ALLOC

Egor.            mailto:deo@logos-m.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/

