Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 07 Apr 2017 13:10:13 -0700
From:      John Baldwin <jhb@freebsd.org>
To:        src-committers@freebsd.org
Cc:        svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r316622 - head/share/mk
Message-ID:  <3876116.W5eNvcJ1Jh@ralph.baldwin.cx>
In-Reply-To: <201704072002.v37K21Ux032932@repo.freebsd.org>
References:  <201704072002.v37K21Ux032932@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3876116.W5eNvcJ1Jh>