Bug 213458

Summary: MIPS ERL kernel build fails on octeon-sdk/cvmx-srio.c with external GCC 5.3.0
Product: Base System Reporter: Ed Maste <emaste>
Component: kernAssignee: freebsd-mips (Nobody) <mips>
Status: Closed Overcome By Events    
Severity: Affects Only Me    
Priority: ---    
Version: CURRENT   
Hardware: mips   
OS: Any   

Description Ed Maste freebsd_committer freebsd_triage 2016-10-13 18:17:29 UTC
make CROSS_TOOLCHAIN=mips64-gcc TARGET_ARCH=mips64 KERNCONF=ERL buildkernel

fails with:

/usr/local/bin/mips64-portbld-freebsd10.1-gcc -isystem /tank/emaste/obj/mips.mips64/tank/emaste/src/freebsd/tmp/usr/include -L/tank/emaste/obj/mips.mips64/tank/emaste/src/freebsd/tmp/usr/lib -B/tank/emaste/obj/mips.mips64/tank/emaste/src/freebsd/tmp/usr/lib --sysroot=/tank/emaste/obj/mips.mips64/tank/emaste/src/freebsd/tmp -B/usr/local/mips64-freebsd/bin/ -c -O -pipe  -g -nostdinc  -I. -I/tank/emaste/src/freebsd/sys -I/tank/emaste/src/freebsd/sys/contrib/libfdt -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h  -fno-pic -mno-abicalls -G0 -DKERNLOADADDR=0xffffffff80100000 -march=octeon -mabi=64 -MD  -MF.depend.cvmx-srio.o -MTcvmx-srio.o -msoft-float -ffreestanding -fwrapv -gdwarf-2 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -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=strict-overflow -Wno-error=unused-but-set-variable  -fno-common -fms-extensions -finline-limit=8000 --param inline-unit-growth=10000 --param large-function-growth=100000 --param max-inline-insns-single=10000  -std=iso9899:1999 -Werror  /tank/emaste/src/freebsd/sys/contrib/octeon-sdk/cvmx-srio.c
{standard input}: Assembler messages:
{standard input}:75: Error: opcode not supported on this processor: octeon (mips64r2) `saa $2,($3)'
{standard input}:4568: Error: opcode not supported on this processor: octeon (mips64r2) `saa $11,($3)'
{standard input}:4892: Error: opcode not supported on this processor: octeon (mips64r2) `saa $9,($2)'
{standard input}:5145: Error: opcode not supported on this processor: octeon (mips64r2) `saa $3,($6)'
*** Error code 1 (ignored)

This issue was also reported on Linux (https://community.ubnt.com/t5/EdgeMAX/kernel-compilation/td-p/466677/page/4). A Gentoo wiki page explains that the support was only in a Cavium-provided toolchain, not upstream (https://wiki.gentoo.org/wiki/MIPS/ERLite-3).

jmallett added saa/saad instructions to our base gas in r208737 (https://svnweb.freebsd.org/changeset/base/208737, see contrib/binutils/gas/config/tc-mips.c) but support is not in the FreeBSD mips binutils port.

This issue should probably be addressed by adding support to the binutils port, and also adding a workaround to the base system.
Comment 1 Ed Maste freebsd_committer freebsd_triage 2022-07-18 13:55:42 UTC
MIPS removed from main