Use lld linker for flang debug configuration.
Details
Diff Detail
- Repository
- rZORG LLVM Github Zorg
- Build Status
Buildable 94413 Build 131894: arc lint + arc unit
Event Timeline
Which linker does this worker/builder use? It might be worth making sure it's not bfd.
@awarzynski I really can't tell from the logs. here's the local build that passed: http://ex40-01.tcwglab.linaro.org:8019/#/builders/18/builds/81
Np, from here:
-- Linker detection: GNU ld
That's the bfd linker (yup, the log _does not_ make it easy to find!). For GNU gold you would get:
-- Linker detection: GNU Gold
LLD is even better :)
There are at least two ways to change the linker used by a worker/builder:
- change the system linker (check which ld and update the corresponding symbolic link)
- use LLVM_USE_LINKER when configuring CMake (more info: Building LLVM with CMake
More on linker-related issues when building LLVM: https://llvm.org/docs/GettingStarted.html#common-problems. More specifically, Flang has quite demanding memory requirements. It is really worth making sure that one uses the most efficient linker.
I hope that this helps :)
Thanks Andrzej!
I've installed lld on teh worker and used "-DLLVM_ENABLE_LLD=ON" flag here.
So what about parallel_link_jobs? Should we keep this setting or not?
This will depend on the number of cores and amount of RAM available. In general, I've never had to use LLVM_PARALLEL_LINK_JOBS. Switching to a more efficient linker has always been sufficient. But this depends on the spec of the machine.
Note that your current config is not working:
CMake Error at cmake/modules/HandleLLVMOptions.cmake:286 (message): Host compiler does not support '-fuse-ld=lld' Call Stack (most recent call first): CMakeLists.txt:697 (include)
I couldn't check which version of GCC introduced support for -fuse-ld=lld, but GCC 9.3.0 should be fine. Could you check gcc -fuse-ld=lld file.c for e.g.:
int main() { return 0;}
This worked for me on X86 and AArch64 (tested with GCC 10.2.0 and GCC 9.3.0).
Alternatively, you could use:
- GCC + ld.gold
- Clang + LLD
When I install lld package on the worker the current config works. Do you think that will be ok?
Personally I don't think that this a hack, but it's worth documenting somewhere what the default linker on that machine is. In particular, there is not much here ATM: http://ex40-01.tcwglab.linaro.org:8019/#/workers/100 (see Admin and Host - please, could you update?).
I'm not a Ubuntu user (or expert) myself, but AFAIK, /usr/bin/ld is just a symlink that points to another symlink (e.g. /usr/bin/ld.bfd). And GCC will probably use e.g. /usr/bin/ld.lld when going through -fuse-ld=lld. I think that the bottom line is that if you rely on /usr/bin/ld, then any system update/upgrade may restore the original config. So you may want to rely on /usr/bin/ld.lld instead.
Ok this seems more sensible then. I'll make sure that the lld is installed on the worker side in our setup. Let me know if there's anything else. Thanks!
This makes sense. Please update the commit message before merging (this has changed a bit since uploading) ;-)