- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我正在阅读 golang ld 的帮助指南其中一个选项是
-B value
Add a NT_GNU_BUILD_ID note when using ELF. The value
should start with 0x and be an even number of hex digits.
有谁知道为什么要使用那个标志?
搜索 NT_GNU_BUILD_ID
没有提供任何有见地的答案。
最佳答案
这来自massive conversion from C to Go of cmd/new5l
(2015 年 2 月),翻译自 src/cmd/ld/pobj.c
该信息在 commit 7d507dc6e 中介绍(2013 年 12 月,Go 1.3),为新的链接器结构做准备
NT_GNU_BUILD_ID
是 mentioned here作为唯一的构建 ID 位串。
你看到它在 Fedora release build 中使用了
To embed an ID into both the stripped object and its
.debug
file, I've chosen to use an ELF note section.
strip
et al can keep the section intact in both files when its type isSHT_NOTE
.The new section is canonically called
.note.gnu.build-id
, but the name is not normative, and the section can be merged with otherSHT_NOTE
sections.
The ELF note headers give name "GNU
" and type 3 (NT_GNU_BUILD_ID
) for a build ID note, of which there can be only one in a linked object (or anET_REL
file of the.ko
style).
可以看到introduced in this patch in 2007 :
This patch adds a new option to
ld
for ELF targets,--build-id
.
It generates a synthetic ELF note section containing "unique build ID
" bits chosen byld
.This is done as an
ld
option to be efficient and foolproof to enable for every compilation (vs some script adding a generated object into the link).
It's done the way it is so it can use no more and no less than the exact final ELF bits of the output to contribute to selecting a unique ID.This is the best way to ensure that deterministic styles of ID generation (i.e. cryptographic hash) will always yield identical results for repeated builds reproduced precisely.
关于linux - NT_GNU_BUILD_ID 有什么用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29856780/
我正在阅读 golang ld 的帮助指南其中一个选项是 -B value Add a NT_GNU_BUILD_ID note when using ELF. The value
我是一名优秀的程序员,十分优秀!