有 llvm 的 binutils 吗?
LLVM编译器工具链有一个与普通gcc兼容的gcc。使用 llvm-gcc 的优点是它可以到达任意目标,这意味着当您尝试编译为随机架构(例如 mips-apple-darwin)时,普通 gcc 会说没有这样的目标。然而,llvm-gcc 实际上会在 mips 处理器上为 Mac OS X 构建一个编译器。
然而,这里有一个问题:要构建随机目标,您需要已经为该目标构建的 binutils。因此,如果您有一个 llvm 可以编译到但 binutils 不能的目标,那么您就无法生成编译器,因为 GNU Binutils 不支持该目标。
所以...问题是:是否有一个等效的 llvm-binutils(例如 llvm-gcc)与 GNU Binutils 兼容? (意思是构建到任意目标,而不是列表中的目标。)
编辑:
任意,我的意思是我在运行 llvm-gcc 时不选择目标,而是在编译 llvm-gcc 时选择目标。含义:如果我尝试为 mips-apple-darwin 编译 GCC,我会得到一个不支持的目标。但如果我为 mips-apple-darwin 构建 llvm-gcc,只要我有 mips-apple-darwin-as 和 mips-apple-darwin-ld,它就可以工作。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,LLVM 不会针对任意目标进行编译。您必须拥有适合您的目标的所有包含和定义,通常,llvm 有一个后端来为您的所述目标生成代码。阅读“我可以将 C 或 C++ 代码编译为平台无关的 LLVM 位代码吗?”来自 http://llvm.org/docs/FAQ.html 。
要回答这个问题,llvm不使用GNU binutils,llvm有自己的“binutils”来生成代码(称为LLVM核心项目)。反汇编器和调试器是 LLDB 项目的一部分。
LLVM 带来了一些独立性,这是在语言层面上。您的项目可以用 C/C++、Ada、Fortran 等进行编码……llvm 能够将您的代码转换为中间表示形式。该 IR 最终将生成代码。
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 不支持任意目标。 llvm-gcc 必须专门针对任何给定的目标构建。 clang+LLVM 即可。我正在尝试使用 ellcc 来做到这一点:http://ellcc.org。我正在使用 binutils 进行汇编和链接。
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.