Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Apr 2003 11:40:54 -0700 (PDT)
From:      John Polstra <jdp@polstra.com>
To:        hackers@freebsd.org
Subject:   Re: gcc iussue or ... ?
Message-ID:  <200304121840.h3CIes21072549@strings.polstra.com>
In-Reply-To: <5.2.0.9.2.20030412071716.0257aeb8@194.184.65.7>
References:  <3E972F3E.8E86140E@mindspring.com> <5.2.0.9.2.20030411221904.011c5ec8@194.184.65.4> <3E972F3E.8E86140E@mindspring.com> <5.2.0.9.2.20030412071716.0257aeb8@194.184.65.7>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <5.2.0.9.2.20030412071716.0257aeb8@194.184.65.7>,
Gianmarco Giovannelli  <gmarco@scotty.masternet.it> wrote:
> 
> 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 ?

Maybe Linux is using the "-fconserve-space" g++ option.  From the
info pages:

`-fconserve-space'
     Put uninitialized or runtime-initialized global variables into the
     common segment, as C does.  This saves space in the executable at
     the cost of not diagnosing duplicate definitions.  If you compile
     with this flag and your program mysteriously crashes after
     `main()' has completed, you may have an object that is being
     destroyed twice because two definitions were merged.

     This option is no longer useful on most targets, now that support
     has been added for putting variables into BSS without making them
     common.

That last paragraph suggests that maybe FreeBSD's compiler is
configured slightly wrong, such that it does not do what the
paragraph says.  In any case, try adding this option to your
compiles on FreeBSD and see if it helps.

John
-- 
  John Polstra
  John D. Polstra & Co., Inc.                        Seattle, Washington USA
  "Disappointment is a good sign of basic intelligence."  -- Chögyam Trungpa



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304121840.h3CIes21072549>