develooper Front page | perl.perl5.porters | Postings from February 2003

Re: -Os for Darwin why?

Thread Previous | Thread Next
February 18, 2003 11:37
Re: -Os for Darwin why?
Message ID:
On Tue, Feb 18, 2003 at 07:41:03PM +0100, Kay Roepke wrote:
> On Tuesday, February 18, 2003, at 05:08  PM, Wilfredo Sánchez wrote:
> >   Does the pre-6.x compiler support -Os?  My understanding was that 
> > it's a recent feature.
> It certainly does, since thats a gcc feature. Nonetheless it appears to 
> be suboptimal for the 2.95.x releases (at least on PPC I guess).
> As I mentioned earlier, the release notes for (Apple's) gcc 3.x mention 
> great improvements of -Os.

Ahh, I thought it was related to the gcc version.  If so, the hint should
be tied to the gcc version.  You can update gcc without updating the 
whole OS and you could conceivably even downgrade if gcc went through
one of its fits of instability again.

So if the logic is "we want -Os with 3.x and -O3 with anything else"
it should be something like the patch below (stealing liberally from

--- hints/	2003/02/18 19:28:05	1.1
+++ hints/	2003/02/18 19:36:45
@@ -58,11 +58,14 @@
 # pace with CPU speed over time (on any platform), this is probably a
 # reasonable assertion.
 if [ -z "${optimize}" ]; then
-  case "$osvers" in
-    [12345].*) optimize='-O3' ;;
-    *) optimize='-Os' ;;
+  case "`${cc:-gcc} -v 2>&1`" in
+    *"gcc version 3."*) optimize='-Os' ;;
+    *) optimize='-O3' ;;
+  optimize='-O3'
 # -pipe: makes compilation go faster.
 # -fno-common because common symbols are not allowed in MH_DYLIB

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About