Matthias Klose doko@ubuntu.com 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.
No, you don't need to build the toolchain multiple times. The toolchain build process for a target that supports multilibs will automatically build the *target libraries* multiple times. This is controlled by a bunch of MULTILIB_... variables set in the target makefile fragment. For example, when configuring GCC for arm-linux-androideabi, the makefile fragment config/arm/t-linux-androideabi is used and sets:
MULTILIB_OPTIONS = march=armv7-a mthumb MULTILIB_DIRNAMES = armv7-a thumb
This has two effects: first, during GCC build, two extra sets of libraries are built; one with the flag -march=armv7-a, which is stored in a subdirectory called "armv7-a", and one with the flag -mthumb, which is stored in "thumb".
The second effect is at that runtime, when GCC is invoked with the -march=armv7-a or -mthumb flags, the GCC driver will search for target libraries in the respective directories "armv7-a" and "thumb" first, before falling back to the default location.
This has been supported by GCC for a long time, but it isn't frequently used on Linux targets (except to support -m32/-m64 style bi-arch compilers). One reason is that the GCC multilib scheme only affects target libraries built as part of the GCC build process itself -- it does not solve the problem of providing multiple version of all the other system libraries. (However, embedded targets already make frequent use of multilibs.)
Mit freundlichen Gruessen / Best Regards
Ulrich Weigand
-- Dr. Ulrich Weigand | Phone: +49-7031/16-3727 STSM, GNU compiler and toolchain for Linux on System z and Cell/B.E. IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martin Jetter | Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht Stuttgart, HRB 243294