aboutsummaryrefslogtreecommitdiff
path: root/ld/lexsup.c
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@redhat.com>2024-09-19 17:06:48 -0400
committerFrank Ch. Eigler <fche@redhat.com>2024-09-24 09:59:42 -0400
commit2299dfd4ba96c6852db862f6ec1b96880ecd6c0c (patch)
tree2cec04c6b5e9a2416697851a0072857f0b0dd5bd /ld/lexsup.c
parent07d74e51ba8691826b3bc758c2f7d2c1283e4d9b (diff)
downloadfsf-binutils-gdb-2299dfd4ba96c6852db862f6ec1b96880ecd6c0c.zip
fsf-binutils-gdb-2299dfd4ba96c6852db862f6ec1b96880ecd6c0c.tar.gz
fsf-binutils-gdb-2299dfd4ba96c6852db862f6ec1b96880ecd6c0c.tar.bz2
ld: support --build-id=xx mode
The is patch adds a new ld build-id computation mode, "xx", using xxhash in its 128-bit mode. The patch prereqs the xxhash-devel headers being installed, and uses the "all-inlined" model, so no run-time or link-time library dependence exists. The xxhash mode performs well, saving roughly 20% of total userspace run time from an ld job over a 800MB shared library relative to sha1. 128 bits of good hash should be collision-resistant to a number of distinct binaries that numbers in the 2**32 - 2**64 range, even if not "crypto" level hash. Confirmations of this are in progress. ld/configury: add --with-xxhash mode, different from gdb case because only using it in inline mode ld/ldbuildid.c: add "xx" mode, #if WITH_XXHASH ld/NEWS, ld.texi: mention new option ld/lexsup.c: add enumeration of --build-id STYLES to --help ld/testsuite/ld-elf/build-id.exp: add test case for 0xHEX case and conditional for xx case; also, simply tcl list syntax https://inbox.sourceware.org/binutils/20240917201509.GB26396@redhat.com/ Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
Diffstat (limited to 'ld/lexsup.c')
-rw-r--r--ld/lexsup.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 4aa0124..8982073 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -2278,6 +2278,15 @@ elf_static_list_options (FILE *file)
{
fprintf (file, _("\
--build-id[=STYLE] Generate build ID note\n"));
+ /* DEFAULT_BUILD_ID_STYLE n/a here */
+#ifdef WITH_XXHASH
+ fprintf (file, _("\
+ Styles: none,md5,sha1,xx,uuid,0xHEX\n"));
+ /* NB: testsuite/ld-elf/build-id.exp depends on this syntax */
+#else
+ fprintf (file, _("\
+ Styles: none,md5,sha1,uuid,0xHEX\n"));
+#endif
fprintf (file, _("\
--package-metadata[=JSON] Generate package metadata note\n"));
fprintf (file, _("\