Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Apr 2003 22:40:28 +0200
From:      Gianmarco Giovannelli <gmarco@scotty.masternet.it>
To:        John Polstra <jdp@polstra.com>
Cc:        hackers@freebsd.org
Subject:   Re: gcc iussue or ... ?
Message-ID:  <5.2.0.9.2.20030412223502.053e0488@194.184.65.7>
In-Reply-To: <200304121840.h3CIes21072549@strings.polstra.com>
References:  <5.2.0.9.2.20030412071716.0257aeb8@194.184.65.7> <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> <gmarco@scotty.masternet.it>

next in thread | previous in thread | raw e-mail | index | archive | help
At 12/04/2003, you wrote:
> > 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.

This exactly solve the problem :-)

The compilation is fine, the exe is now 2mb (like linux).

/source_of_lonejoy/src# ll -h lonewolf
-rwxr-xr-x  1 root  wheel       2M Apr 12 22:24 lonewolf

Using such lines in Makefile.unix:
CFLAGS  =       -pipe -funsigned-char -fconserve-space -O -DNO_DEBUG
CXXFLAGS=       -pipe -funsigned-char -fconserve-space -O -DNO_DEBUG

did the job.
Now we have to understand why the Linux version of the same gcc doesn't 
need this option to make the exe so small :-)

  Thanks very much.




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




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