Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Jan 2009 15:27:02 +0100
From:      =?ISO-8859-1?Q?Morgan_Wesstr=F6m?= <freebsd-questions@pp.dyndns.biz>
To:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: default CFLAGS
Message-ID:  <497B2536.7030907@pp.dyndns.biz>
In-Reply-To: <20090124131629.1f9fabe4@gumby.homeunix.com>
References:  <Pine.LNX.4.64.0901241734020.6296@localhost>	<20090124124535.3006687c@gumby.homeunix.com>	<9a52b1190901240451i14dc544fm1c241d6f43fa897b@mail.gmail.com> <20090124131629.1f9fabe4@gumby.homeunix.com>

next in thread | previous in thread | raw e-mail | index | archive | help
RW wrote:
> On Sat, 24 Jan 2009 12:51:32 +0000
> Saifi Khan <saifikhan@gmail.com> wrote:
> 
> 
>> on running the command 'make -V CFLAGS', the output is
>>
>> -O2 -fno-strict-aliasing -pipe
>>
>> i haven't setup the CPUTYPE anywhere (not as an env variable nor in
>> /etc/make.conf)
>> So are these default settings for a generc x86 based system ?
> 
> Yes, if you are using i386. 
> 
> Most CPUs have the same default CFLAGS, it's the value of CPUTYPE
> that's passed to the compiler that determines processor optimizations.

If you want to know what gcc processor optimizations will be enabled you
can do this:

Create hello.c:

#include <stdio.h>
main()
{
	printf("hello, world\n");
}

Then compile it with -Q -v in addition to the default CFLAGS:

gcc -O2 -fno-strict-aliasing -pipe -Q -v -o hello hello.c

The section "options enabled" will list them all. I usually only add
"-march=native" to my CFLAGS to enable a few more CPU specific
optimizations.

/Morgan



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