qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 0/8] target/mips: Support R5900 GCC programs


From: Fredrik Noring
Subject: Re: [Qemu-devel] [PATCH v5 0/8] target/mips: Support R5900 GCC programs in user mode
Date: Sat, 29 Sep 2018 11:36:10 +0200
User-agent: Mutt/1.10.1 (2018-07-13)

Hi Philippe,

> We could manage to build a docker mips-r5900 cross-compiler image, such:
> https://lists.gnu.org/archive/html/qemu-devel/2018-06/msg06908.html
> 
> But we'll need your patches.

The attached patches for GAS and GCC are provisional and intended to enable
and simplify the use of a modern GCC for the R5900 target. There are two
main parts:

1. Libc needs LL and SC instructions which GAS refuses to assemble since
   they are not part of the R5900 ISA. However, they are required and
   emulated by the Linux kernel. I have been told that the recommended
   fix is to implement special architecture overrides in libc which will
   force GAS to accept LL and SC, and since this involves public headers
   certain compatibility issues need to be addressed. The attached
   workaround simply makes GAS and GCC accept LL and SC so that libc can
   use the instructions as-is.

2. Similarly, GCC emits certain floating point instructions which GAS
   refuses to assemble since they are not part of the R5900 ISA. Like LL
   and SC, the kernel is designed to emulate such instructions. The
   attached workaround forces the use of the single precision floating
   point format to avoid these problems.

Finally, it seems GCC emits MIPS16 instructions which are causing problems
for the R5900 target. The attached patches fix these as well.

Gentoo can be compiled for the R5900. To do this, the attached patches need
to be installed in

        /etc/portage/patches/cross-mipsr5900el-unknown-linux-gnu/

on a host Gentoo system, in subdirectories such as

        binutils-2.31.1
        gcc-7.3.0

depending on the particular versions that will be used. The Gentoo
sys-devel/crossdev package page

https://wiki.gentoo.org/wiki/Crossdev

and the cross build environment guide

https://wiki.gentoo.org/wiki/Cross_build_environment

explain the details involving configuring for example a Gentoo profile and
an overlay. Once those simple steps have been taken the command

        # crossdev -s4 -t mipsr5900el-unknown-linux-gnu

can be used to obtain an R5900 cross toolchain as well as the basis of an
R5900 Gentoo root filesystem in

        /usr/mipsr5900el-unknown-linux-gnu

As the guide explains, the R5900 base system can be built from scratch
using the command

        # mipsr5900el-unknown-linux-gnu-emerge -uva --keep-going @system

The root filesystem can then be used for R5900 QEMU user mode emulation
(as described in the guide) or directly in Linux on R5900 hardware.

Fredrik

Attachment: binutils-v2.30-ps2-llsc.patch
Description: Text Data

Attachment: gcc-v7.2.0-ps2-llsc.patch
Description: Text Data

Attachment: gcc-v7.2.0-ps2.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]