mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 08:09:08 +00:00
Support armv7 builds for userland
Make armv7 as a new MACHINE_ARCH. Copy all the places we do armv6 and add armv7 as basically an alias. clang appears to generate code for armv7 by default. armv7 hard float isn't supported by the the in-tree gcc, so it hasn't been updated to have a new default. Support armv7 as a new valid MACHINE_ARCH (and by extension TARGET_ARCH). Add armv7 to the universe build. Differential Revision: https://reviews.freebsd.org/D12010
This commit is contained in:
parent
b1bad39103
commit
0b972ac92e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=324340
2
Makefile
2
Makefile
@ -435,7 +435,7 @@ worlds: .PHONY
|
||||
.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
|
||||
TARGETS?=amd64 arm arm64 i386 mips powerpc riscv sparc64
|
||||
_UNIVERSE_TARGETS= ${TARGETS}
|
||||
TARGET_ARCHES_arm?= arm armeb armv6
|
||||
TARGET_ARCHES_arm?= arm armeb armv6 armv7
|
||||
TARGET_ARCHES_arm64?= aarch64
|
||||
TARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32 mipselhf mipshf mips64elhf mips64hf
|
||||
TARGET_ARCHES_powerpc?= powerpc powerpc64 powerpcspe
|
||||
|
@ -398,6 +398,7 @@ KNOWN_ARCHES?= aarch64/arm64 \
|
||||
arm \
|
||||
armeb/arm \
|
||||
armv6/arm \
|
||||
armv7/arm \
|
||||
i386 \
|
||||
mips \
|
||||
mipsel/mips \
|
||||
@ -614,7 +615,7 @@ BFLAGS+= -B${CROSS_BINUTILS_PREFIX}
|
||||
BFLAGS+= -B${WORLDTMP}/usr/bin
|
||||
.endif
|
||||
.if ${TARGET} == "arm"
|
||||
.if ${TARGET_ARCH:Marmv6*} != "" && ${TARGET_CPUTYPE:M*soft*} == ""
|
||||
.if ${TARGET_ARCH:Marmv[67]*} != "" && ${TARGET_CPUTYPE:M*soft*} == ""
|
||||
TARGET_ABI= gnueabihf
|
||||
.else
|
||||
TARGET_ABI= gnueabi
|
||||
@ -650,7 +651,7 @@ XCFLAGS+= ${BFLAGS}
|
||||
${TARGET_ARCH} == "powerpc64" || ${TARGET_ARCH:Mmips64*} != "")
|
||||
LIBCOMPAT= 32
|
||||
.include "Makefile.libcompat"
|
||||
.elif ${MK_LIBSOFT} != "no" && ${TARGET_ARCH} == "armv6"
|
||||
.elif ${MK_LIBSOFT} != "no" && ${TARGET_ARCH:Marmv[67]*} != ""
|
||||
LIBCOMPAT= SOFT
|
||||
.include "Makefile.libcompat"
|
||||
.endif
|
||||
|
@ -59,10 +59,10 @@ LIB32WMAKEFLAGS+= -DCOMPAT_32BIT
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# soft-fp world
|
||||
.if ${TARGET_ARCH} == "armv6"
|
||||
.if ${TARGET_ARCH:Marmv[67]*} != ""
|
||||
LIBSOFTCFLAGS= -DCOMPAT_SOFTFP
|
||||
LIBSOFTCPUFLAGS= -mfloat-abi=softfp
|
||||
LIBSOFTWMAKEENV= CPUTYPE=soft MACHINE=arm MACHINE_ARCH=armv6
|
||||
LIBSOFTWMAKEENV= CPUTYPE=soft MACHINE=arm MACHINE_ARCH=${TARGET_ARCH}
|
||||
LIBSOFTWMAKEFLAGS= -DCOMPAT_SOFTFP
|
||||
.endif
|
||||
|
||||
|
@ -46,9 +46,12 @@ SRCS+= app.c \
|
||||
# DEO: why not used?
|
||||
#SRCS+= itbl-ops.c
|
||||
|
||||
.if ${TARGET_ARCH} == "armv6" || ${TARGET_ARCH} == "armv6eb"
|
||||
.if ${TARGET_ARCH:Marmv6*} != ""
|
||||
CFLAGS+= -DCPU_DEFAULT=ARM_ARCH_V6K
|
||||
.endif
|
||||
.if ${TARGET_ARCH:Marmv7*} != ""
|
||||
CFLAGS+= -DCPU_DEFAULT=ARM_ARCH_V7A
|
||||
.endif
|
||||
|
||||
.if ${TARGET_CPUARCH} == "mips"
|
||||
SRCS+= itbl-ops.c itbl-parse.y itbl-lex.l
|
||||
|
@ -34,9 +34,12 @@ CFLAGS+= -DTARGET_ARM_EABI
|
||||
.if ${TARGET_ARCH:Marm*eb} != ""
|
||||
CFLAGS += -DTARGET_ENDIAN_DEFAULT=MASK_BIG_END
|
||||
.endif
|
||||
.if ${TARGET_ARCH} == "armv6" || ${TARGET_ARCH} == "armv6eb"
|
||||
.if ${TARGET_ARCH:Marmv6*} != ""
|
||||
CFLAGS += -DFREEBSD_ARCH_armv6
|
||||
.endif
|
||||
.if ${TARGET_ARCH:Marmv7*} != ""
|
||||
CFLAGS += -DFREEBSD_ARCH_armv7
|
||||
.endif
|
||||
|
||||
.if ${TARGET_CPUARCH} == "mips"
|
||||
.if ${TARGET_ARCH:Mmips*el*} != ""
|
||||
|
@ -20,10 +20,10 @@ CFLAGS+= -D__STDC_CONSTANT_MACROS
|
||||
TARGET_ARCH?= ${MACHINE_ARCH}
|
||||
BUILD_ARCH?= ${MACHINE_ARCH}
|
||||
|
||||
# Armv6 uses hard float abi, unless the CPUTYPE has soft in it.
|
||||
# Armv6 and armv7 uses hard float abi, unless the CPUTYPE has soft in it.
|
||||
# arm (for armv4 and armv5 CPUs) always uses the soft float ABI.
|
||||
# For all other targets, we stick with 'unknown'.
|
||||
.if ${TARGET_ARCH:Marmv6*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
|
||||
.if ${TARGET_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
|
||||
TARGET_ABI= -gnueabihf
|
||||
.elif ${TARGET_ARCH:Marm*}
|
||||
TARGET_ABI= -gnueabi
|
||||
|
@ -110,7 +110,7 @@ NOASM=
|
||||
.include "${LIBC_SRCTOP}/uuid/Makefile.inc"
|
||||
.include "${LIBC_SRCTOP}/xdr/Makefile.inc"
|
||||
.if (${LIBC_ARCH} == "arm" && \
|
||||
(${MACHINE_ARCH:Marmv6*} == "" || (defined(CPUTYPE) && ${CPUTYPE:M*soft*}))) || \
|
||||
(${MACHINE_ARCH:Marmv[67]*} == "" || (defined(CPUTYPE) && ${CPUTYPE:M*soft*}))) || \
|
||||
(${LIBC_ARCH} == "mips" && ${MACHINE_ARCH:Mmips*hf} == "") || \
|
||||
(${LIBC_ARCH} == "riscv" && ${MACHINE_ARCH:Mriscv*sf} != "")
|
||||
.include "${LIBC_SRCTOP}/softfloat/Makefile.inc"
|
||||
|
@ -11,7 +11,7 @@ SYM_MAPS+=${LIBC_SRCTOP}/arm/Symbol.map
|
||||
|
||||
.include "${LIBC_SRCTOP}/arm/aeabi/Makefile.inc"
|
||||
|
||||
.if ${MACHINE_ARCH:Marmv6*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
|
||||
.if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
|
||||
SYM_MAPS+=${LIBC_SRCTOP}/arm/Symbol_vfp.map
|
||||
.endif
|
||||
|
||||
|
@ -5,14 +5,14 @@
|
||||
SRCS+= aeabi_atexit.c \
|
||||
aeabi_unwind_cpp.c \
|
||||
aeabi_unwind_exidx.c
|
||||
.if (${MACHINE_ARCH:Marmv6*} && defined(CPUTYPE) && ${CPUTYPE:M*soft*} != "") || \
|
||||
${MACHINE_ARCH:Marmv6*} == ""
|
||||
.if (${MACHINE_ARCH:Marmv[67]*} && defined(CPUTYPE) && ${CPUTYPE:M*soft*} != "") || \
|
||||
${MACHINE_ARCH:Marmv[67]*} == ""
|
||||
SRCS+= aeabi_asm_double.S \
|
||||
aeabi_asm_float.S \
|
||||
aeabi_double.c \
|
||||
aeabi_float.c
|
||||
.endif
|
||||
.if ${MACHINE_ARCH:Marmv6*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
|
||||
.if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
|
||||
SRCS+= aeabi_vfp_double.S \
|
||||
aeabi_vfp_float.S
|
||||
.endif
|
||||
|
@ -7,7 +7,7 @@ SRCS+= _ctx_start.S _setjmp.S _set_tp.c alloca.S fabs.c \
|
||||
arm_initfini.c \
|
||||
trivial-getcontextx.c
|
||||
|
||||
.if ${MACHINE_ARCH:Marmv6*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
|
||||
.if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
|
||||
SRCS+= fpgetmask_vfp.c fpgetround_vfp.c fpgetsticky_vfp.c fpsetmask_vfp.c \
|
||||
fpsetround_vfp.c fpsetsticky_vfp.c
|
||||
.endif
|
||||
|
@ -124,7 +124,7 @@ SYM_MAPS+= ${LIBC_SRCTOP}/sys/Symbol.map
|
||||
CLEANFILES+= ${SASM} ${SPSEUDO}
|
||||
|
||||
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \
|
||||
${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_ARCH:Marmv6*}
|
||||
${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_ARCH:Marmv[67]*}
|
||||
NOTE_GNU_STACK='\t.section .note.GNU-stack,"",%%progbits\n'
|
||||
.else
|
||||
NOTE_GNU_STACK=''
|
||||
|
@ -204,7 +204,7 @@ SRCF+= stdatomic
|
||||
.endif
|
||||
|
||||
.for file in ${SRCF}
|
||||
.if ${MACHINE_ARCH:Marmv6*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") \
|
||||
.if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") \
|
||||
&& exists(${CRTSRC}/${CRTARCH}/${file}vfp.S)
|
||||
SRCS+= ${file}vfp.S
|
||||
. elif exists(${CRTSRC}/${CRTARCH}/${file}.S)
|
||||
|
@ -3,7 +3,7 @@
|
||||
LDBL_PREC = 53
|
||||
SYM_MAPS += ${.CURDIR}/arm/Symbol.map
|
||||
|
||||
.if ${MACHINE_ARCH:Marmv6*} && defined(CPUTYPE) && ${CPUTYPE:M*soft*} != ""
|
||||
.if ${MACHINE_ARCH:Marmv[67]*} && defined(CPUTYPE) && ${CPUTYPE:M*soft*} != ""
|
||||
ARCH_SRCS = fenv-softfp.c fenv-vfp.c
|
||||
.endif
|
||||
|
||||
|
@ -57,7 +57,7 @@ TLD?= ${FTPDIR}/releases
|
||||
.endif
|
||||
|
||||
.if defined(EMBEDDED) && !empty(EMBEDDED)
|
||||
. if ${TARGET:Marm*} != "" && (${TARGET_ARCH} == "armv6" || ${TARGET_ARCH} == "aarch64")
|
||||
. if ${TARGET:Marm*} != "" && (${TARGET_ARCH:Marmv[67]} != "" || ${TARGET_ARCH} == "aarch64")
|
||||
. if !defined(BOARDNAME) && empty(BOARDNAME)
|
||||
BOARDNAME:= ${KERNCONF}
|
||||
. else
|
||||
|
@ -110,8 +110,6 @@ _CPUCFLAGS = -march=${CPUTYPE}
|
||||
_CPUCFLAGS = -march=armv5te -D__XSCALE__
|
||||
. elif ${CPUTYPE:M*soft*} != ""
|
||||
_CPUCFLAGS = -mfloat-abi=softfp
|
||||
. elif ${CPUTYPE} == "armv6"
|
||||
_CPUCFLAGS = -march=${CPUTYPE}
|
||||
. elif ${CPUTYPE} == "cortexa"
|
||||
_CPUCFLAGS = -march=armv7 -mfpu=vfp
|
||||
. elif ${CPUTYPE:Marmv[4567]*} != ""
|
||||
@ -339,18 +337,20 @@ MACHINE_CPU += arm
|
||||
. if ${MACHINE_ARCH:Marmv6*} != ""
|
||||
MACHINE_CPU += armv6
|
||||
. endif
|
||||
# armv6 is a hybrid. It can use the softfp ABI, but doesn't emulate
|
||||
# floating point in the general case, so don't define softfp for
|
||||
# it at this time. arm and armeb are pure softfp, so define it
|
||||
# for them.
|
||||
. if ${MACHINE_ARCH:Marmv6*} == ""
|
||||
. if ${MACHINE_ARCH:Marmv7*} != ""
|
||||
MACHINE_CPU += armv7
|
||||
. endif
|
||||
# armv6 and armv7 are a hybrid. It can use the softfp ABI, but doesn't emulate
|
||||
# floating point in the general case, so don't define softfp for it at this
|
||||
# time. arm and armeb are pure softfp, so define it for them.
|
||||
. if ${MACHINE_ARCH:Marmv[67]*} == ""
|
||||
MACHINE_CPU += softfp
|
||||
. endif
|
||||
# Normally armv6 is hard float ABI from FreeBSD 11 onwards. However
|
||||
# when CPUTYPE has 'soft' in it, we use the soft-float ABI to allow
|
||||
# building of soft-float ABI libraries. In this case, we have to
|
||||
# add the -mfloat-abi=softfp to force that.
|
||||
.if ${MACHINE_ARCH:Marmv6*} && defined(CPUTYPE) && ${CPUTYPE:M*soft*} != ""
|
||||
# Normally armv6 and armv7 are hard float ABI from FreeBSD 11 onwards. However
|
||||
# when CPUTYPE has 'soft' in it, we use the soft-float ABI to allow building of
|
||||
# soft-float ABI libraries. In this case, we have to add the -mfloat-abi=softfp
|
||||
# to force that.
|
||||
.if ${MACHINE_ARCH:Marmv[67]*} && defined(CPUTYPE) && ${CPUTYPE:M*soft*} != ""
|
||||
# Needs to be CFLAGS not _CPUCFLAGS because it's needed for the ABI
|
||||
# not a nice optimization.
|
||||
CFLAGS += -mfloat-abi=softfp
|
||||
|
@ -43,7 +43,7 @@ OBJROOT:= ${OBJROOT:H:tA}/${OBJROOT:T}
|
||||
.endif
|
||||
|
||||
# from src/Makefile (for universe)
|
||||
TARGET_ARCHES_arm?= arm armeb armv6
|
||||
TARGET_ARCHES_arm?= arm armeb armv6 armv7
|
||||
TARGET_ARCHES_arm64?= aarch64
|
||||
TARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32 mipsn32el
|
||||
TARGET_ARCHES_powerpc?= powerpc powerpc64 powerpcspe
|
||||
|
@ -273,7 +273,7 @@ __DEFAULT_NO_OPTIONS+=GDB_LIBEXEC
|
||||
__DEFAULT_YES_OPTIONS+=GDB_LIBEXEC
|
||||
.endif
|
||||
# Only doing soft float API stuff on armv6
|
||||
.if ${__T} != "armv6"
|
||||
.if ${__T} != "armv6" && ${__T} != "armv7"
|
||||
BROKEN_OPTIONS+=LIBSOFT
|
||||
.endif
|
||||
.if ${__T:Mmips*}
|
||||
|
@ -13,7 +13,7 @@ unix ?= We run FreeBSD, not UNIX.
|
||||
# and/or endian. This is called MACHINE_CPU in NetBSD, but that's used
|
||||
# for something different in FreeBSD.
|
||||
#
|
||||
__TO_CPUARCH=C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv/
|
||||
__TO_CPUARCH=C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v[67])?(eb)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv/
|
||||
MACHINE_CPUARCH=${MACHINE_ARCH:${__TO_CPUARCH}}
|
||||
.endif
|
||||
|
||||
|
@ -75,7 +75,7 @@ FILES_CPU_FUNC = \
|
||||
$S/$M/$M/cpufunc_asm_pj4b.S $S/$M/$M/cpufunc_asm_armv6.S \
|
||||
$S/$M/$M/cpufunc_asm_armv7.S
|
||||
|
||||
.if ${MACHINE_ARCH} != "armv6" && defined(KERNPHYSADDR)
|
||||
.if ${MACHINE_ARCH:Marmv[67]*} == "" && defined(KERNPHYSADDR)
|
||||
KERNEL_EXTRA=trampoline
|
||||
KERNEL_EXTRA_INSTALL=kernel.gz.tramp
|
||||
trampoline: ${KERNEL_KO}.tramp
|
||||
|
@ -259,6 +259,7 @@ LD_EMULATION_amd64=elf_x86_64_fbsd
|
||||
LD_EMULATION_arm=armelf_fbsd
|
||||
LD_EMULATION_armeb=armelfb_fbsd
|
||||
LD_EMULATION_armv6=armelf_fbsd
|
||||
LD_EMULATION_armv7=armelf_fbsd
|
||||
LD_EMULATION_i386=elf_i386_fbsd
|
||||
LD_EMULATION_mips= elf32btsmip_fbsd
|
||||
LD_EMULATION_mips64= elf64btsmip_fbsd
|
||||
|
@ -62,7 +62,7 @@ __DEFAULT_NO_OPTIONS = \
|
||||
|
||||
# Things that don't work based on the CPU
|
||||
.if ${MACHINE_CPUARCH} == "arm"
|
||||
. if ${MACHINE_ARCH:Marmv6*} == ""
|
||||
. if ${MACHINE_ARCH:Marmv[67]*} == ""
|
||||
BROKEN_OPTIONS+= CDDL ZFS
|
||||
. endif
|
||||
.endif
|
||||
|
@ -255,6 +255,7 @@ EMBEDFS_ARCH.${MACHINE_ARCH}!= sed -n '/OUTPUT_ARCH/s/.*(\(.*\)).*/\1/p' ${LDSCR
|
||||
|
||||
EMBEDFS_FORMAT.arm?= elf32-littlearm
|
||||
EMBEDFS_FORMAT.armv6?= elf32-littlearm
|
||||
EMBEDFS_FORMAT.armv7?= elf32-littlearm
|
||||
EMBEDFS_FORMAT.aarch64?= elf64-littleaarch64
|
||||
EMBEDFS_FORMAT.mips?= elf32-tradbigmips
|
||||
EMBEDFS_FORMAT.mipsel?= elf32-tradlittlemips
|
||||
|
@ -426,7 +426,7 @@ _autofs= autofs
|
||||
.endif
|
||||
|
||||
.if ${MK_CDDL} != "no" || defined(ALL_MODULES)
|
||||
.if (${MACHINE_CPUARCH} != "arm" || ${MACHINE_ARCH:Marmv6*} != "") && \
|
||||
.if (${MACHINE_CPUARCH} != "arm" || ${MACHINE_ARCH:Marmv[67]*} != "") && \
|
||||
${MACHINE_CPUARCH} != "mips" && \
|
||||
${MACHINE_CPUARCH} != "sparc64"
|
||||
SUBDIR+= dtrace
|
||||
@ -800,7 +800,7 @@ _em= em
|
||||
_epic= epic
|
||||
.endif
|
||||
|
||||
.if (${MACHINE_CPUARCH} == "amd64" || ${MACHINE_ARCH} == "armv6" || \
|
||||
.if (${MACHINE_CPUARCH} == "amd64" || ${MACHINE_ARCH:Marmv[67]*} != "" || \
|
||||
${MACHINE_CPUARCH} == "i386")
|
||||
_cloudabi32= cloudabi32
|
||||
.endif
|
||||
@ -810,7 +810,7 @@ _cloudabi64= cloudabi64
|
||||
|
||||
.endif
|
||||
|
||||
.if ${MACHINE_ARCH} == "armv6"
|
||||
.if ${MACHINE_ARCH:Marmv[67]*} != ""
|
||||
_ffec= ffec
|
||||
.endif
|
||||
|
||||
|
@ -18,7 +18,7 @@ CLEANFILES=cloudabi32_vdso.o
|
||||
VDSO_SRCS=${SYSDIR}/contrib/cloudabi/cloudabi_vdso_i686_on_64bit.S
|
||||
OUTPUT_TARGET=elf64-x86-64-freebsd
|
||||
BINARY_ARCHITECTURE=i386
|
||||
.elif ${MACHINE_ARCH} == "armv6"
|
||||
.elif ${MACHINE_ARCH:Marmv[67]*} != ""
|
||||
VDSO_SRCS=${SYSDIR}/contrib/cloudabi/cloudabi_vdso_armv6.S
|
||||
OUTPUT_TARGET=elf32-littlearm
|
||||
BINARY_ARCHITECTURE=arm
|
||||
|
Loading…
Reference in New Issue
Block a user