Shreesha Srinath
2013-Mar-05 21:42 UTC
[LLVMdev] Cross-Compiling libc++ using newlib/Clang based Toolchain.
Hi There, I am trying to build a cross-compiler for an architecture with MIPS like ISA. To begin with, I built a toolchain for MIPSr2 which uses: Clang-3.1 for preprocessing, compiling, optimizing; Binutils-2.22 for assembling and linking; Newlib-1.20.0 as the standard C library implementation. I modified the Clang Driver to use the correct binutils tools and linker scripts. Compiling Newlib with these changes was straightforward. I can compile C programs using the target triple at command line and I currently test it on a MIPS-GDB simulator I built. However, I am clueless on how to build the libc++ library using this toolchain. Modifying the "buidit" script to use "clang/clang++ -target mispel" did not help me much. I am excited about C++11 and would really like to be able to build the C++ library which can be used for the Clang-MIPS toolchain I have. Has anyone tried this before? I seek some pointers on how to go about this. Thanks, Shreesha -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130305/df26ed59/attachment.html>
Howard Hinnant
2013-Mar-05 23:16 UTC
[LLVMdev] Cross-Compiling libc++ using newlib/Clang based Toolchain.
On Mar 5, 2013, at 4:42 PM, Shreesha Srinath <ss2783 at cornell.edu> wrote:> Hi There, > > I am trying to build a cross-compiler for an architecture with MIPS like ISA. To begin with, I built a toolchain for MIPSr2 which uses: Clang-3.1 for preprocessing, compiling, optimizing; Binutils-2.22 for assembling and linking; Newlib-1.20.0 as the standard C library implementation. I modified the Clang Driver to use the correct binutils tools and linker scripts. Compiling Newlib with these changes was straightforward. I can compile C programs using the target triple at command line and I currently test it on a MIPS-GDB simulator I built. > > However, I am clueless on how to build the libc++ library using this toolchain. Modifying the "buidit" script to use "clang/clang++ -target mispel" did not help me much. I am excited about C++11 and would really like to be able to build the C++ library which can be used for the Clang-MIPS toolchain I have. Has anyone tried this before? I seek some pointers on how to go about this.The structure of libc++ has been kept purposefully simple to better enable first-time ports to new architectures. The general recipe is: compile everything in src/. Some platforms have required a bit more than that and have added /support/platform/ sources as well. In addition, you will probably need a low-level library which implements exception throwing/catching and dynamic_cast (and a few other details). libc++abi is here: http://libcxxabi.llvm.org libcxxrt is another implementation: https://github.com/pathscale/libcxxrt/ And http://libcxx.llvm.org reports success from using gcc's libsupc++ on Linux for this low-level support. I'm afraid you won't find a plug & play package for MIPS. Rather you'll have to port these libraries yourself, using other's experience porting to other platforms as your guide. I'm sure people would be glad to answer specific questions on <cfe-dev at cs.uiuc.edu>. Howard