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

半腔热情 提交于 2020-01-24 05:42:05

问题


I'm writing a custom pass for LLVM/Clang, and recompiling tends to take a while and use a lot of memory. I've heard that the gold linker (1) takes less time and (2) uses less memory than the standard ld linker.

Is there a way to pass flags into the LLVM/Clang build process and change to the gold linker? 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; I don't mind switching back to GCC if necessary but would rather avoid it.


回答1:


Post-4.0 (after commit rL292047), you should set LLVM_USE_LINKER to gold like so:

cmake ... -DLLVM_USE_LINKER=gold ...

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



来源:https://stackoverflow.com/questions/40536508/is-it-possible-to-compile-link-clang-llvm-using-the-gold-linker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!