链接时gcc可以使用多个内核吗? [英] Can gcc use multiple cores when linking?

查看:26
本文介绍了链接时gcc可以使用多个内核吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,当使用 GCC 编译大量源文件时,可以使用 -j 来使用所有可用的内核.但是链接器呢?是否有类似的选项可以加快链接速度,或者 GCC 不支持多线程?在一些较大的项目中,这确实需要一段时间......(......我讨厌等待!)

So when compiling tons of source files with GCC one can use -j to use all available cores. But what about the linker? Is there a similar option to speed up linking or does GCC not support multi-threading? In some larger projects it can really take a while ... (... and I hate to wait!)

感谢您指出 -j 是 make 而不是 gcc/g++ 的选项.但这并不能回答我的问题!我想知道gcc是否可以在链接一个程序时使用多线程!

Thanks for pointing out that -j is a option for make and not gcc/g++. But this does not answer my question! I would like to know if gcc can use multi threading while linking a program!

推荐答案

lld,由LLVM 项目,默认使用多核.我还发现它比多线程运行的黄金快 2 倍 (-Wl,--threads -Wl,--thread-count,xxx)

lld, the linker developed by the LLVM project, will use multiple cores by default. I have also found it to be about 2x faster than gold running with multiple threads (-Wl,--threads -Wl,--thread-count,xxx)

这篇关于链接时gcc可以使用多个内核吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆