Replacing ld with gold - any experience?(用黄金替换 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
.
这篇关于用黄金替换 ld - 有经验吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:用黄金替换 ld - 有经验吗?
基础教程推荐
- 为 C/C++ 中的项目的 makefile 生成依赖项 2022-01-01
- Windows Media Foundation 录制音频 2021-01-01
- 为什么语句不能出现在命名空间范围内? 2021-01-01
- 如何“在 Finder 中显示"或“在资源管理器中显 2021-01-01
- 在 C++ 中循环遍历所有 Lua 全局变量 2021-01-01
- 如何使图像调整大小以在 Qt 中缩放? 2021-01-01
- 管理共享内存应该分配多少内存?(助推) 2022-12-07
- 如何在不破坏 vtbl 的情况下做相当于 memset(this, ...) 的操作? 2022-01-01
- 使用从字符串中提取的参数调用函数 2022-01-01
- 从 std::cin 读取密码 2021-01-01