1999-08-28 00:22:10 +00:00
|
|
|
# $FreeBSD$
|
1996-10-08 22:10:49 +00:00
|
|
|
|
|
|
|
#
|
2011-05-24 09:01:56 +00:00
|
|
|
# Warning flags for compiling the kernel and components of the kernel:
|
1996-10-08 22:10:49 +00:00
|
|
|
#
|
2001-09-10 06:23:33 +00:00
|
|
|
CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
|
2018-05-04 19:31:28 +00:00
|
|
|
-Wmissing-prototypes -Wpointer-arith -Wcast-qual \
|
2013-05-20 19:41:34 +00:00
|
|
|
-Wundef -Wno-pointer-sign ${FORMAT_EXTENSIONS} \
|
2011-12-23 13:50:33 +00:00
|
|
|
-Wmissing-include-dirs -fdiagnostics-show-option \
|
2015-01-03 16:48:08 +00:00
|
|
|
-Wno-unknown-pragmas \
|
2011-12-23 13:50:33 +00:00
|
|
|
${CWARNEXTRA}
|
1999-01-29 10:57:18 +00:00
|
|
|
#
|
|
|
|
# The following flags are next up for working on:
|
2011-05-02 10:35:27 +00:00
|
|
|
# -Wextra
|
1999-01-27 22:53:58 +00:00
|
|
|
|
2011-12-21 15:59:18 +00:00
|
|
|
# Disable a few warnings for clang, since there are several places in the
|
|
|
|
# kernel where fixing them is more trouble than it is worth, or where there is
|
|
|
|
# a false positive.
|
2012-09-13 16:00:46 +00:00
|
|
|
.if ${COMPILER_TYPE} == "clang"
|
2016-09-04 17:55:22 +00:00
|
|
|
NO_WCONSTANT_CONVERSION= -Wno-error-constant-conversion
|
2018-05-19 00:04:01 +00:00
|
|
|
NO_WSHIFT_COUNT_NEGATIVE= -Wno-shift-count-negative
|
|
|
|
NO_WSHIFT_COUNT_OVERFLOW= -Wno-shift-count-overflow
|
|
|
|
NO_WSELF_ASSIGN= -Wno-self-assign
|
2016-09-04 17:55:22 +00:00
|
|
|
NO_WUNNEEDED_INTERNAL_DECL= -Wno-error-unneeded-internal-declaration
|
2012-08-20 18:33:03 +00:00
|
|
|
NO_WSOMETIMES_UNINITIALIZED= -Wno-error-sometimes-uninitialized
|
2016-09-04 17:55:22 +00:00
|
|
|
NO_WCAST_QUAL= -Wno-error-cast-qual
|
2018-05-19 00:04:01 +00:00
|
|
|
NO_WTAUTOLOGICAL_POINTER_COMPARE= -Wno-tautological-pointer-compare
|
2011-12-23 00:23:37 +00:00
|
|
|
# Several other warnings which might be useful in some cases, but not severe
|
|
|
|
# enough to error out the whole kernel build. Display them anyway, so there is
|
|
|
|
# some incentive to fix them eventually.
|
2011-12-24 18:57:42 +00:00
|
|
|
CWARNEXTRA?= -Wno-error-tautological-compare -Wno-error-empty-body \
|
2015-01-01 08:18:08 +00:00
|
|
|
-Wno-error-parentheses-equality -Wno-error-unused-function \
|
2015-01-10 23:43:37 +00:00
|
|
|
-Wno-error-pointer-sign
|
2015-08-17 21:07:21 +00:00
|
|
|
.if ${COMPILER_VERSION} >= 30700
|
|
|
|
CWARNEXTRA+= -Wno-error-shift-negative-value
|
|
|
|
.endif
|
2017-01-08 18:14:28 +00:00
|
|
|
.if ${COMPILER_VERSION} >= 40000
|
2018-05-19 00:04:01 +00:00
|
|
|
CWARNEXTRA+= -Wno-address-of-packed-member
|
2017-01-08 18:14:28 +00:00
|
|
|
.endif
|
2015-01-05 12:28:22 +00:00
|
|
|
|
|
|
|
CLANG_NO_IAS= -no-integrated-as
|
|
|
|
.if ${COMPILER_VERSION} < 30500
|
|
|
|
# XXX: clang < 3.5 integrated-as doesn't grok .codeNN directives
|
|
|
|
CLANG_NO_IAS34= -no-integrated-as
|
|
|
|
.endif
|
2013-05-15 13:04:10 +00:00
|
|
|
.endif
|
|
|
|
|
2015-01-04 20:08:24 +00:00
|
|
|
.if ${COMPILER_TYPE} == "gcc"
|
2016-03-13 19:17:48 +00:00
|
|
|
.if ${COMPILER_VERSION} >= 40800
|
2014-10-09 16:39:10 +00:00
|
|
|
# Catch-all for all the things that are in our tree, but for which we're
|
2016-03-13 19:17:48 +00:00
|
|
|
# not yet ready for this compiler.
|
2018-05-19 04:46:34 +00:00
|
|
|
NO_WUNUSED_BUT_SET_VARIABLE = -Wno-unused-but-set-variable
|
2016-07-28 13:15:23 +00:00
|
|
|
CWARNEXTRA?= -Wno-error=address \
|
|
|
|
-Wno-error=aggressive-loop-optimizations \
|
|
|
|
-Wno-error=array-bounds \
|
|
|
|
-Wno-error=attributes \
|
|
|
|
-Wno-error=cast-qual \
|
|
|
|
-Wno-error=enum-compare \
|
|
|
|
-Wno-error=inline \
|
|
|
|
-Wno-error=maybe-uninitialized \
|
|
|
|
-Wno-error=overflow \
|
|
|
|
-Wno-error=sequence-point \
|
|
|
|
-Wno-error=unused-but-set-variable
|
2016-07-22 16:15:35 +00:00
|
|
|
.if ${COMPILER_VERSION} >= 60100
|
2016-07-28 13:15:23 +00:00
|
|
|
CWARNEXTRA+= -Wno-error=misleading-indentation \
|
|
|
|
-Wno-error=nonnull-compare \
|
|
|
|
-Wno-error=shift-overflow \
|
|
|
|
-Wno-error=tautological-compare
|
2016-07-22 16:15:35 +00:00
|
|
|
.endif
|
2018-06-04 16:20:22 +00:00
|
|
|
.if ${COMPILER_VERSION} >= 70200
|
|
|
|
CWARNEXTRA+= -Wno-error=memset-elt-size
|
|
|
|
.endif
|
2018-05-04 18:25:07 +00:00
|
|
|
.if ${COMPILER_VERSION} >= 80000
|
|
|
|
CWARNEXTRA+= -Wno-error=packed-not-aligned
|
|
|
|
.endif
|
2015-01-04 20:08:24 +00:00
|
|
|
.else
|
|
|
|
# For gcc 4.2, eliminate the too-often-wrong warnings about uninitialized vars.
|
|
|
|
CWARNEXTRA?= -Wno-uninitialized
|
2018-03-12 05:41:27 +00:00
|
|
|
# GCC 4.2 doesn't have -Wno-error=cast-qual, so just disable the warning for
|
|
|
|
# the few files that are already known to generate cast-qual warnings.
|
|
|
|
NO_WCAST_QUAL= -Wno-cast-qual
|
2015-01-04 20:08:24 +00:00
|
|
|
.endif
|
2014-08-14 16:01:46 +00:00
|
|
|
.endif
|
|
|
|
|
2013-05-15 13:04:10 +00:00
|
|
|
# External compilers may not support our format extensions. Allow them
|
|
|
|
# to be disabled. WARNING: format checking is disabled in this case.
|
|
|
|
.if ${MK_FORMAT_EXTENSIONS} == "no"
|
2014-08-14 16:01:33 +00:00
|
|
|
FORMAT_EXTENSIONS= -Wno-format
|
2015-01-28 18:36:33 +00:00
|
|
|
.elif ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30600
|
|
|
|
FORMAT_EXTENSIONS= -D__printf__=__freebsd_kprintf__
|
2016-07-08 16:29:45 +00:00
|
|
|
.else
|
2013-05-20 19:41:34 +00:00
|
|
|
FORMAT_EXTENSIONS= -fformat-extensions
|
2011-12-21 15:59:18 +00:00
|
|
|
.endif
|
|
|
|
|
1999-11-17 07:30:35 +00:00
|
|
|
#
|
2011-05-02 10:35:27 +00:00
|
|
|
# On i386, do not align the stack to 16-byte boundaries. Otherwise GCC 2.95
|
|
|
|
# and above adds code to the entry and exit point of every function to align the
|
1999-11-17 07:30:35 +00:00
|
|
|
# stack to 16-byte boundaries -- thus wasting approximately 12 bytes of stack
|
2011-05-02 10:35:27 +00:00
|
|
|
# per function call. While the 16-byte alignment may benefit micro benchmarks,
|
2000-04-24 08:50:15 +00:00
|
|
|
# it is probably an overall loss as it makes the code bigger (less efficient
|
1999-11-17 07:30:35 +00:00
|
|
|
# use of code cache tag lines) and uses more stack (less efficient use of data
|
2011-05-02 10:35:27 +00:00
|
|
|
# cache tag lines). Explicitly prohibit the use of FPU, SSE and other SIMD
|
2005-03-31 22:53:58 +00:00
|
|
|
# operations inside the kernel itself. These operations are exclusively
|
|
|
|
# reserved for user applications.
|
1999-11-17 07:30:35 +00:00
|
|
|
#
|
2011-05-14 11:26:00 +00:00
|
|
|
# gcc:
|
|
|
|
# Setting -mno-mmx implies -mno-3dnow
|
|
|
|
# Setting -mno-sse implies -mno-sse2, -mno-sse3 and -mno-ssse3
|
|
|
|
#
|
|
|
|
# clang:
|
2012-03-13 19:18:34 +00:00
|
|
|
# Setting -mno-mmx implies -mno-3dnow and -mno-3dnowa
|
|
|
|
# Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42
|
2011-05-14 11:26:00 +00:00
|
|
|
#
|
2011-04-19 18:09:21 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "i386"
|
2014-05-10 16:38:09 +00:00
|
|
|
CFLAGS.gcc+= -mno-align-long-strings -mpreferred-stack-boundary=2
|
|
|
|
CFLAGS.clang+= -mno-aes -mno-avx
|
2012-03-13 19:18:34 +00:00
|
|
|
CFLAGS+= -mno-mmx -mno-sse -msoft-float
|
2004-03-03 09:35:06 +00:00
|
|
|
INLINE_LIMIT?= 8000
|
1999-11-17 07:30:35 +00:00
|
|
|
.endif
|
|
|
|
|
2010-09-13 07:27:03 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "arm"
|
2004-05-14 13:35:46 +00:00
|
|
|
INLINE_LIMIT?= 8000
|
|
|
|
.endif
|
2011-05-02 10:35:27 +00:00
|
|
|
|
2015-10-08 17:42:08 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "aarch64"
|
|
|
|
# We generally don't want fpu instructions in the kernel.
|
|
|
|
CFLAGS += -mgeneral-regs-only
|
|
|
|
# Reserve x18 for pcpu data
|
|
|
|
CFLAGS += -ffixed-x18
|
2016-10-09 21:47:20 +00:00
|
|
|
INLINE_LIMIT?= 8000
|
2015-10-08 17:42:08 +00:00
|
|
|
.endif
|
|
|
|
|
2016-01-29 15:12:31 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "riscv"
|
2018-09-03 14:43:16 +00:00
|
|
|
CFLAGS.gcc+= -mcmodel=medany -march=rv64imafdc -mabi=lp64
|
2016-01-29 15:12:31 +00:00
|
|
|
INLINE_LIMIT?= 8000
|
|
|
|
.endif
|
|
|
|
|
2003-02-28 06:49:59 +00:00
|
|
|
#
|
2011-12-24 12:28:23 +00:00
|
|
|
# For sparc64 we want the medany code model so modules may be located
|
|
|
|
# anywhere in the 64-bit address space. We also tell GCC to use floating
|
2003-02-28 06:49:59 +00:00
|
|
|
# point emulation. This avoids using floating point registers for integer
|
|
|
|
# operations which it has a tendency to do.
|
|
|
|
#
|
2010-09-13 07:27:03 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "sparc64"
|
2014-05-10 16:38:09 +00:00
|
|
|
CFLAGS.clang+= -mcmodel=large -fno-dwarf2-cfi-asm
|
|
|
|
CFLAGS.gcc+= -mcmodel=medany -msoft-float
|
2003-11-04 23:29:17 +00:00
|
|
|
INLINE_LIMIT?= 15000
|
2003-02-28 06:49:59 +00:00
|
|
|
.endif
|
|
|
|
|
2003-04-30 22:22:29 +00:00
|
|
|
#
|
2005-03-31 22:53:58 +00:00
|
|
|
# For AMD64, we explicitly prohibit the use of FPU, SSE and other SIMD
|
|
|
|
# operations inside the kernel itself. These operations are exclusively
|
|
|
|
# reserved for user applications.
|
2003-04-30 22:22:29 +00:00
|
|
|
#
|
2011-05-14 11:26:00 +00:00
|
|
|
# gcc:
|
|
|
|
# Setting -mno-mmx implies -mno-3dnow
|
|
|
|
# Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3 and -mfpmath=387
|
|
|
|
#
|
|
|
|
# clang:
|
2012-03-13 19:18:34 +00:00
|
|
|
# Setting -mno-mmx implies -mno-3dnow and -mno-3dnowa
|
|
|
|
# Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42
|
2011-05-14 11:26:00 +00:00
|
|
|
# (-mfpmath= is not supported)
|
|
|
|
#
|
2010-09-13 07:27:03 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "amd64"
|
2014-05-10 16:38:09 +00:00
|
|
|
CFLAGS.clang+= -mno-aes -mno-avx
|
2012-03-13 19:18:34 +00:00
|
|
|
CFLAGS+= -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float \
|
2011-05-14 11:26:00 +00:00
|
|
|
-fno-asynchronous-unwind-tables
|
2004-02-06 20:40:04 +00:00
|
|
|
INLINE_LIMIT?= 8000
|
2003-04-30 22:22:29 +00:00
|
|
|
.endif
|
|
|
|
|
2003-12-07 09:56:30 +00:00
|
|
|
#
|
|
|
|
# For PowerPC we tell gcc to use floating point emulation. This avoids using
|
|
|
|
# floating point registers for integer operations which it has a tendency to do.
|
2009-02-22 18:45:30 +00:00
|
|
|
# Also explicitly disable Altivec instructions inside the kernel.
|
2003-12-07 09:56:30 +00:00
|
|
|
#
|
2010-09-13 07:27:03 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "powerpc"
|
2017-01-31 01:55:29 +00:00
|
|
|
CFLAGS+= -mno-altivec -msoft-float
|
2003-12-07 09:56:30 +00:00
|
|
|
INLINE_LIMIT?= 15000
|
|
|
|
.endif
|
|
|
|
|
Create a new MACHINE_ARCH for Freescale PowerPC e500v2
Summary:
The Freescale e500v2 PowerPC core does not use a standard FPU.
Instead, it uses a Signal Processing Engine (SPE)--a DSP-style vector processor
unit, which doubles as a FPU. The PowerPC SPE ABI is incompatible with the
stock powerpc ABI, so a new MACHINE_ARCH was created to deal with this.
Additionaly, the SPE opcodes overlap with Altivec, so these are mutually
exclusive. Taking advantage of this fact, a new file, powerpc/booke/spe.c, was
created with the same function set as in powerpc/powerpc/altivec.c, so it
becomes effectively a drop-in replacement. setjmp/longjmp were modified to save
the upper 32-bits of the now-64-bit GPRs (upper 32-bits are only accessible by
the SPE).
Note: This does _not_ support the SPE in the e500v1, as the e500v1 SPE does not
support double-precision floating point.
Also, without a new MACHINE_ARCH it would be impossible to provide binary
packages which utilize the SPE.
Additionally, no work has been done to support ports, work is needed for this.
This also means no newer gcc can yet be used. However, gcc's powerpc support
has been refactored which would make adding a powerpcspe-freebsd target very
easy.
Test Plan:
This was lightly tested on a RouterBoard RB800 and an AmigaOne A1222
(P1022-based) board, compiled against the new ABI. Base system utilities
(/bin/sh, /bin/ls, etc) still function appropriately, the system is able to boot
multiuser.
Reviewed By: bdrewery, imp
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D5683
2016-10-22 01:57:15 +00:00
|
|
|
.if ${MACHINE_ARCH} == "powerpcspe"
|
2017-01-31 01:55:29 +00:00
|
|
|
CFLAGS.gcc+= -mno-spe
|
Create a new MACHINE_ARCH for Freescale PowerPC e500v2
Summary:
The Freescale e500v2 PowerPC core does not use a standard FPU.
Instead, it uses a Signal Processing Engine (SPE)--a DSP-style vector processor
unit, which doubles as a FPU. The PowerPC SPE ABI is incompatible with the
stock powerpc ABI, so a new MACHINE_ARCH was created to deal with this.
Additionaly, the SPE opcodes overlap with Altivec, so these are mutually
exclusive. Taking advantage of this fact, a new file, powerpc/booke/spe.c, was
created with the same function set as in powerpc/powerpc/altivec.c, so it
becomes effectively a drop-in replacement. setjmp/longjmp were modified to save
the upper 32-bits of the now-64-bit GPRs (upper 32-bits are only accessible by
the SPE).
Note: This does _not_ support the SPE in the e500v1, as the e500v1 SPE does not
support double-precision floating point.
Also, without a new MACHINE_ARCH it would be impossible to provide binary
packages which utilize the SPE.
Additionally, no work has been done to support ports, work is needed for this.
This also means no newer gcc can yet be used. However, gcc's powerpc support
has been refactored which would make adding a powerpcspe-freebsd target very
easy.
Test Plan:
This was lightly tested on a RouterBoard RB800 and an AmigaOne A1222
(P1022-based) board, compiled against the new ABI. Base system utilities
(/bin/sh, /bin/ls, etc) still function appropriately, the system is able to boot
multiuser.
Reviewed By: bdrewery, imp
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D5683
2016-10-22 01:57:15 +00:00
|
|
|
.endif
|
|
|
|
|
2011-02-18 21:44:53 +00:00
|
|
|
#
|
2017-11-25 21:44:23 +00:00
|
|
|
# Use dot symbols (or, better, the V2 ELF ABI) on powerpc64 to make
|
|
|
|
# DDB happy. ELFv2, if available, has some other efficiency benefits.
|
2011-02-18 21:44:53 +00:00
|
|
|
#
|
|
|
|
.if ${MACHINE_ARCH} == "powerpc64"
|
2017-11-25 21:44:23 +00:00
|
|
|
.if ${COMPILER_VERSION} >= 40900
|
|
|
|
CFLAGS.gcc+= -mabi=elfv2
|
|
|
|
.else
|
2015-02-27 20:32:50 +00:00
|
|
|
CFLAGS.gcc+= -mcall-aixdesc
|
2011-02-18 21:44:53 +00:00
|
|
|
.endif
|
2017-11-25 21:44:23 +00:00
|
|
|
CFLAGS.clang+= -mabi=elfv2
|
|
|
|
.endif
|
2011-02-18 21:44:53 +00:00
|
|
|
|
2008-04-29 11:28:10 +00:00
|
|
|
#
|
2010-01-09 17:21:36 +00:00
|
|
|
# For MIPS we also tell gcc to use floating point emulation
|
2008-04-29 11:28:10 +00:00
|
|
|
#
|
2010-09-13 07:27:03 +00:00
|
|
|
.if ${MACHINE_CPUARCH} == "mips"
|
2010-01-09 17:21:36 +00:00
|
|
|
CFLAGS+= -msoft-float
|
2009-03-03 18:53:47 +00:00
|
|
|
INLINE_LIMIT?= 8000
|
2008-04-29 11:28:10 +00:00
|
|
|
.endif
|
|
|
|
|
2001-09-10 06:23:33 +00:00
|
|
|
#
|
|
|
|
# GCC 3.0 and above like to do certain optimizations based on the
|
|
|
|
# assumption that the program is linked against libc. Stop this.
|
|
|
|
#
|
|
|
|
CFLAGS+= -ffreestanding
|
2008-06-25 21:33:28 +00:00
|
|
|
|
2015-02-05 01:36:53 +00:00
|
|
|
#
|
|
|
|
# The C standard leaves signed integer overflow behavior undefined.
|
|
|
|
# gcc and clang opimizers take advantage of this. The kernel makes
|
|
|
|
# use of signed integer wraparound mechanics so we need the compiler
|
|
|
|
# to treat it as a wraparound and not take shortcuts.
|
2018-02-28 14:57:45 +00:00
|
|
|
#
|
2015-02-05 01:36:53 +00:00
|
|
|
CFLAGS+= -fwrapv
|
|
|
|
|
2008-06-25 21:33:28 +00:00
|
|
|
#
|
2011-05-02 10:35:27 +00:00
|
|
|
# GCC SSP support
|
2008-06-25 21:33:28 +00:00
|
|
|
#
|
2014-07-07 00:27:09 +00:00
|
|
|
.if ${MK_SSP} != "no" && \
|
2011-04-19 18:09:21 +00:00
|
|
|
${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
|
2008-06-25 21:33:28 +00:00
|
|
|
CFLAGS+= -fstack-protector
|
|
|
|
.endif
|
2014-03-25 22:08:31 +00:00
|
|
|
|
2018-02-28 14:57:45 +00:00
|
|
|
#
|
|
|
|
# Retpoline speculative execution vulnerability mitigation (CVE-2017-5715)
|
|
|
|
#
|
|
|
|
.if defined(COMPILER_FEATURES) && ${COMPILER_FEATURES:Mretpoline} != "" && \
|
|
|
|
${MK_KERNEL_RETPOLINE} != "no"
|
|
|
|
CFLAGS+= -mretpoline
|
|
|
|
.endif
|
|
|
|
|
2014-03-25 22:08:31 +00:00
|
|
|
#
|
2014-04-01 14:24:20 +00:00
|
|
|
# Add -gdwarf-2 when compiling -g. The default starting in clang v3.4
|
|
|
|
# and gcc 4.8 is to generate DWARF version 4. However, our tools don't
|
|
|
|
# cope well with DWARF 4, so force it to genereate DWARF2, which they
|
|
|
|
# understand. Do this unconditionally as it is harmless when not needed,
|
|
|
|
# but critical for these newer versions.
|
2014-03-25 22:08:31 +00:00
|
|
|
#
|
2014-04-01 14:24:20 +00:00
|
|
|
.if ${CFLAGS:M-g} != "" && ${CFLAGS:M-gdwarf*} == ""
|
2014-03-25 22:08:31 +00:00
|
|
|
CFLAGS+= -gdwarf-2
|
|
|
|
.endif
|
2014-05-10 16:38:09 +00:00
|
|
|
|
2016-07-28 17:18:02 +00:00
|
|
|
CFLAGS+= ${CWARNFLAGS:M*} ${CWARNFLAGS.${.IMPSRC:T}}
|
2015-01-06 23:08:47 +00:00
|
|
|
CFLAGS+= ${CFLAGS.${COMPILER_TYPE}} ${CFLAGS.${.IMPSRC:T}}
|
2015-01-01 02:00:04 +00:00
|
|
|
|
|
|
|
# Tell bmake not to mistake standard targets for things to be searched for
|
|
|
|
# or expect to ever be up-to-date.
|
|
|
|
PHONY_NOTMAIN = afterdepend afterinstall all beforedepend beforeinstall \
|
|
|
|
beforelinking build build-tools buildfiles buildincludes \
|
|
|
|
checkdpadd clean cleandepend cleandir cleanobj configure \
|
2016-02-26 22:13:35 +00:00
|
|
|
depend distclean distribute exe \
|
2017-11-17 18:16:46 +00:00
|
|
|
html includes install installfiles installincludes \
|
2016-02-26 22:13:35 +00:00
|
|
|
obj objlink objs objwarn \
|
|
|
|
realinstall regress \
|
2015-01-01 02:00:04 +00:00
|
|
|
tags whereobj
|
|
|
|
|
|
|
|
.PHONY: ${PHONY_NOTMAIN}
|
|
|
|
.NOTMAIN: ${PHONY_NOTMAIN}
|
2015-01-01 08:18:08 +00:00
|
|
|
|
|
|
|
CSTD= c99
|
|
|
|
|
|
|
|
.if ${CSTD} == "k&r"
|
|
|
|
CFLAGS+= -traditional
|
|
|
|
.elif ${CSTD} == "c89" || ${CSTD} == "c90"
|
|
|
|
CFLAGS+= -std=iso9899:1990
|
|
|
|
.elif ${CSTD} == "c94" || ${CSTD} == "c95"
|
|
|
|
CFLAGS+= -std=iso9899:199409
|
|
|
|
.elif ${CSTD} == "c99"
|
|
|
|
CFLAGS+= -std=iso9899:1999
|
|
|
|
.else # CSTD
|
|
|
|
CFLAGS+= -std=${CSTD}
|
|
|
|
.endif # CSTD
|
2016-09-20 17:07:14 +00:00
|
|
|
|
2017-04-05 03:05:04 +00:00
|
|
|
# Set target-specific linker emulation name.
|
2016-09-20 17:07:14 +00:00
|
|
|
LD_EMULATION_aarch64=aarch64elf
|
|
|
|
LD_EMULATION_amd64=elf_x86_64_fbsd
|
|
|
|
LD_EMULATION_arm=armelf_fbsd
|
|
|
|
LD_EMULATION_armv6=armelf_fbsd
|
2017-10-05 23:01:33 +00:00
|
|
|
LD_EMULATION_armv7=armelf_fbsd
|
2016-09-20 17:07:14 +00:00
|
|
|
LD_EMULATION_i386=elf_i386_fbsd
|
|
|
|
LD_EMULATION_mips= elf32btsmip_fbsd
|
2018-04-12 15:12:40 +00:00
|
|
|
LD_EMULATION_mipshf= elf32btsmip_fbsd
|
2016-09-20 17:07:14 +00:00
|
|
|
LD_EMULATION_mips64= elf64btsmip_fbsd
|
2018-04-12 15:12:40 +00:00
|
|
|
LD_EMULATION_mips64hf= elf64btsmip_fbsd
|
2016-09-20 17:07:14 +00:00
|
|
|
LD_EMULATION_mipsel= elf32ltsmip_fbsd
|
2018-04-12 15:12:40 +00:00
|
|
|
LD_EMULATION_mipselhf= elf32ltsmip_fbsd
|
2016-09-20 17:07:14 +00:00
|
|
|
LD_EMULATION_mips64el= elf64ltsmip_fbsd
|
2018-04-12 15:12:40 +00:00
|
|
|
LD_EMULATION_mips64elhf= elf64ltsmip_fbsd
|
2016-09-20 17:07:14 +00:00
|
|
|
LD_EMULATION_mipsn32= elf32btsmipn32_fbsd
|
|
|
|
LD_EMULATION_mipsn32el= elf32btsmipn32_fbsd # I don't think this is a thing that works
|
|
|
|
LD_EMULATION_powerpc= elf32ppc_fbsd
|
Create a new MACHINE_ARCH for Freescale PowerPC e500v2
Summary:
The Freescale e500v2 PowerPC core does not use a standard FPU.
Instead, it uses a Signal Processing Engine (SPE)--a DSP-style vector processor
unit, which doubles as a FPU. The PowerPC SPE ABI is incompatible with the
stock powerpc ABI, so a new MACHINE_ARCH was created to deal with this.
Additionaly, the SPE opcodes overlap with Altivec, so these are mutually
exclusive. Taking advantage of this fact, a new file, powerpc/booke/spe.c, was
created with the same function set as in powerpc/powerpc/altivec.c, so it
becomes effectively a drop-in replacement. setjmp/longjmp were modified to save
the upper 32-bits of the now-64-bit GPRs (upper 32-bits are only accessible by
the SPE).
Note: This does _not_ support the SPE in the e500v1, as the e500v1 SPE does not
support double-precision floating point.
Also, without a new MACHINE_ARCH it would be impossible to provide binary
packages which utilize the SPE.
Additionally, no work has been done to support ports, work is needed for this.
This also means no newer gcc can yet be used. However, gcc's powerpc support
has been refactored which would make adding a powerpcspe-freebsd target very
easy.
Test Plan:
This was lightly tested on a RouterBoard RB800 and an AmigaOne A1222
(P1022-based) board, compiled against the new ABI. Base system utilities
(/bin/sh, /bin/ls, etc) still function appropriately, the system is able to boot
multiuser.
Reviewed By: bdrewery, imp
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D5683
2016-10-22 01:57:15 +00:00
|
|
|
LD_EMULATION_powerpcspe= elf32ppc_fbsd
|
2016-09-20 17:07:14 +00:00
|
|
|
LD_EMULATION_powerpc64= elf64ppc_fbsd
|
2017-04-05 18:59:58 +00:00
|
|
|
LD_EMULATION_riscv64= elf64lriscv
|
2016-09-20 17:07:14 +00:00
|
|
|
LD_EMULATION_sparc64= elf64_sparc_fbsd
|
|
|
|
LD_EMULATION=${LD_EMULATION_${MACHINE_ARCH}}
|