Subject: Re: Bug: BSS segment in COFF files
From: egor duda <[email-masked]>
To: Wolfgang Hesseler <[email-masked]>
Cc: [email-masked]
Date: Fri, 12 Jul 2002 18:50:19 +0400

Hi!

Friday, 12 July, 2002 Wolfgang Hesseler [email-masked] wrote:

>> $ 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

WH> Right. But the whole Cygwin wouldn't work if its programs wouldn't recognize
WH> its own object code properly. My problem is that Cygwin produces
WH> some non-standard COFF object files. I will do some experiments with
WH> objcopy and see if that helps to solve the problem.

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.

$ cat x.mk
project : f:\test\x.exe .SYMBOLIC

!include f:\test\x.mk1
$ cat x.mk1
f:\test\test.obj : f:\test\test.c .AUTODEPEND
 @f:
 cd f:\test
 *wcc386 test.c -i=e:\w32app\prog\watc10\h;e:\w32app\prog\watc10\h\nt -w4 -e&
25 -zq -otexan -d2 -mf -5r -bt=nt

f:\test\x.exe : f:\test\test.obj f:\test\x.o .AUTODEPEND
 @f:
 cd f:\test
 @%write x.lk1 NAME x
 @%append x.lk1 FIL test.obj
 @%append x.lk1 FIL x.o
 @%append x.lk1 
 *wlink SYS nt op m d all op st=8192 op maxe=25 op q op symf @x.lk1

$ wmake -f x.mk
Watcom Make Version 11.0
Copyright by Sybase, Inc., and its subsidiaries, 1988, 1997.
All rights reserved.  Watcom is a trademark of Sybase, Inc.
        cd f:\test
        wcc386 test.c -i=e:\w32app\prog\watc10\h;e:\w32app\prog\watc10\h\nt -w4
-e25 -zq -otexan -d2 -mf -5r -bt=nt
test.c(5): Warning! W107: Missing return value for function 'main'
test.c(5): Warning! W301: No prototype found for 'printf'
        cd f:\test
        wlink SYS nt op m d all op st=8192 op maxe=25 op q op symf @x.lk1
$ ./x.exe
1

Egor.            mailto:[email-masked] 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/