From owner-freebsd-hackers@FreeBSD.ORG Sat Apr 12 11:41:20 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 49C8737B401 for ; Sat, 12 Apr 2003 11:41:20 -0700 (PDT) Received: from wall.polstra.com (wall-gw.polstra.com [206.213.73.130]) by mx1.FreeBSD.org (Postfix) with ESMTP id 13CBB43F93 for ; Sat, 12 Apr 2003 11:41:19 -0700 (PDT) (envelope-from jdp@polstra.com) Received: from strings.polstra.com (strings.polstra.com [206.213.73.20]) by wall.polstra.com (8.12.3p2/8.12.3) with ESMTP id h3CIf9dt002783 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Sat, 12 Apr 2003 11:41:09 -0700 (PDT) (envelope-from jdp@strings.polstra.com) Received: (from jdp@localhost) by strings.polstra.com (8.12.6/8.12.6/Submit) id h3CIes21072549; Sat, 12 Apr 2003 11:40:54 -0700 (PDT) (envelope-from jdp) Date: Sat, 12 Apr 2003 11:40:54 -0700 (PDT) Message-Id: <200304121840.h3CIes21072549@strings.polstra.com> To: hackers@freebsd.org From: John Polstra 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> Organization: Polstra & Co., Seattle, WA Subject: Re: gcc iussue or ... ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Apr 2003 18:41:20 -0000 In article <5.2.0.9.2.20030412071716.0257aeb8@194.184.65.7>, Gianmarco Giovannelli 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