forked from OSchip/llvm-project
634ddf0bec
This patch implements --build-id. After the linker creates an output file in the memory buffer, it computes the FNV1 hash of the resulting file and set the hash to the .note section as a build-id. GNU ld and gold have the same feature, but their default choice of the hash function is different. Their default is SHA1. We made a deliberate choice to not use a secure hash function for the sake of performance. Computing a secure hash is slow -- for example, MD5 throughput is usually 400 MB/s or so. SHA1 is slower than that. As a result, if you pass --build-id to gold, then the linker becomes about 10% slower than that without the option. We observed a similar degradation in an experimental implementation of build-id for LLD. On the other hand, we observed only 1-2% performance degradation with the FNV hash. Since build-id is not for digital certificate or anything, we think that a very small probability of collision is acceptable. We considered using other signals such as using input file timestamps as inputs to a secure hash function. But such signals would have an issue with build reproducibility (if you build a binary from the same source tree using the same toolchain, the build id should become the same.) GNU linkers accepts --build-id=<style> option where style is one of "MD5", "SHA1", or an arbitrary hex string. That option is out of scope of this patch. http://reviews.llvm.org/D18091 llvm-svn: 263292 |
||
---|---|---|
.. | ||
COFF | ||
ELF | ||
cmake/modules | ||
docs | ||
include/lld | ||
lib | ||
test | ||
tools/lld | ||
unittests | ||
.arcconfig | ||
.clang-format | ||
.gitignore | ||
CMakeLists.txt | ||
CODE_OWNERS.TXT | ||
LICENSE.TXT | ||
README.md |
README.md
LLVM Linker (lld)
This directory and its subdirectories contain source code for the LLVM Linker, a modular cross platform linker which is built as part of the LLVM compiler infrastructure project.
lld is open source software. You may freely distribute it under the terms of the license agreement found in LICENSE.txt.