Sourcery CodeBench and modern FSF Mips toolchains require a bit more
complicated algorithm to calculate headers, libraries and sysroot
paths than implemented by Clang driver now. The main problem is that all
these paths depend on a set of command line arguments additionally to a target
triple value. For example, let $TC is a toolchain installation directory.
If we compile big-endian 32-bit mips code, crtbegin.o is in
the $TC/lib/gcc/mips-linux-gnu/4.7.2 folder and the toolchain's linker
requires --sysroot=$TC/mips-linux-gnu/libc argument. If we compile
little-endian 32-bit soft-float mips code, crtbegin.o is in
the $TC/lib/gcc/mips-linux-gnu/4.7.2/soft-float/el folder and the toolchain's
linker requires --sysroot=$TC/mips-linux-gnu/libc/soft-float/el argument.
This patch supports Sourcery CodeBench toolchain directories tree.
The FSF's tree slightly differs and is not supported yet.
- Calculate MultiarchSuffix using all necessary command line options and use this MultiarchSuffix to detect crtbegin.o location in the GCCInstallationDetector::ScanLibDirForGCCTriple() routine.
- If a user does not provide --sysroot argument to the driver explicitly, calculate new sysroot value based on command line options. Then use this calculated sysroot path: a. Use this sysroot in the Linux::Linux() constructor to populate file search paths list. b. Use this sysroot in the Linux::AddClangSystemIncludeArgs() routine to find Mips toolchain specific include headers directories. c. Pass the sysroot argument to the linker.
mips-linux-gnu is used for both LE and BE?