Regarding GCC mips64 cross compiler for x86

Kai Ruottu
Mon Nov 2 21:18:00 GMT 2015

30.10.2015, 23:32, Steve Ellcey kirjoitti:
> On Fri, 2015-10-30 at 13:40 -0700, Bryan Hundven wrote:
>> <shameless plug>
>> You could always use crosstool-ng:
>> Cheers,
>> -Bryan
> I picked up the latest release (1.9) and I see a couple mips64 sample
> configs (both with uclibc) but if I run menuconfig it doesn't show me a
> mips64 target and if I pick mips then I cannot build a 64 bit ABI.
> I grabbed the latest sources from github, but I still don't see any
> way (under menuconfig) to build a 64 bit MIPS compiler.

I had some older glibc's, ver 2.13, for 'mips64el-linux-gnu' target, 
taken from the Debian archives.
In 'lib', 'lib32' and 'lib64' its variations...  The 64 one 
'' told with 'strings' :

GNU C Library (Debian EGLIBC 2.13-38+deb7u1) stable release version 
2.13, by Roland McGrath et al.
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
Compiled by GNU CC version 4.4.7.
Compiled on a Linux 3.2.53 system on 2013-12-23.
Available extensions:
         crypt add-on version 2.1 by Michael Glad and others
         GNU Libidn by Simon Josefsson
         Native POSIX Threads Library by Ulrich Drepper et al
         Support for some architectures added on, not maintained in 
glibc core.

and with 'readelf' :

[root@localhost lib64]# mips64el-linux-gnu-readelf -h
ELF Header:
   Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
   Class:                             ELF64
   Data:                              2's complement, little endian
   Version:                           1 (current)
   OS/ABI:                            UNIX - System V
   ABI Version:                       0
   Type:                              DYN (Shared object file)
   Machine:                           MIPS R3000
   Version:                           0x1
   Entry point address:               0x35ed8
   Start of program headers:          64 (bytes into file)
   Start of section headers:          1697512 (bytes into file)
   Flags:                             0x20000007, noreorder, pic, cpic, 
   Size of this header:               64 (bytes)
   Size of program headers:           56 (bytes)
   Number of program headers:         11
   Size of section headers:           64 (bytes)
   Number of section headers:         35
   Section header string table index: 34

Ok, using a prebuilt already existing 'mips64el-linux-gnu' target 
(Debian 7.4.0) instead of
some still unexisting "totally self built" Linux/mips64el system made 
from absolute scratch,
made the task easy. Especially when I already had a gcc-4.9.3 built for 
C and C++ only. Adding
'fortran' into the configure script's '--enable-languages=' and 
rebuilding wasn't that hard...

Seemed to produce those 'libgcc' variations just now. But the 'gfortran' 
driver and the 'f951'
compiler were already built :

[root@localhost gcc]# ./gfortran -v
Using built-in specs.
Target: mips64el-linux-gnu
Configured with: ../configure --build=i686-linux-gnu 
--host=i686-linux-gnu --target=mips64el-linux-gnu --prefix=/opt/cross 
--libexecdir=/opt/cross/lib --enable-languages=c,c++,fortran 
--enable-targets=all --enable-shared --enable-threads=posix 
--enable-linker-build-id --enable-checking=release 
--enable-libstdcxx-debug --enable-clocale=gnu --disable-nls 
--without-included-gettext --enable-version-specific-runtime-libs 
--disable-libssp --disable-libgomp 
--program-prefix=mips64el-linux-gnu- --program-suffix=-4.9
Thread model: posix
gcc version 4.9.3 (by Kai Ruottu)

Let's see whether the build will succeed completely...

More information about the Gcc-help mailing list