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

Re: [MiNT] Native GCC built



On 19/11/2013 23:10, Miro Kropáček wrote:
gcc itself makes trouble here, too. What happens if your cross compiler
is producing 68020-60 code by default and you want to compile new
gcc+multilib? Compiler components (libiberty etc) are 68020-60 optimized
as well as the gcc binary is, great. However, libgcc, libstdc++ and all
the other parts which are built for every multilib target are wrong for
68000 because guess what, there's no -m68000 attached to command line!

Here are some key points.

You have trouble because libgcc and friends are multilib-aware. They cleanly ask gcc the list of all the multilibs, and the CPU options to use.

To get the list of the multilibs supported by your compiler, use:
$ m68k-atari-mint-gcc -print-multi-lib
.;
mm68020-60;@m68020-60
m5475;@mcpu=5475
mshort;@mshort
m68020-60/mshort;@m68020-60@mshort
m5475/mshort;@mcpu=5475@mshort

For each supported multilib, there are 2 fields separated by ';'.
The first field is the name of the multilib. It is also the name of the subdirectory where the libs live. The second field contains the CPU options which must be used on the gcc command line to build binaries for that multilib. For an obscure reason, the spaces are removed and the - are replaced by @.

Look at the last line for example. It means :
In order to compile for the m5475/mshort multilib, then add "-mcpu=5475 -mshort" to the command line.

The first entry (single dot) is the default.
I guess you will get what you expect if you manage to change the gcc settings so the first line of -print-multi-lib is:
.;@m68000

Look at the multilib settings in the gcc patch, with some luck it may not be too complicated to change that.

If it works, that will cause absolutely no regression in the cross-compiler. That will just instruct gcc to use -m68000 when building the default libraries, which is exactly what you expect.

Other areas of interest:

1) 68000 libraries are in /usr/lib, while other variants are in subdirectories. What about moving 68000 libraries in a subdir, too, and keep /usr/lib empty? That would be more logical, but certainly not very standard.

2) GCC specs. Try this:
$ m68k-atari-mint-gcc -dumpspecs
The *multilib section determines how gcc determines the right multilib to use depending on the standard CPU arguments. The *multilib_matches indicates how to map non-standard CPU arguments to standard multilibs. I mean fallbacks when the exact requested multilib is not supported.
But that story will be for another time.

--
Vincent Rivière