svn commit: r316622 - head/share/mk

John Baldwin jhb at freebsd.org
Fri Apr 7 20:11:31 UTC 2017


On Friday, April 07, 2017 08:02:01 PM John Baldwin wrote:
> Author: jhb
> Date: Fri Apr  7 20:02:01 2017
> New Revision: 316622
> URL: https://svnweb.freebsd.org/changeset/base/316622
> 
> Log:
>   Explicitly set the desired MIPS ABI in toolchain flags.
>   
>   Specifically, set '-mabi=XX' in AFLAGS, CFLAGS, and LDFLAGS.  This permits
>   building MIPS worlds and binaries with a toolchain whose default output
>   does not match the desired TARGET_ARCH.
>   
>   _LDFLAGS (which is used with LD instead of with CC) required an update as
>   LD does not accept the -mabi flags (so they must be stripped from LDFLAGS
>   when generating _LDFLAGS).  For bare uses of LD (rather than linking via
>   CC), the desired ABI must be set by setting an explicit linker emulation
>   as done in r316514 for kernels and kernel modules.

With this (and other recent commits), I can build (and run) mips and mips64
world + kernels under QEMU with external GCC from ports via the
mips-xtoolchain-gcc package.  (mipsn32 also builds, but it fails to boot in
the same failure case for both old and new GCC)

Building mips:

make CROSS_TOOLCHAIN=mips-gcc TARGET_CPUTYPE=mips3 TARGET_ARCH=mips buildworld

For mips64 and mipsn32 TARGET_CPUTYPE is not required and only TARGET_ARCH
has to be changed.

(Previously mips-gcc has worked for 32-bit mips as that was the default
target for mips-gcc.  There is a mips64-xtoolchain-gcc that targets mips64
by default that previously worked for mips64.  However, you can now use
either of these toolchains to build any mips variant.  Previously mips64-gcc
could only build mips64, and mips-gcc could only build o32 mips.  Neither
package was able to build n32.  We could perhaps drop the mips64-gcc package
at some point in the future.)

-- 
John Baldwin


More information about the svn-src-head mailing list