用黄金替换 ld - 有经验吗?
有没有人尝试使用 gold 代替ld?
gold 承诺比ld,因此它可能有助于加快大型 C++ 应用程序的测试周期,但它可以用作 ld 的直接替代品吗?
gold promises to be much faster than ld, so it may help speeding up test cycles for large C++ applications, but can it be used as drop-in replacement for ld?
gcc/g++可以直接调用gold吗?
是否有任何已知的错误或问题?
Are there any know bugs or problems?
虽然 gold 是 GNU binutils 的一部分,但我在 Web 上几乎找不到成功故事"甚至Howtos".
Although gold is part of the GNU binutils since a while, I have found almost no "success stories" or even "Howtos" in the Web.
(更新:添加了指向黄金的链接和解释它的博客条目)
推荐答案
目前它正在 Ubuntu 10.04 上编译更大的项目.在这里,您可以轻松地安装它并将其与 binutils-gold 包集成(如果删除该包,您将获得旧的 ld).然后gcc会自动使用gold.
At the moment it is compiling bigger projects on Ubuntu 10.04. Here you can install and integrate it easily with the binutils-gold package (if you remove that package, you get your old ld). Gcc will automatically use gold then.
一些经验:
- gold 不在
/usr/local/lib 中搜索 - gold 不假定 pthread 或 rt 之类的库,必须手动添加它们
- 它更快并且需要更少的内存(后者对于具有大量提升等的大型 C++ 项目很重要)
什么不起作用:它不能编译内核的东西,因此没有内核模块.如果 Ubuntu 更新了 fglrx 等专有驱动程序,它会通过 DKMS 自动执行此操作.这会因 ld-gold 而失败(您必须移除黄金,重新启动 DKMS,重新安装 ld-gold.
What does not work: It cannot compile kernel stuff and therefore no kernel modules. Ubuntu does this automatically via DKMS if it updates proprietary drivers like fglrx. This fails with ld-gold (you have to remove gold, restart DKMS, reinstall ld-gold.
相关文章