LLVM缺少链接器,无法编译lld(llvm链接器)

时间:2014-09-18 04:51:46

标签: linker llvm linker-errors lld

我想为新目标构建编译器,然后选择llvm。据我所知,我可以使用clang项目作为前端,将llvm作为后端。我可以从IE中获取.o文件(llvm的一部分)。现在我需要将它们全部链接到可执行文件中。我尝试使用lld项目,但编译时失败了错误:

Desktop/llvm_project/llvm/lib/Target/ARM/ARMISelLowering.cpp: In member function ‘llvm::Instruction* llvm::ARMTargetLowering::makeDMB(llvm::IRBuilder<>&, llvm::ARM_MB::MemBOpt) const’:
Desktop/llvm_project/llvm/lib/Target/ARM/ARMISelLowering.cpp:11000:73: error: could not convert ‘{(& Builder)->llvm::IRBuilder<>::<anonymous>.llvm::IRBuilderBase::getInt32(15u), (& Builder)->llvm::IRBuilder<>::<anonymous>.llvm::IRBuilderBase::getInt32(0u), (& Builder)->llvm::IRBuilder<>::<anonymous>.llvm::IRBuilderBase::getInt32(0u), (& Builder)->llvm::IRBuilder<>::<anonymous>.llvm::IRBuilderBase::getInt32(7u), (& Builder)->llvm::IRBuilder<>::<anonymous>.llvm::IRBuilderBase::getInt32(10u), (& Builder)->llvm::IRBuilder<>::<anonymous>.llvm::IRBuilderBase::getInt32(5u)}’ from ‘<brace-enclosed initializer list>’ to ‘llvm::ArrayRef<llvm::Value*>’
                                Builder.getInt32(10), Builder.getInt32(5)};
                                                                         ^
make[2]: *** [lib/Target/ARM/CMakeFiles/LLVMARMCodeGen.dir/ARMISelLowering.cpp.o] Error 1
make[1]: *** [lib/Target/ARM/CMakeFiles/LLVMARMCodeGen.dir/all] Error 2
make: *** [all] Error 2

所以我有几个问题,因为我觉得我错过了一些东西:

  1. 如果我没有新目标的binutils,我该如何使用llvm项目? - 他们创造了很棒的项目......但是没有最后一块实际创建运行文件的东西?我应该用什么作为链接器?
  2. 任何人遇到这个lld构建错误并解决了它?
  3. uname -a

    • Linux my_name-Inspiron-3521 3.13.0-35-generic#62-Ubuntu SMP Fri Aug 15 01:58:42 UTC 2014 x86_64 x86_64 x86_64 GNU / Linux

    gcc -v

    • 使用内置规格。 COLLECT_GCC = GCC COLLECT_LTO_WRAPPER = / usr / lib中/ GCC / x86_64的-Linux的GNU / 4.8 / LTO-包装 目标:x86_64-linux-gnu配置为:../ src / configure -v --with-pkgversion ='Ubuntu 4.8.2-19ubuntu1'--with-bugurl = file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages = c,c ++,java, go,d,fortran,objc,obj-c ++ --prefix = / usr --program-suffix = -4.8 --enable-shared --enable-linker-build-id --libexecdir = / usr / lib --without -included-gettext --enable-threads = posix --with-gxx-include-dir = / usr / include / c ++ / 4.8 --libdir = / usr / lib --enable-nls --with-sysroot = / - -enable-clocale = gnu --enable-libstdcxx-debug --enable-libstdcxx-time = yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib - disable-browser-plugin --enable-java-awt = gtk --enable-gtk-cairo --with-java-home = / usr / lib / jvm / java-1.5.0-gcj-4.8-amd64 / jre - -enable-java-home --with-jvm-root-dir = / usr / lib / jvm / java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir = / usr / lib / jvm -exports / java-1.5.0-gcj-4.8-amd64 --with-arch-directory = amd64 --with-ecj-jar = / usr / share / java / eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32 = i686 --with-abi = m64 --with-multilib-l ist = m32,m64,mx32 --with-tune = generic --enable-checking = release --build = x86_64-linux-gnu --host = x86_64-linux-gnu --target = x86_64-linux-gnu Thread model :posix gcc版本4.8.2(Ubuntu 4.8.2-19ubuntu1)

1 个答案:

答案 0 :(得分:0)

您遇到的错误是llvm本身,而不是lld。我在buildbots上没有看到错误,因此我建议您更新源代码树。

对于binutils,llvm目前不提供完全替代它们。这项工作正在进行中,但它还需要一段时间才能完成。现在我建议使用带有ld或gold作为链接器的gnu binutils。