简体   繁体   English

是否可以使用黄金链接器编译和链接Clang / LLVM?

[英]Is it possible to compile & link Clang/LLVM using the gold linker?

I'm writing a custom pass for LLVM/Clang, and recompiling tends to take a while and use a lot of memory. 我正在为LLVM / Clang编写自定义传递,重新编译往往需要一段时间并使用大量内存。 I've heard that the gold linker (1) takes less time and (2) uses less memory than the standard ld linker. 我听说黄金链接器(1)花费的时间更少,(2)使用的内存比标准的ld链接器少。

Is there a way to pass flags into the LLVM/Clang build process and change to the gold linker? 有没有办法将标志传递到LLVM / Clang构建过程并更改为黄金链接器? As per this answer , I've been attempting to use an override file, but I don't seem to be having a lot of success. 根据这个答案 ,我一直在尝试使用覆盖文件,但我似乎没有取得很大的成功。

I'll also note that I'm compiling the latest Clang/LLVM build (4.0) using Clang 3.9; 我还要注意到我正在使用Clang 3.9编译最新的Clang / LLVM版本(4.0); I don't mind switching back to GCC if necessary but would rather avoid it. 如果有必要,我不介意切换回GCC,而是宁愿避免它。

Post-4.0 (after commit rL292047 ), you should set LLVM_USE_LINKER to gold like so: 4.0之后(在提交rL292047之后 ),您应该将LLVM_USE_LINKER设置为gold如下所示:

cmake ... -DLLVM_USE_LINKER=gold ...

Refer to http://llvm.org/docs/CMake.html#llvm-specific-variables 请参阅http://llvm.org/docs/CMake.html#llvm-specific-variables

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Clang和CMake时使用LLVM链接器 - Using LLVM linker when using Clang & CMake 在win上编译clang / LLVM会导致编译错误 - 如何修复? - Compiling clang/LLVM on win results in compile errors - how to fix? 使用 CMake 在 GCC 和 Clang/LLVM 之间切换 - Switching between GCC and Clang/LLVM using CMake 启用 OpenMP 的简单代码无法编译:“clang: 错误:链接器命令失败,退出代码为 1” - Simple OpenMP-enabled code does not compile: "clang: error: linker command failed with exit code 1" Clion 失败并得到 clang: error: linker 命令失败,退出代码为 1,但它使用 clang++ - Clion failed and got clang: error: linker command failed with exit code 1, but it work using clang++ 构建llvm后找不到clang - clang not found after building llvm 无法使用 Visual Studio 在 Windows 上编译 llvm pass - Unable to compile llvm pass on Windows using Visual studio 如何使用 cmake+clang 从 windows 编译到树莓派 4? - How to compile from windows to raspberry pi 4 using cmake+clang? Clang:使用 Cmake 为我的项目构建 compile_commands.json - Clang: Using Cmake to build a compile_commands.json for my project 在我的项目中使用预编译头文件(clang / llvm,但也包括gcc)。 如何在make中部署-include选项? - Using precompiled headers in my project (clang/llvm, but gcc as well). How to deploy the -include option at make?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM