External toolchain friendliness and /usr/lib32 for mips64
John Baldwin
jhb at freebsd.org
Fri Dec 23 22:13:45 UTC 2016
I have a set of patches (currently tied together, but could be split
into two chunks) for MIPS builds that do two things:
1) Be more external toolchain-friendly by explicitly specifying the
desired endianness and ABI both to the compiler and the linker.
This means we don't depend on the default target of a toolchain
matching the desired target arch. Previously, I had to explicitly
specify a TARGET_CPUTYPE for 32-bit mips when using
mips-xtoolchain-gcc, but with the ABI set explicitly simply
'TARGET_ARCH=mips' is sufficient. This also means that you can
now use 'mips-xtoolchain-gcc' to build mips64 (without
requiring the separate mips64-xtoolchain-gcc), and you can
build mipsn32 with gcc from ports (we don't have a binutils or
gcc port for mips that defaults to mipsn32 currently).
2) Add build glue for /usr/lib32 on mips64. This builds and installs
an o32 set of libraries and rtld (of matching endianness) in
/usr/lib32.
I have tested the latter with the MALTA64 kernel config (just adding
COMPAT_FREEBSD32) under qemu and am able to run 32-bit binaries just
fine.
Note that for 1), there is still the case that if we build a compiler
via the base/ ports, we want the default output to match the host,
so we would need a mips64-specific base/gcc separate from the mips
one (and we need a mipsn32 set of packages).
One annoyance is in the sys/boot/beri ldscripts. In-tree binutils
uses 'elf64-trad*mips' for its ABIs on FreeBSD while upstream
biutils uses 'elf64-trad*mips-freebsd'. However, the ldscripts are
already being linked with a linker that is using 64-bit MIPS (and
are only built for "mips64"), so the OUTPUT_FORMAT() isn't really
needed and can just be removed. I'd probably want to also remove
OUTPUT_ARCH() as well as I think that would be most consistent.
The patches are at:
https://github.com/freebsd/freebsd/compare/master...bsdjhb:mips_lib32
--
John Baldwin
More information about the freebsd-mips
mailing list