简体   繁体   中英

Is there a binutils for llvm?

The LLVM compiler toolchain has a gcc that is compatible with normal gcc. The advantage of using llvm-gcc is that is goes to an arbitrary target, meaning normal gcc will say no such target when you try to compile to a random architecture, say mips-apple-darwin. llvm-gcc will, however, actually build a compiler for Mac OS X on a mips processor.

Here's the catch however: to build to a random target, you need the binutils built for that target already. So if you have a target that llvm would compile to but binutils can't, then you can't make the compiler because the GNU Binutils doesn't support that target.

So... Here's the question: Is there an equivalent llvm-binutils like an llvm-gcc that is compatable with GNU Binutils? (meaning one that builds to an arbitrary target, not one from a list.)

EDIT:

By arbitrary, I mean I don't pick the target when I run llvm-gcc, I pick the target when I compile llvm-gcc. Meaning: If I try to compile GCC for mips-apple-darwin, I get a target not supported. But If I build llvm-gcc for mips-apple-darwin, it works as long as I have mips-apple-darwin-as and mips-apple-darwin-ld.

As far as I can tell, LLVM does not compile for an arbitrary target. You must have all includes and definition to fit your target, and normally, llvm has a back-end to generate code for your said target. Read "Can I compile C or C++ code to platform-independent LLVM bitcode?" from http://llvm.org/docs/FAQ.html .

To answer the question, llvm does not uses GNU binutils, llvm has its own 'binutils' to generate code (called LLVM core project). Disassembler and debugger are part of LLDB project.

Where LLVM bring some independence, it's on the language level. Your project can be coded in C/C++, Ada, Fortran, etc ... llvm come with the ability to transform your code in an intermediate representation. That IR will eventually generate code.

llvm-gcc doesn't support arbitrary targets. llvm-gcc has to be built specifically for any given target. clang + LLVM can. I'm trying to do exactly that with ellcc: http://ellcc.org . I'm using binutils for assembly and linking.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM