On 07/10/10 12:36, Matthias Klose wrote:
last time I checked this "multilibs" feature was implemented by building the toolchain N times. By which magic is the correct library selected? I didn't find anything in fsf trunk which supports this kind of multilibs builds.
It's there, and has been since forever. :)
You pass --enable-multilibs when you configure the compiler, and you get all the libgcc.a, crt[in].o, and other such files compiled and installed automatically. If you build for bare-metal, and newlib is in your source tree, that gets built automatically also. I think glibc has to be built multiple times manually.
The compiler selects the libraries by recognising the compiler command line switches and matching them to a library. It then adjusts the search paths accordingly.
If you do "gcc -print-multi-lib" on Ubuntu gcc (Lucid) it says:
.; 32;@m32
This means there are two multilibs: the first has libraries found in directory "." (i.e. the root of the library directory) and is used for the default options (there's a blank after the ";"); and the second has libraries in the directory "32" and is used whenever the -m32 option is passed.
Andrew