Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
|
2002-07-27 22:04:05 +00:00
|
|
|
# Set default CPU compile flags and baseline CPUTYPE for each arch. The
|
|
|
|
# compile flags must support the minimum CPU type for each architecture but
|
|
|
|
# may tune support for more advanced processors.
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
|
2002-08-02 18:04:22 +00:00
|
|
|
.if !defined(CPUTYPE) || empty(CPUTYPE)
|
2004-01-30 19:51:26 +00:00
|
|
|
_CPUCFLAGS =
|
2004-10-17 05:08:29 +00:00
|
|
|
. if ${MACHINE_ARCH} == "i386"
|
2003-04-11 21:28:17 +00:00
|
|
|
MACHINE_CPU = i486
|
2004-03-05 15:59:33 +00:00
|
|
|
. elif ${MACHINE_ARCH} == "amd64"
|
2003-05-20 01:46:16 +00:00
|
|
|
MACHINE_CPU = amd64 sse2 sse
|
2002-07-27 22:15:42 +00:00
|
|
|
. elif ${MACHINE_ARCH} == "ia64"
|
2002-09-18 20:44:46 +00:00
|
|
|
MACHINE_CPU = itanium
|
2002-07-27 22:15:42 +00:00
|
|
|
. elif ${MACHINE_ARCH} == "sparc64"
|
2004-05-14 13:34:15 +00:00
|
|
|
. elif ${MACHINE_ARCH} == "arm"
|
|
|
|
MACHINE_CPU = arm
|
2002-07-27 22:15:42 +00:00
|
|
|
. endif
|
2002-07-27 22:04:05 +00:00
|
|
|
.else
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
|
|
|
|
# Handle aliases (not documented in make.conf to avoid user confusion
|
|
|
|
# between e.g. i586 and pentium)
|
|
|
|
|
2002-07-27 22:15:42 +00:00
|
|
|
. if ${MACHINE_ARCH} == "i386"
|
2007-01-17 14:49:13 +00:00
|
|
|
. if ${CPUTYPE} == "nocona"
|
|
|
|
CPUTYPE = prescott
|
|
|
|
. elif ${CPUTYPE} == "core" || ${CPUTYPE} == "core2"
|
|
|
|
CPUTYPE = prescott
|
2004-10-17 05:19:45 +00:00
|
|
|
. elif ${CPUTYPE} == "p4"
|
2004-10-17 05:08:29 +00:00
|
|
|
CPUTYPE = pentium4
|
|
|
|
. elif ${CPUTYPE} == "p4m"
|
|
|
|
CPUTYPE = pentium4m
|
|
|
|
. elif ${CPUTYPE} == "p3"
|
|
|
|
CPUTYPE = pentium3
|
|
|
|
. elif ${CPUTYPE} == "p3m"
|
|
|
|
CPUTYPE = pentium3m
|
|
|
|
. elif ${CPUTYPE} == "p-m"
|
|
|
|
CPUTYPE = pentium-m
|
|
|
|
. elif ${CPUTYPE} == "p2"
|
|
|
|
CPUTYPE = pentium2
|
|
|
|
. elif ${CPUTYPE} == "i686"
|
|
|
|
CPUTYPE = pentiumpro
|
|
|
|
. elif ${CPUTYPE} == "i586/mmx"
|
|
|
|
CPUTYPE = pentium-mmx
|
|
|
|
. elif ${CPUTYPE} == "i586"
|
|
|
|
CPUTYPE = pentium
|
2004-10-17 05:19:45 +00:00
|
|
|
. elif ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || \
|
|
|
|
${CPUTYPE} == "k8"
|
2004-08-11 21:51:27 +00:00
|
|
|
CPUTYPE = athlon-mp
|
2002-09-07 01:15:29 +00:00
|
|
|
. elif ${CPUTYPE} == "k7"
|
|
|
|
CPUTYPE = athlon
|
2002-07-27 22:15:42 +00:00
|
|
|
. endif
|
2004-10-17 05:19:45 +00:00
|
|
|
. elif ${MACHINE_ARCH} == "amd64"
|
2007-01-17 14:54:53 +00:00
|
|
|
. if ${CPUTYPE} == "prescott" || ${CPUTYPE} == "core2"
|
2004-10-17 05:19:45 +00:00
|
|
|
CPUTYPE = nocona
|
|
|
|
. endif
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
. endif
|
|
|
|
|
2004-10-17 05:08:29 +00:00
|
|
|
###############################################################################
|
2002-05-11 20:18:54 +00:00
|
|
|
# Logic to set up correct gcc optimization flag. This must be included
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
# after /etc/make.conf so it can react to the local value of CPUTYPE
|
2002-05-11 20:18:54 +00:00
|
|
|
# defined therein. Consult:
|
2006-07-20 22:42:48 +00:00
|
|
|
# http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html
|
2004-03-21 04:57:24 +00:00
|
|
|
# http://gcc.gnu.org/onlinedocs/gcc/IA-64-Options.html
|
2002-05-11 20:18:54 +00:00
|
|
|
# http://gcc.gnu.org/onlinedocs/gcc/RS-6000-and-PowerPC-Options.html
|
2004-03-21 04:57:24 +00:00
|
|
|
# http://gcc.gnu.org/onlinedocs/gcc/SPARC-Options.html
|
|
|
|
# http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86-64-Options.html
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
|
|
|
|
. if ${MACHINE_ARCH} == "i386"
|
2004-04-05 09:55:50 +00:00
|
|
|
. if ${CPUTYPE} == "crusoe"
|
|
|
|
_CPUCFLAGS = -march=i686 -falign-functions=0 -falign-jumps=0 -falign-loops=0
|
2004-10-17 05:08:29 +00:00
|
|
|
. elif ${CPUTYPE} == "k5"
|
|
|
|
_CPUCFLAGS = -march=pentium
|
|
|
|
. else
|
|
|
|
_CPUCFLAGS = -march=${CPUTYPE}
|
|
|
|
. endif # GCC on 'i386'
|
|
|
|
. if ${CPUTYPE} == "crusoe"
|
2004-08-02 04:19:22 +00:00
|
|
|
_ICC_CPUCFLAGS = -tpp6 -xiM
|
2004-04-05 09:55:50 +00:00
|
|
|
. elif ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || \
|
2004-03-14 01:29:05 +00:00
|
|
|
${CPUTYPE} == "athlon-4"
|
2004-08-02 04:19:22 +00:00
|
|
|
_ICC_CPUCFLAGS = -tpp6 -xiMK
|
This are the build infrastructure changes to allow to use the
Intel C/C++ compiler (lang/icc) to build the kernel.
The icc CPUTYPE CFLAGS use icc v7 syntax, icc v8 moans about them, but
doesn't abort. They also produce CPU specific code (new instructions
of the CPU, not only CPU specific scheduling), so if you get coredumps
with signal 4 (SIGILL, illegal instruction) you've used the wrong
CPUTYPE.
Incarnations of this patch survive gcc compiles and my make universe.
I use it on my desktop.
To use it update share/mk, add
/usr/local/intel/compiler70/ia32/bin (icc v7, works)
or
/usr/local/intel_cc_80/bin (icc v8, doesn't work)
to your PATH, make sure you have a new kernel compile directory
(e.g. MYKERNEL_icc) and run
CFLAGS="-O2 -ip" CC=icc make depend
CFLAGS="-O2 -ip" CC=icc make
in it.
Don't compile with -ipo, the build infrastructure uses ld directly to
link the kernel and the modules, but -ipo needs the link step to be
performed with Intel's linker.
Problems with icc v8:
- panic: npx0 cannot be emulated on an SMP system
- UP: first start of /bin/sh results in a FP exception
Parts of this commit contains suggestions or submissions from
Marius Strobl <marius@alchemy.franken.de>.
Reviewed by: silence on -arch
Submitted by: netchild
2004-03-12 21:36:12 +00:00
|
|
|
. elif ${CPUTYPE} == "athlon-tbird" || ${CPUTYPE} == "athlon"
|
|
|
|
_ICC_CPUCFLAGS = -tpp6 -xiM
|
2003-03-29 03:13:19 +00:00
|
|
|
. elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2" || ${CPUTYPE} == "k6"
|
This are the build infrastructure changes to allow to use the
Intel C/C++ compiler (lang/icc) to build the kernel.
The icc CPUTYPE CFLAGS use icc v7 syntax, icc v8 moans about them, but
doesn't abort. They also produce CPU specific code (new instructions
of the CPU, not only CPU specific scheduling), so if you get coredumps
with signal 4 (SIGILL, illegal instruction) you've used the wrong
CPUTYPE.
Incarnations of this patch survive gcc compiles and my make universe.
I use it on my desktop.
To use it update share/mk, add
/usr/local/intel/compiler70/ia32/bin (icc v7, works)
or
/usr/local/intel_cc_80/bin (icc v8, doesn't work)
to your PATH, make sure you have a new kernel compile directory
(e.g. MYKERNEL_icc) and run
CFLAGS="-O2 -ip" CC=icc make depend
CFLAGS="-O2 -ip" CC=icc make
in it.
Don't compile with -ipo, the build infrastructure uses ld directly to
link the kernel and the modules, but -ipo needs the link step to be
performed with Intel's linker.
Problems with icc v8:
- panic: npx0 cannot be emulated on an SMP system
- UP: first start of /bin/sh results in a FP exception
Parts of this commit contains suggestions or submissions from
Marius Strobl <marius@alchemy.franken.de>.
Reviewed by: silence on -arch
Submitted by: netchild
2004-03-12 21:36:12 +00:00
|
|
|
_ICC_CPUCFLAGS = -tpp6 -xi
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
. elif ${CPUTYPE} == "k5"
|
2004-08-02 04:19:22 +00:00
|
|
|
_ICC_CPUCFLAGS = -tpp5
|
2004-10-17 05:08:29 +00:00
|
|
|
. elif ${CPUTYPE} == "pentium4" || ${CPUTYPE} == "pentium4m"
|
2004-08-02 04:19:22 +00:00
|
|
|
_ICC_CPUCFLAGS = -tpp7 -xiMKW
|
2004-10-17 05:08:29 +00:00
|
|
|
. elif ${CPUTYPE} == "pentium3" || ${CPUTYPE} == "pentium3m" || \
|
|
|
|
${CPUTYPE} == "pentium-m"
|
2004-08-02 04:19:22 +00:00
|
|
|
_ICC_CPUCFLAGS = -tpp6 -xiMK
|
2004-10-17 05:08:29 +00:00
|
|
|
. elif ${CPUTYPE} == "pentium2" || ${CPUTYPE} == "pentiumpro"
|
2004-08-02 04:19:22 +00:00
|
|
|
_ICC_CPUCFLAGS = -tpp6 -xiM
|
2004-10-17 05:08:29 +00:00
|
|
|
. elif ${CPUTYPE} == "pentium-mmx"
|
2004-08-02 04:19:22 +00:00
|
|
|
_ICC_CPUCFLAGS = -tpp5 -xM
|
2004-10-17 05:08:29 +00:00
|
|
|
. elif ${CPUTYPE} == "pentium"
|
2004-08-02 04:19:22 +00:00
|
|
|
_ICC_CPUCFLAGS = -tpp5
|
2004-10-17 05:08:29 +00:00
|
|
|
. else
|
2004-08-02 04:19:22 +00:00
|
|
|
_ICC_CPUCFLAGS =
|
2004-10-17 05:08:29 +00:00
|
|
|
. endif # ICC on 'i386'
|
2004-10-17 05:19:45 +00:00
|
|
|
. elif ${MACHINE_ARCH} == "amd64"
|
|
|
|
_CPUCFLAGS = -march=${CPUTYPE}
|
2004-09-23 22:59:31 +00:00
|
|
|
. elif ${MACHINE_ARCH} == "arm"
|
2004-10-17 05:08:29 +00:00
|
|
|
. if ${CPUTYPE} == "xscale"
|
2007-05-21 08:39:44 +00:00
|
|
|
_CPUCFLAGS = -mcpu=xscale
|
2004-10-17 05:08:29 +00:00
|
|
|
. else
|
|
|
|
_CPUCFLAGS = -mcpu=${CPUTYPE}
|
2004-09-23 22:59:31 +00:00
|
|
|
. endif
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
. endif
|
|
|
|
|
|
|
|
# Set up the list of CPU features based on the CPU type. This is an
|
|
|
|
# unordered list to make it easy for client makefiles to test for the
|
|
|
|
# presence of a CPU feature.
|
|
|
|
|
2004-03-05 15:59:33 +00:00
|
|
|
. if ${MACHINE_ARCH} == "i386"
|
2004-10-17 05:19:45 +00:00
|
|
|
. if ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64"
|
|
|
|
MACHINE_CPU = athlon-xp athlon k7 3dnow sse2 sse mmx k6 k5 i586 i486 i386
|
|
|
|
. elif ${CPUTYPE} == "athlon-mp" || ${CPUTYPE} == "athlon-xp" || \
|
2004-01-31 02:17:11 +00:00
|
|
|
${CPUTYPE} == "athlon-4"
|
2004-10-17 05:08:29 +00:00
|
|
|
MACHINE_CPU = athlon-xp athlon k7 3dnow sse mmx k6 k5 i586 i486 i386
|
2004-03-05 15:59:33 +00:00
|
|
|
. elif ${CPUTYPE} == "athlon" || ${CPUTYPE} == "athlon-tbird"
|
2003-03-29 03:13:19 +00:00
|
|
|
MACHINE_CPU = athlon k7 3dnow mmx k6 k5 i586 i486 i386
|
2004-03-05 15:59:33 +00:00
|
|
|
. elif ${CPUTYPE} == "k6-3" || ${CPUTYPE} == "k6-2"
|
2001-03-10 11:49:05 +00:00
|
|
|
MACHINE_CPU = 3dnow mmx k6 k5 i586 i486 i386
|
2002-09-18 20:51:25 +00:00
|
|
|
. elif ${CPUTYPE} == "k6"
|
2001-03-10 11:49:05 +00:00
|
|
|
MACHINE_CPU = mmx k6 k5 i586 i486 i386
|
2002-09-18 20:51:25 +00:00
|
|
|
. elif ${CPUTYPE} == "k5"
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
MACHINE_CPU = k5 i586 i486 i386
|
2006-07-19 11:27:19 +00:00
|
|
|
. elif ${CPUTYPE} == "c3"
|
2006-08-13 08:47:41 +00:00
|
|
|
MACHINE_CPU = 3dnow mmx i586 i486 i386
|
2006-07-19 11:27:19 +00:00
|
|
|
. elif ${CPUTYPE} == "c3-2"
|
|
|
|
MACHINE_CPU = sse mmx i586 i486 i386
|
2007-01-17 14:49:13 +00:00
|
|
|
. elif ${CPUTYPE} == "prescott"
|
2007-01-17 12:43:06 +00:00
|
|
|
MACHINE_CPU = sse3 sse2 sse i686 mmx i586 i486 i386
|
2004-10-17 05:19:45 +00:00
|
|
|
. elif ${CPUTYPE} == "pentium4" || ${CPUTYPE} == "pentium4m" || ${CPUTYPE} == "pentium-m"
|
2002-09-07 01:15:29 +00:00
|
|
|
MACHINE_CPU = sse2 sse i686 mmx i586 i486 i386
|
2004-10-17 05:08:29 +00:00
|
|
|
. elif ${CPUTYPE} == "pentium3" || ${CPUTYPE} == "pentium3m"
|
2001-02-27 11:21:47 +00:00
|
|
|
MACHINE_CPU = sse i686 mmx i586 i486 i386
|
2004-10-17 05:08:29 +00:00
|
|
|
. elif ${CPUTYPE} == "pentium2"
|
2001-03-21 08:29:39 +00:00
|
|
|
MACHINE_CPU = i686 mmx i586 i486 i386
|
2004-10-17 05:08:29 +00:00
|
|
|
. elif ${CPUTYPE} == "pentiumpro"
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
MACHINE_CPU = i686 i586 i486 i386
|
2004-10-17 05:08:29 +00:00
|
|
|
. elif ${CPUTYPE} == "pentium-mmx"
|
2001-02-27 11:21:47 +00:00
|
|
|
MACHINE_CPU = mmx i586 i486 i386
|
2004-10-17 05:08:29 +00:00
|
|
|
. elif ${CPUTYPE} == "pentium"
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
MACHINE_CPU = i586 i486 i386
|
2002-09-18 20:51:25 +00:00
|
|
|
. elif ${CPUTYPE} == "i486"
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
MACHINE_CPU = i486 i386
|
2002-09-18 20:51:25 +00:00
|
|
|
. elif ${CPUTYPE} == "i386"
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
MACHINE_CPU = i386
|
2002-09-18 20:51:25 +00:00
|
|
|
. endif
|
2003-05-20 01:46:16 +00:00
|
|
|
. elif ${MACHINE_ARCH} == "amd64"
|
2004-10-17 05:19:45 +00:00
|
|
|
. if ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || ${CPUTYPE} == "k8"
|
2004-12-11 18:36:42 +00:00
|
|
|
MACHINE_CPU = k8 3dnow
|
2007-01-17 14:49:13 +00:00
|
|
|
. elif ${CPUTYPE} == "nocona"
|
2004-12-11 18:36:42 +00:00
|
|
|
MACHINE_CPU = sse3
|
2004-10-17 05:19:45 +00:00
|
|
|
. endif
|
2004-12-11 18:36:42 +00:00
|
|
|
MACHINE_CPU += amd64 sse2 sse mmx
|
2002-09-18 20:51:25 +00:00
|
|
|
. elif ${MACHINE_ARCH} == "ia64"
|
|
|
|
. if ${CPUTYPE} == "itanium"
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
MACHINE_CPU = itanium
|
2002-09-18 20:51:25 +00:00
|
|
|
. endif
|
Overhaul the MACHINE_CPU behaviour:
* Rip out MACHINE_CPU stuff from sys.mk and include a new <bsd.cpu.mk>
after we pull in /etc/make.conf. We need to do it afterwards so we can
react to the user setting of the:
* CPUTYPE variable, which contains the CPU type which the user wants to
optimize for. For example, if you want your binaries to only run on an
i686-class machine (or higher), set this to i686. If you want to support
running binaries on a variety of CPU generations, set this to the lowest
common denominator. Supported values are listed in make.conf.
* bsd.cpu.mk does the expansion of CPUTYPE into MACHINE_CPU using the
(hopefully) correct unordered list of CPU types which should be used on
that CPU. For example, an AMD k6 CPU wants any of the following:
k6 k5 i586 i486 i386
This is still an unordered list so the client makefile logic is simple -
client makefiles need to test for the various elements of the set in
decreasing order of priority using ${MACHINE_CPU:M<foo>}, as before.
The various MACHINE_CPU lists are believed to be correct, but should be
checked.
* If NO_CPU_CFLAGS is not defined, add relevant gcc compiler optimization
settings by default (e.g. -karch=k6 for CPUTYPE=k6, etc). Release
builders and developers of third-party software need to make sure not to
enable CPU-specific optimization when generating code intended to be
portable. We probably need to move to an /etc/world.conf to allow the
optimization stuff to be applied separately to world/kernel and external
compilations, but it's not any worse a problem than it was before.
* Add coverage for the ia64/itanium MACHINE_ARCH/CPUTYPE.
* Add CPUTYPE support for all of the CPU types supported by FreeBSD and gcc
(only i386, alpha and ia64 first, since those are the minimally-working
ports. Other architecture porters, please feel free to add the relevant
gunk for your platform).
Reviewed by: jhb, obrien
2001-02-22 11:14:25 +00:00
|
|
|
. endif
|
|
|
|
.endif
|
2002-09-18 20:48:54 +00:00
|
|
|
|
2006-10-19 22:51:26 +00:00
|
|
|
.if ${MACHINE_ARCH} == "arm" && defined(TARGET_BIG_ENDIAN)
|
2006-07-20 21:28:07 +00:00
|
|
|
CFLAGS += -mbig-endian
|
2006-07-21 14:07:48 +00:00
|
|
|
LDFLAGS += -mbig-endian
|
2006-07-20 22:13:59 +00:00
|
|
|
LD += -EB
|
2006-07-20 21:28:07 +00:00
|
|
|
.endif
|
|
|
|
|
2004-01-10 18:01:08 +00:00
|
|
|
# NB: COPTFLAGS is handled in /usr/src/sys/conf/kern.pre.mk
|
2002-09-18 20:48:54 +00:00
|
|
|
|
|
|
|
.if !defined(NO_CPU_CFLAGS)
|
This are the build infrastructure changes to allow to use the
Intel C/C++ compiler (lang/icc) to build the kernel.
The icc CPUTYPE CFLAGS use icc v7 syntax, icc v8 moans about them, but
doesn't abort. They also produce CPU specific code (new instructions
of the CPU, not only CPU specific scheduling), so if you get coredumps
with signal 4 (SIGILL, illegal instruction) you've used the wrong
CPUTYPE.
Incarnations of this patch survive gcc compiles and my make universe.
I use it on my desktop.
To use it update share/mk, add
/usr/local/intel/compiler70/ia32/bin (icc v7, works)
or
/usr/local/intel_cc_80/bin (icc v8, doesn't work)
to your PATH, make sure you have a new kernel compile directory
(e.g. MYKERNEL_icc) and run
CFLAGS="-O2 -ip" CC=icc make depend
CFLAGS="-O2 -ip" CC=icc make
in it.
Don't compile with -ipo, the build infrastructure uses ld directly to
link the kernel and the modules, but -ipo needs the link step to be
performed with Intel's linker.
Problems with icc v8:
- panic: npx0 cannot be emulated on an SMP system
- UP: first start of /bin/sh results in a FP exception
Parts of this commit contains suggestions or submissions from
Marius Strobl <marius@alchemy.franken.de>.
Reviewed by: silence on -arch
Submitted by: netchild
2004-03-12 21:36:12 +00:00
|
|
|
. if ${CC} == "icc"
|
|
|
|
CFLAGS += ${_ICC_CPUCFLAGS}
|
|
|
|
. else
|
2002-09-18 20:48:54 +00:00
|
|
|
CFLAGS += ${_CPUCFLAGS}
|
This are the build infrastructure changes to allow to use the
Intel C/C++ compiler (lang/icc) to build the kernel.
The icc CPUTYPE CFLAGS use icc v7 syntax, icc v8 moans about them, but
doesn't abort. They also produce CPU specific code (new instructions
of the CPU, not only CPU specific scheduling), so if you get coredumps
with signal 4 (SIGILL, illegal instruction) you've used the wrong
CPUTYPE.
Incarnations of this patch survive gcc compiles and my make universe.
I use it on my desktop.
To use it update share/mk, add
/usr/local/intel/compiler70/ia32/bin (icc v7, works)
or
/usr/local/intel_cc_80/bin (icc v8, doesn't work)
to your PATH, make sure you have a new kernel compile directory
(e.g. MYKERNEL_icc) and run
CFLAGS="-O2 -ip" CC=icc make depend
CFLAGS="-O2 -ip" CC=icc make
in it.
Don't compile with -ipo, the build infrastructure uses ld directly to
link the kernel and the modules, but -ipo needs the link step to be
performed with Intel's linker.
Problems with icc v8:
- panic: npx0 cannot be emulated on an SMP system
- UP: first start of /bin/sh results in a FP exception
Parts of this commit contains suggestions or submissions from
Marius Strobl <marius@alchemy.franken.de>.
Reviewed by: silence on -arch
Submitted by: netchild
2004-03-12 21:36:12 +00:00
|
|
|
. endif
|
2002-09-18 20:48:54 +00:00
|
|
|
.endif
|