gcc iussue or ... ?

Gianmarco Giovannelli gmarco at scotty.masternet.it
Fri Apr 11 22:42:12 PDT 2003


At 11/04/2003, you wrote:
>In a message written on Fri, Apr 11, 2003 at 02:10:22PM -0700, Terry 
>Lambert wrote:
> > Someone has already pointed out that one of the .o files is, in
> > fact, handling uninitialized data differently on FreeBSD and Linux,
> > so this is the source of your problem.  I thought it was the lowest
> > priority possibility, but I guess I was wrong.
>
>As the one who pointed it out, I'll remind you there are still two
>possibilities.
>
>1) The programmer is using a system constant (eg, FILENAME_MAX from
>    stdio.h) to size some data structure, and the size of that constant
>    is wildly different on FreeBSD than Linux.


It could be, but I think it is less probable than your second point...


>2) The FreeBSD version is storing the (presumably zero filled) data
>    in the executable rather than allowing them to be initialized in
>    zero filled pages (.data vrs .bss, I believe).
>
>In my first post you'll notice there are, humm, 4 or 5 symbols that
>make up all the space (2M and several 5M, I believe).  I wasn't
>going to study the code for them enough to see if they rely on
>system constants are or declared global.  The author should look at
>those 4-5 symbols very closely and see about runtime allocation,
>or if they depend on system constants.

I think all the problem is this and it is located in globals.o which is 
about 17M.

source_of_lonejoy/src> ll globals.o
-rw-r--r--  1 root  wheel  17270956 Apr 11 17:57 globals.o
or
source_of_lonejoy/src> ll -h globals.o
-rw-r--r--  1 root  wheel       16M Apr 11 17:57 globals.o

In FreeBSD 4.8, gcc version 2.95.4 20020320 [FreeBSD] :
nm -r --size-sort globals.o

01061860 D wp_version
01061800 D w_anim
01061788 D cwrap
01061720 D PacketSender
002190a0 D PacketFetcher
002180a0 D buffer
00111020 D region
000138a0 D location
00009b80 D spawnsp
00009b80 D ownsp
00009b80 D itemsp
00009b80 D glowsp
00009b80 D cspawnsp
00009b80 D cownsp
00009b80 D contsp
00009b80 D charsp
00008520 D menupriv_
00006114 T strlwr
00006114 t gcc2_compiled.
[...]

In linux Debian 3.0, gcc 2.95.4 20011002 (Debian prerelease)
nm -r --size-sort globals.o

0105c520 B wp_version
0105c4f0 B clConsole
0105c4c0 B w_anim
0105c4a0 B iwrap
0105c468 B cmultisp
0105c420 B PacketSender
002190a0 B PacketFetcher
002180a0 B buffer
00111020 B region
000138a0 B location
00009b80 B spawnsp
00009b80 B ownsp
00009b80 B itemsp
00009b80 B glowsp
00009b80 B cspawnsp
00009b80 B cownsp
00009b80 B contsp
00009b80 B charsp
00008520 B menupriv_

So the point is why Linux/mingw have a lot of things in bss while 4.8 (with 
the same gcc of linux debian 3.0 and 5.0 with the same gcc 3.2.1 of mingw) 
put them in Data ?

Other thing: If you look the code (globals.cpp, the src is here: 
http://games.gimbo.org/uo/files/bin/lonewolf/cvs_src.tgz ) there is nothing 
that can let me to imagine such big size of datas.

Thanks for your reply.






Best Regards,
Gianmarco Giovannelli ,  "Unix expert since yesterday"
http://www.gufi.org/~gmarco




More information about the freebsd-hackers mailing list