Is it safe to use CPUTYPE?=native on 7.0 ?

Scot Hetzel swhetzel at gmail.com
Sun Dec 16 08:47:58 PST 2007


On 12/16/07, Pete French <petefrench at ticketswitch.com> wrote:
> fairly simple question really - on machines where I never use the compiled
> binaries anywhere else, is it O.K. to set the CPU type to 'native' in
> make.conf ? According to gcc this should detect the processor type and
> set the various flas as approrpiate, which is nice, as we have a mix of P3,
> P4 and AMD processors around the place, and having one make.conf which will
> do the right thing on all of them would be nice.
>
> I've been trying it out on a couple of machines, and it seems to work fine,
> but I have a feeling that various bits of the kerenel complie are
> sensetive to the cpu type, so am just asking to check if it's O.K.
>
While setting CPUTYPE=native in /etc/make.conf may work, it fails to
set MACHINE_CPU to the correct values for your processor type.

The problem is that bsd.cpu.mk doesn't know how to handle CPU type 'native'.

There is a simple fix for this problem by applying the attached patch
which uses:

gcc -v -x c -E -mtune=native /dev/null -o /dev/null 2>&1 | grep mtune
| sed -e 's/.*mtune=//'

to reset CPUTYPE to the processor type of your system when CPUTYPE=native.

Scot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bsd.cpu.mk.patch
Type: text/x-diff
Size: 696 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20071216/0857d544/bsd.cpu.mk.bin


More information about the freebsd-stable mailing list